Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
2.0 Beta 1
-
None
-
Operating System: other
Platform: Other
-
19286
Description
Description:
We are using httpClient to go through a proxy server using https protocol.
After getting the 200 from proxy server ("CONENCT" request), the tunnelled
connection is opened. As httpClient is going to do the actual "POST", in
checking the connection is open (inside HttpMethodBase.processRequest), the
HttpConnection method is calling isStale (). The isStale () method is trying
to read 1 byte as means of verifying the connection is still open, when no
bytes returned (byteRead = -1), it sets isStale to true and cause the
connection to be closed.
The code fragment is:
if (inputStream.available() == 0) {
LOG.debug ("inputStream.available() == 0");
try {
socket.setSoTimeout(1);
int byteRead = inputStream.read();
if (byteRead == -1)
else
{ inputStream.unread(byteRead); }} finally
{ socket.setSoTimeout(soTimeout); }}
The relavant trace/debug log is (I added some more logs):
2003/04/24 14:20:04:109 CDT [TRACE] HttpMethod - -enter
HttpMethodBase.processRequest(HttpState, HttpConnection)
2003/04/24 14:20:04:109 CDT [TRACE] HttpMethod - -Attempt number 1 to process
request
2003/04/24 14:20:04:109 CDT [DEBUG] HttpConnection - -inputStream.available()
== 0
2003/04/24 14:20:04:109 CDT [DEBUG] HttpConnection - -setting isStale to true
due to byteRead = -1
2003/04/24 14:20:04:109 CDT [DEBUG] HttpConnection - -Connection is stale,
closing...
2003/04/24 14:20:04:109 CDT [TRACE] HttpConnection - -enter HttpConnection.close
()
2003/04/24 14:20:04:109 CDT [TRACE] HttpConnection - -enter
HttpConnection.closeSockedAndStreams()