hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 19286] - httpClient incorrectly closing tunnelled connection right after tunnell established
Date Thu, 24 Apr 2003 19:51:32 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19286>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19286

httpClient incorrectly closing tunnelled connection right after tunnell established





------- Additional Comments From olegk@apache.org  2003-04-24 19:51 -------
I have experienced exactly the same problem while working on Bin's previous bug
report. The bug appears to affect Java 1.2.2 platform only. Java 1.4.1 appears
to not be subject to the problem. Apparently in JVM 1.2.2 tunneled connection
erroneously appears stale, which prompts HttpClient to close it.

Please find below the code snippet that shows how the bug can be
reproduced, as well as the resultant wire & debug logs

Oleg  

import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.protocol.*;
import org.apache.commons.httpclient.contrib.ssl.*;

Protocol easyhttps = new Protocol(
  "https", new EasySSLProtocolSocketFactory(), 443); 
 
HttpClient client = new HttpClient();
client.getHostConfiguration().setHost("localhost", 443, easyhttps);
client.getHostConfiguration().setProxy("localhost", 3128);
client.getState().setProxyCredentials("proxy", "localhost", new
UsernamePasswordCredentials("cache", "cache"));
GetMethod httpget = new
GetMethod("/examples/servlet/RequestHeaderExample");
client.executeMethod(httpget);
httpget.releaseConnection();

======= Debug log ===============================================

[DEBUG] HttpClient - -Java version: 1.2.2
[DEBUG] HttpClient - -Java vendor: Sun Microsystems Inc.
[DEBUG] HttpClient - -Java class path: /home/ok/workspace/Jakarta
Commons HTTP client
test/bin:/opt/eclipse/plugins/org.junit_3.8.1/junit.jar:/home/ok/src/jakarta/httpclient/bin:/home/ok/src/jakarta/httpclient/lib/commons-logging.jar
[DEBUG] HttpClient - -Operating system name: Linux
[DEBUG] HttpClient - -Operating system architecture: i386
[DEBUG] HttpClient - -Operating system version: 2.4.20-9-ok
[DEBUG] HttpClient - -SUN 1.2: SUN (DSA key/parameter generation; DSA
signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS
keystore)
[DEBUG] HttpClient - -SunJSSE 1.0301: Sun JSSE provider(implements RSA
Signatures, PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
[DEBUG] HttpConnection - -Creating connection for localhost via
localhost using protocol https:443
[DEBUG] HttpConnection - -Connection is stale, closing...
[DEBUG] HttpConnection - -HttpConnection.setSoTimeout(0)
[DEBUG] HttpMethod - -Preemptively sending default basic credentials
[DEBUG] HttpMethod - -Execute loop try 1
[DEBUG] HttpMethod - -Adding Host request header
[DEBUG] HttpMethod - -Authorization required
[DEBUG] HttpAuthenticator - -Using 'proxy' authentication realm
[DEBUG] HttpMethod - -HttpMethodBase.execute(): Server demanded
authentication credentials, will try again.
[DEBUG] HttpMethod - -Execute loop try 2
[DEBUG] HttpConnection - -Connection is stale, closing...
[DEBUG] HttpMethod - -Opening the connection.
[DEBUG] HttpMethod - -Request to add Host header ignored: header already
added
[DEBUG] ConnectMethod - -CONNECT status code 200
[DEBUG] HttpConnection - -Secure tunnel created
[DEBUG] HttpMethod - -Preemptively sending default basic credentials
[DEBUG] HttpMethod - -Execute loop try 1
[DEBUG] HttpConnection - -Connection is stale, closing...
[DEBUG] HttpMethod - -Opening the connection.
[DEBUG] HttpMethod - -Request to add Host header ignored: header already
added
[DEBUG] HttpMethod - -Authorization required
[DEBUG] HttpAuthenticator - -Using 'proxy' authentication realm
[DEBUG] HttpMethod - -HttpMethodBase.execute(): Server demanded
authentication credentials, will try again.
[DEBUG] HttpMethod - -Should close connection since using HTTP/1.0.
[DEBUG] HttpMethod - -Execute loop try 2
[DEBUG] HttpConnection - -Connection is stale, closing...
[DEBUG] HttpMethod - -Opening the connection.
[DEBUG] HttpMethod - -Request to add Host header ignored: header already
added
[DEBUG] HttpMethod - -Should close connection since using HTTP/1.0.


======== Wire log ==================================================

[DEBUG] wire - ->> "CONNECT localhost:443 HTTP/1.1"
[DEBUG] wire - ->> "Host: localhost[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - -<< "HTTP/1.0 407 Proxy Authentication Required[\r][\n]"
[DEBUG] wire - -<< "Server: squid/2.5.STABLE1[\r][\n]"
[DEBUG] wire - -<< "Mime-Version: 1.0[\r][\n]"
[DEBUG] wire - -<< "Date: Thu, 24 Apr 2003 19:19:27 GMT[\r][\n]"
[DEBUG] wire - -<< "Content-Type: text/html[\r][\n]"
[DEBUG] wire - -<< "Content-Length: 1310[\r][\n]"
[DEBUG] wire - -<< "Expires: Thu, 24 Apr 2003 19:19:27 GMT[\r][\n]"
[DEBUG] wire - -<< "X-Squid-Error: ERR_CACHE_ACCESS_DENIED 0[\r][\n]"
[DEBUG] wire - -<< "Proxy-Authenticate: Basic realm="proxy"[\r][\n]"
[DEBUG] wire - -<< "X-Cache: MISS from
kczrh-okt22.corp.bearingpoint.com[\r][\n]"
[DEBUG] wire - -<< "Proxy-Connection: close[\r][\n]"
[DEBUG] wire - -<< "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">[\n]"
[DEBUG] wire - -<< "<HTML><HEAD><META HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=iso-8859-1">[\n]"
[DEBUG] wire - -<< "<TITLE>ERROR: Cache Access Denied</TITLE>[\n]"
[DEBUG] wire - -<< "<STYLE
type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>[\n]"
[DEBUG] wire - -<< "</HEAD>[\n]"
[DEBUG] wire - -<< "<BODY>[\n]"
[DEBUG] wire - -<< "<H1>ERROR</H1>[\n]"
[DEBUG] wire - -<< "<H2>Cache Access Denied</H2>[\n]"
[DEBUG] wire - -<< "<HR noshade size="1px">[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "While trying to retrieve the URL:[\n]"
[DEBUG] wire - -<< "<A HREF="localhost:443">localhost:443</A>[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "The following error was encountered:[\n]"
[DEBUG] wire - -<< "<UL>[\n]"
[DEBUG] wire - -<< "<LI>[\n]"
[DEBUG] wire - -<< "<STRONG>[\n]"
[DEBUG] wire - -<< "Cache Access Denied.[\n]"
[DEBUG] wire - -<< "</STRONG>[\n]"
[DEBUG] wire - -<< "</UL>[\n]"
[DEBUG] wire - -<< "</P>[\n]"
[DEBUG] wire - -<< "[\n]"
[DEBUG] wire - -<< "<P>Sorry, you are not currently allowed to
request:[\n]"
[DEBUG] wire - -<< "<PRE>    localhost:443</PRE>[\n]"
[DEBUG] wire - -<< "from this cache until you have authenticated
yourself.[\n]"
[DEBUG] wire - -<< "</P>[\n]"
[DEBUG] wire - -<< "[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "You need to use Netscape version 2.0 or greater, or
Microsoft Internet[\n]"
[DEBUG] wire - -<< "Explorer 3.0, or an HTTP/1.1 compliant browser for
this to work.  Please[\n]"
[DEBUG] wire - -<< "contact the <A HREF="mailto:root">cache
administrator</a> if you have[\n]"
[DEBUG] wire - -<< "difficulties authenticating yourself or [\n]"
[DEBUG] wire - -<< "<A
HREF="http://kczrh-okt22.corp.bearingpoint.com/cgi-bin/chpasswd.cgi">change</a>
your default password.[\n]"
[DEBUG] wire - -<< "</P>[\n]"
[DEBUG] wire - -<< "[\n]"
[DEBUG] wire - -<< "<BR clear="all">[\n]"
[DEBUG] wire - -<< "<HR noshade size="1px">[\n]"
[DEBUG] wire - -<< "<ADDRESS>[\n]"
[DEBUG] wire - -<< "Generated Thu, 24 Apr 2003 19:19:27 GMT by
kczrh-okt22.corp.bearingpoint.com (squid/2.5.STABLE1)[\n]"
[DEBUG] wire - -<< "</ADDRESS>[\n]"
[DEBUG] wire - -<< "</BODY></HTML>[\n]"
[DEBUG] wire - ->> "CONNECT localhost:443 HTTP/1.1"
[DEBUG] wire - ->> "Host: localhost[\r][\n]"
[DEBUG] wire - ->> "Proxy-Authorization: Basic Y2FjaGU6Y2FjaGU=[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - -<< "HTTP/1.0 200 Connection established[\r][\n]"
[DEBUG] wire - ->> "GET
https://localhost/examples/servlet/RequestHeaderExample
HTTP/1.1[\r][\n]"
[DEBUG] wire - ->> "User-Agent: Jakarta
Commons-HttpClient/2.0alpha3[\r][\n]"
[DEBUG] wire - ->> "Host: localhost[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - -<< "HTTP/1.0 407 Proxy Authentication Required[\r][\n]"
[DEBUG] wire - -<< "Server: squid/2.5.STABLE1[\r][\n]"
[DEBUG] wire - -<< "Mime-Version: 1.0[\r][\n]"
[DEBUG] wire - -<< "Date: Thu, 24 Apr 2003 19:19:33 GMT[\r][\n]"
[DEBUG] wire - -<< "Content-Type: text/html[\r][\n]"
[DEBUG] wire - -<< "Content-Length: 1436[\r][\n]"
[DEBUG] wire - -<< "Expires: Thu, 24 Apr 2003 19:19:33 GMT[\r][\n]"
[DEBUG] wire - -<< "X-Squid-Error: ERR_CACHE_ACCESS_DENIED 0[\r][\n]"
[DEBUG] wire - -<< "Proxy-Authenticate: Basic realm="proxy"[\r][\n]"
[DEBUG] wire - -<< "X-Cache: MISS from
kczrh-okt22.corp.bearingpoint.com[\r][\n]"
[DEBUG] wire - -<< "Proxy-Connection: close[\r][\n]"
[DEBUG] wire - -<< "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">[\n]"
[DEBUG] wire - -<< "<HTML><HEAD><META HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=iso-8859-1">[\n]"
[DEBUG] wire - -<< "<TITLE>ERROR: Cache Access Denied</TITLE>[\n]"
[DEBUG] wire - -<< "<STYLE
type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>[\n]"
[DEBUG] wire - -<< "</HEAD>[\n]"
[DEBUG] wire - -<< "<BODY>[\n]"
[DEBUG] wire - -<< "<H1>ERROR</H1>[\n]"
[DEBUG] wire - -<< "<H2>Cache Access Denied</H2>[\n]"
[DEBUG] wire - -<< "<HR noshade size="1px">[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "While trying to retrieve the URL:[\n]"
[DEBUG] wire - -<< "<A
HREF="https://localhost/examples/servlet/RequestHeaderExample">https://localhost/examples/servlet/RequestHeaderExample</A>[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "The following error was encountered:[\n]"
[DEBUG] wire - -<< "<UL>[\n]"
[DEBUG] wire - -<< "<LI>[\n]"
[DEBUG] wire - -<< "<STRONG>[\n]"
[DEBUG] wire - -<< "Cache Access Denied.[\n]"
[DEBUG] wire - -<< "</STRONG>[\n]"
[DEBUG] wire - -<< "</UL>[\n]"
[DEBUG] wire - -<< "</P>[\n]"
[DEBUG] wire - -<< "[\n]"
[DEBUG] wire - -<< "<P>Sorry, you are not currently allowed to
request:[\n]"
[DEBUG] wire - -<< "<PRE>   
https://localhost/examples/servlet/RequestHeaderExample</PRE>[\n]"
[DEBUG] wire - -<< "from this cache until you have authenticated
yourself.[\n]"
[DEBUG] wire - -<< "</P>[\n]"
[DEBUG] wire - -<< "[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "You need to use Netscape version 2.0 or greater, or
Microsoft Internet[\n]"
[DEBUG] wire - -<< "Explorer 3.0, or an HTTP/1.1 compliant browser for
this to"
[DEBUG] wire - -<< " work.  Please[\n]"
[DEBUG] wire - -<< "contact the <A HREF="mailto:root">cache
administrator</a> if you have[\n]"
[DEBUG] wire - -<< "difficulties authenticating yourself or [\n]"
[DEBUG] wire - -<< "<A
HREF="http://kczrh-okt22.corp.bearingpoint.com/cgi-bin/chpasswd.cgi">change</a>
your default password.[\n]"
[DEBUG] wire - -<< "</P>[\n]"
[DEBUG] wire - -<< "[\n]"
[DEBUG] wire - -<< "<BR clear="all">[\n]"
[DEBUG] wire - -<< "<HR noshade size="1px">[\n]"
[DEBUG] wire - -<< "<ADDRESS>[\n]"
[DEBUG] wire - -<< "Generated Thu, 24 Apr 2003 19:19:33 GMT by
kczrh-okt22.corp.bearingpoint.com (squid/2.5.STABLE1)[\n]"
[DEBUG] wire - -<< "</ADDRESS>[\n]"
[DEBUG] wire - -<< "</BODY></HTML>[\n]"
[DEBUG] wire - ->> "GET
https://localhost/examples/servlet/RequestHeaderExample
HTTP/1.0[\r][\n]"
[DEBUG] wire - ->> "User-Agent: Jakarta
Commons-HttpClient/2.0alpha3[\r][\n]"
[DEBUG] wire - ->> "Host: localhost[\r][\n]"
[DEBUG] wire - ->> "Proxy-Authorization: Basic Y2FjaGU6Y2FjaGU=[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - -<< "HTTP/1.0 400 Bad Request[\r][\n]"
[DEBUG] wire - -<< "Server: squid/2.5.STABLE1[\r][\n]"
[DEBUG] wire - -<< "Mime-Version: 1.0[\r][\n]"
[DEBUG] wire - -<< "Date: Thu, 24 Apr 2003 19:19:33 GMT[\r][\n]"
[DEBUG] wire - -<< "Content-Type: text/html[\r][\n]"
[DEBUG] wire - -<< "Content-Length: 1122[\r][\n]"
[DEBUG] wire - -<< "Expires: Thu, 24 Apr 2003 19:19:33 GMT[\r][\n]"
[DEBUG] wire - -<< "X-Squid-Error: ERR_UNSUP_REQ 0[\r][\n]"
[DEBUG] wire - -<< "X-Cache: MISS from
kczrh-okt22.corp.bearingpoint.com[\r][\n]"
[DEBUG] wire - -<< "Proxy-Connection: close[\r][\n]"
[DEBUG] wire - -<< "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">[\n]"
[DEBUG] wire - -<< "<HTML><HEAD><META HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=iso-8859-1">[\n]"
[DEBUG] wire - -<< "<TITLE>ERROR: The requested URL could not be
retrieved</TITLE>[\n]"
[DEBUG] wire - -<< "<STYLE
type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>[\n]"
[DEBUG] wire - -<< "</HEAD><BODY>[\n]"
[DEBUG] wire - -<< "<H1>ERROR</H1>[\n]"
[DEBUG] wire - -<< "<H2>The requested URL could not be
retrieved</H2>[\n]"
[DEBUG] wire - -<< "<HR noshade size="1px">[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "While trying to retrieve the URL:[\n]"
[DEBUG] wire - -<< "<A
HREF="https://localhost/examples/servlet/RequestHeaderExample">https://localhost/examples/servlet/RequestHeaderExample</A>[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "The following error was encountered:[\n]"
[DEBUG] wire - -<< "<UL>[\n]"
[DEBUG] wire - -<< "<LI>[\n]"
[DEBUG] wire - -<< "<STRONG>[\n]"
[DEBUG] wire - -<< "Unsupported Request Method and Protocol[\n]"
[DEBUG] wire - -<< "</STRONG>[\n]"
[DEBUG] wire - -<< "</UL>[\n]"
[DEBUG] wire - -<< "[\n]"
[DEBUG] wire - -<< "<P>[\n]"
[DEBUG] wire - -<< "Squid does not support all request methods for all
access protocols.[\n]"
[DEBUG] wire - -<< "For example, you can not POST a Gopher request.[\n]"
[DEBUG] wire - -<< "<P>Your cache administrator is <A
HREF="mailto:root">root</A>. [\n]"
[DEBUG] wire - -<< "[\n]"
[DEBUG] wire - -<< "<BR clear="all">[\n]"
[DEBUG] wire - -<< "<HR noshade size="1px">[\n]"
[DEBUG] wire - -<< "<ADDRESS>[\n]"
[DEBUG] wire - -<< "Generated Thu, 24 Apr 200"
[DEBUG] wire - -<< "3 19:19:33 GMT by kczrh-okt22.corp.bearingpoint.com
(squid/2.5.STABLE1)[\n]"
[DEBUG] wire - -<< "</ADDRESS>[\n]"
[DEBUG] wire - -<< "</BODY></HTML>[\n]"

Mime
View raw message