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,8 @@ multiCastSender.multiCastFailed=Unable to use multicast
2525multiCastSender.sendFailed =Unable to send multicast message
2626
2727tcpSender.connectionFailed =Unable to connect to proxy
28+ tcpSender.invalidContentLength =Unable to parse content length [{0}]
29+ tcpSender.invalidHeaderLine =Unable to parse header line [{0}]
2830tcpSender.invalidProxyList =Invalid proxy list
2931tcpSender.notInitialized =Not initialized
3032tcpSender.readError =Error reading response content
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ public int send(String mess) throws Exception {
177177 // Ignore
178178 }
179179 if (status != 200 ) {
180- log .error (sm .getString ("tcpSender.responseErrorCode" , Integer . valueOf ( status ) ));
180+ log .error (sm .getString ("tcpSender.responseErrorCode" , responseStatus ));
181181 close (i );
182182 continue ;
183183 }
@@ -191,8 +191,20 @@ public int send(String mess) throws Exception {
191191 String headerName = header .substring (0 , colon ).trim ();
192192 String headerValue = header .substring (colon + 1 ).trim ();
193193 if ("content-length" .equalsIgnoreCase (headerName )) {
194- contentLength = Integer .parseInt (headerValue );
194+ try {
195+ contentLength = Integer .parseInt (headerValue );
196+ } catch (NumberFormatException e ) {
197+ log .error (sm .getString ("tcpSender.invalidContentLength" , headerValue ));
198+ close (i );
199+ break ;
200+ }
195201 }
202+ } else {
203+ log .error (sm .getString ("tcpSender.invalidHeaderLine" , header ));
204+ close (i );
205+ // Clear any content length if one has been read.
206+ contentLength = 0 ;
207+ break ;
196208 }
197209 header = connectionReaders [i ].readLine ();
198210 }
You can’t perform that action at this time.
0 commit comments