File tree Expand file tree Collapse file tree
java/org/apache/catalina/ha/backend Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ multiCastSender.multiCastFailed=Unable to use multicast
2525multiCastSender.sendFailed =Unable to send multicast message
2626
2727tcpSender.connectionFailed =Unable to connect to proxy
28+ tcpSender.duplicateContentLength =The response contained more than one content-length header
2829tcpSender.invalidContentLength =Unable to parse content length [{0}]
2930tcpSender.invalidHeaderLine =Unable to parse header line [{0}]
3031tcpSender.invalidProxyList =Invalid proxy list
Original file line number Diff line number Diff line change @@ -187,15 +187,24 @@ public int send(String mess) throws Exception {
187187 int contentLength = 0 ;
188188 while (header != null && !header .isEmpty ()) {
189189 int colon = header .indexOf (':' );
190- if (colon >= 0 && header . length () > ( colon + 1 ) ) {
190+ if (colon >= 0 ) {
191191 String headerName = header .substring (0 , colon ).trim ();
192192 String headerValue = header .substring (colon + 1 ).trim ();
193193 if ("content-length" .equalsIgnoreCase (headerName )) {
194+ if (contentLength > 0 ) {
195+ log .error (sm .getString ("tcpSender.duplicateContentLength" ));
196+ close (i );
197+ // Clear any content length if one has been read.
198+ contentLength = 0 ;
199+ break ;
200+ }
194201 try {
195202 contentLength = Integer .parseInt (headerValue );
196203 } catch (NumberFormatException e ) {
197204 log .error (sm .getString ("tcpSender.invalidContentLength" , headerValue ));
198205 close (i );
206+ // Clear any content length if one has been read.
207+ contentLength = 0 ;
199208 break ;
200209 }
201210 }
You can’t perform that action at this time.
0 commit comments