hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Drake Henderson" <dhender...@winterheights.com>
Subject RE: download a file
Date Wed, 19 Mar 2003 01:45:42 GMT
Here is the trace/wire.  Thanks


2003/03/18 20:42:29:203 EST [TRACE] HttpState - -enter
HttpState.setCredentials(String, Credentials)

2003/03/18 20:42:29:213 EST [TRACE] HttpState - -enter
HttpState.setCredentials(String, Credentials)

2003/03/18 20:42:29:393 EST [TRACE] GetMethod - -enter GetMethod(String)
2003/03/18 20:42:29:393 EST [TRACE] HttpClient - -enter
HttpClient.executeMethod(HostConfiguration,H
ttpMethod)
2003/03/18 20:42:29:423 EST [DEBUG]
HttpConnection - -HttpConnectionManager.getConnection:  creating
  connection for www.winterheights.com:2082 via null:-1 using protocol:
http:80
2003/03/18 20:42:29:433 EST [DEBUG]
HttpConnection - -HttpConnection.setSoTimeout(0)
2003/03/18 20:42:29:433 EST [TRACE] HttpConnection - -enter
HttpConnection.open()
2003/03/18 20:42:29:683 EST [TRACE] HttpMethod - -enter
HttpMethodBase.execute(HttpState, HttpConnec
tion)
2003/03/18 20:42:29:703 EST [TRACE] Authenticator - -enter
Authenticator.authenticate(HttpMethod, Ht
tpState)
2003/03/18 20:42:29:713 EST [TRACE] Authenticator - -enter
Authenticator.authenticate(HttpMethod, Ht
tpState, Header, String)
2003/03/18 20:42:29:713 EST [DEBUG] HttpMethod - -Execute loop try 1
2003/03/18 20:42:29:723 EST [TRACE] HttpMethod - -enter
HttpMethodBase.processRequest(HttpState, Htt
pConnection)
2003/03/18 20:42:29:723 EST [TRACE] HttpMethod - -Attempt number 1 to write
request
2003/03/18 20:42:29:733 EST [TRACE] HttpMethod - -enter
HttpMethodBase.writeRequest(HttpState, HttpC
onnection)
2003/03/18 20:42:29:733 EST [TRACE] HttpMethod - -enter
HttpMethodBase.writeRequestLine(HttpState, H
ttpConnection)
2003/03/18 20:42:29:783 EST [TRACE] HttpMethod - -enter
HttpMethodBase.generateRequestLine(HttpConne
ction, String, String, String, String)
2003/03/18 20:42:29:793 EST [TRACE] HttpConnection - -enter
HttpConnection.print(String)
2003/03/18 20:42:29:813 EST [TRACE] HttpConnection - -enter
HttpConnection.write(byte[])
2003/03/18 20:42:29:813 EST [TRACE] HttpConnection - -enter
HttpConnection.write(byte[], int, int)
2003/03/18 20:42:29:813 EST [DEBUG] wire - ->> "GET /getsqlbackup/trace.gz
HTTP/1.1
" [\r\n]
2003/03/18 20:42:29:823 EST [TRACE] HttpMethod - -enter
HttpMethodBase.writeRequestHeaders(HttpState
,HttpConnection)
2003/03/18 20:42:29:833 EST [TRACE] HttpMethod - -enter
HttpMethodBase.addRequestHeaders(HttpState,
HttpConnection)
2003/03/18 20:42:29:833 EST [TRACE] HttpMethod - -enter
HttpMethodBase.addUserAgentRequestHeaders(Ht
tpState, HttpConnection)
2003/03/18 20:42:29:843 EST [TRACE] HttpMethod - -enter
HttpMethodBase.addHostRequestHeader(HttpStat
e, HttpConnection)
2003/03/18 20:42:29:853 EST [DEBUG] HttpMethod - -Adding Host request header
2003/03/18 20:42:29:853 EST [TRACE] HttpMethod - -enter
HttpMethodBase.addCookieRequestHeader(HttpSt
ate, HttpConnection)
2003/03/18 20:42:29:884 EST [TRACE] HttpState - -enter
HttpState.getCookies()
2003/03/18 20:42:29:894 EST [TRACE] CookieSpec - -enter
CookieSpecBase.match(String, int, String, bo
olean, Cookie[])
2003/03/18 20:42:29:894 EST [TRACE] HttpMethod - -enter
HttpMethodBase.addAuthorizationRequestHeader
(HttpState, HttpConnection)
2003/03/18 20:42:29:904 EST [TRACE] HttpMethod - -enter
HttpMethodBase.addProxyAuthorizationRequestH
eader(HttpState, HttpConnection)
2003/03/18 20:42:29:914 EST [TRACE] HttpMethod - -enter
HttpMethodBase.addContentLengthRequestHeader
(HttpState, HttpConnection)
2003/03/18 20:42:29:914 EST [TRACE] HttpConnection - -enter
HttpConnection.print(String)
2003/03/18 20:42:29:924 EST [TRACE] HttpConnection - -enter
HttpConnection.write(byte[])
2003/03/18 20:42:29:924 EST [TRACE] HttpConnection - -enter
HttpConnection.write(byte[], int, int)
2003/03/18 20:42:29:924 EST [DEBUG] wire - ->> "User-Agent: Jakarta
Commons-HttpClient/2.0alpha3
" [\r\n]
2003/03/18 20:42:29:924 EST [TRACE] HttpConnection - -enter
HttpConnection.print(String)
2003/03/18 20:42:29:924 EST [TRACE] HttpConnection - -enter
HttpConnection.write(byte[])
2003/03/18 20:42:29:924 EST [TRACE] HttpConnection - -enter
HttpConnection.write(byte[], int, int)
2003/03/18 20:42:29:924 EST [DEBUG] wire - ->> "Host:
www.winterheights.com:2082
" [\r\n]
2003/03/18 20:42:29:924 EST [TRACE] HttpConnection - -enter
HttpConnection.writeLine()
2003/03/18 20:42:29:934 EST [DEBUG] wire - ->> [\r\n]
2003/03/18 20:42:29:934 EST [TRACE] HttpMethod - -enter
HttpMethodBase.readResponse(HttpState, HttpC
onnection)
2003/03/18 20:42:29:954 EST [TRACE] HttpMethod - -enter
HttpMethodBase.readStatusLine(HttpState, Htt
pConnection)
2003/03/18 20:42:29:954 EST [TRACE] HttpConnection - -enter
HttpConnection.readLine()
2003/03/18 20:42:29:974 EST [TRACE] HttpParser - -enter
HttpConnection.readLine()
2003/03/18 20:42:29:974 EST [TRACE] HttpParser - -enter
HttpConnection.readRawLine()
2003/03/18 20:42:30:004 EST [DEBUG] wire - -<< "HTTP/1.0 401 Still Working
WWW-Authenticate: Basic realm="Cpanel 6.0"
Connection: close
Set-Cookie: cprelogin=no; path=/
Server: cpaneld/6.0
Content-type: text/html

<h1>Access Denied</h1>

2003/03/18 20:42:30:014 EST [TRACE] HttpMethod - -enter
HttpMethodBase.readResponseHeaders(HttpState
,HttpConnection)
2003/03/18 20:42:30:014 EST [TRACE] HttpConnection - -enter
HttpConnection.getResponseInputStream()
2003/03/18 20:42:30:014 EST [TRACE] HttpParser - -enter
HeaderParser.parseHeaders(HttpConnection, He
aderGroup)
2003/03/18 20:42:30:014 EST [TRACE] HttpParser - -enter
HttpConnection.readLine()
2003/03/18 20:42:30:014 EST [TRACE] HttpParser - -enter
HttpConnection.readRawLine()
2003/03/18 20:42:30:044 EST [DEBUG] wire - -<< "
2003/03/18 20:42:30:044 EST [TRACE] HttpMethod - -enter
HttpMethodBase.processResponseHeaders(HttpSt
ate, HttpConnection)
2003/03/18 20:42:30:054 EST [TRACE] GetMethod - -enter
GetMethod.readResponseBody(HttpState, HttpCon
nection)
2003/03/18 20:42:30:054 EST [TRACE] HttpMethod - -enter
HttpMethodBase.readResponseBody(HttpState, H
ttpConnection)
2003/03/18 20:42:30:074 EST [TRACE] HttpMethod - -enter
HttpMethodBase.readResponseBody(HttpState, H
ttpConnection)
2003/03/18 20:42:30:074 EST [TRACE] HttpConnection - -enter
HttpConnection.getResponseInputStream()
2003/03/18 20:42:30:084 EST [TRACE] HttpMethod - -enter
HttpMethodBase.canResponseHaveBody(int)
2003/03/18 20:42:30:084 EST [TRACE] HttpMethod - -enter
writeRemainingRequestBody(HttpState, HttpCon
nection)
2003/03/18 20:42:30:084 EST [DEBUG] HttpMethod - -Authorization required
2003/03/18 20:42:30:084 EST [TRACE] HttpMethod - -enter
HttpMethodBase.processAuthenticationResponse
(HttpState, HttpConnection)
2003/03/18 20:42:30:104 EST [TRACE] GetMethod - -enter
GetMethod.getResponseBodyAsStream()
2003/03/18 20:42:30:114 EST [DEBUG] wire - -<<




































































































2003/03/18 20:42:30:294 EST [DEBUG] HttpMethod - -Should close connection
since using HTTP/1.0, Conn
ectMethod and status is OK
2003/03/18 20:42:30:294 EST [TRACE] HttpConnection - -enter
HttpConnection.close()
2003/03/18 20:42:30:304 EST [TRACE] HttpConnection - -enter
HttpConnection.closeSockedAndStreams()
2003/03/18 20:42:30:304 EST [TRACE] HttpConnection - -enter
HttpConnection.releaseConnection()

-----Original Message-----
From: Adrian Sutton [mailto:adrian.sutton@ephox.com]
Sent: Tuesday, March 18, 2003 8:16 PM
To: 'Commons HttpClient Project'
Subject: RE: download a file


Goes to show how confusing that URI class can be. <grin>

Anyway, you're code looks good for setting the default credentials to use.
I think you'll need to provide the full wire trace log and the seasoned
experts around here should be able to see the problem (slap me if I've just
missed the log file go flying by).

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com


-----Original Message-----
From: Drake Henderson [mailto:dhenderson@winterheights.com]
Sent: Wednesday, 19 March 2003 10:59 AM
To: Commons HttpClient Project
Subject: RE: download a file


I did some more testing with and without a host configuration in accessing a
different port.  It does work either way.  I think the last part of the log
message threw me off in stating http:80 (see below).  So, now I am back to
thinking it is an authentication problem.  Based on the
BasicAuthenticationExample, I assume that all that is required is to set
credentials
        client.getState().setCredentials(
            null,
            new UsernamePasswordCredentials("user", "pwd")
        );

and then set
        get.setDoAuthentication( true );

The null in setCredentials means set this user/pwd as default.


log...

2003/03/18 19:52:02:200 EST [DEBUG]
HttpConnection - -HttpConnectionManager.getConnection:  creating connection
for 127.0.0.1:8080 via null:-1 using protocol: http:80




-----Original Message-----
From: Adrian Sutton [mailto:adrian.sutton@ephox.com]
Sent: Tuesday, March 18, 2003 7:34 PM
To: 'Commons HttpClient Project'
Subject: RE: download a file


Hi Drake,
It looks like HttpMethodBase is trying to parse retrieve the port from the
URL, but there appears to be a bug in the URI class such that it's not
finding the port.  Only Sung-Gu really knows much about that class so if
he's around I'd love to hear from him. :)

Otherwise, we'll have to log this as a bug and take a look at it when
someone is free.  I know that the URI classes are moving to their own
commons project soonish, but I think it's time someone needs to learn what
they're on about so we can support them better.  If I find time I guess that
will be me.  I'm not sure when that will be though so hopefully someone will
beat me to it. :)  In the mean time you'll have to create the host
configuration yourself and pass it through.

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com


-----Original Message-----
From: Drake Henderson [mailto:dhenderson@winterheights.com]
Sent: Wednesday, 19 March 2003 10:15 AM
To: Commons HttpClient Project
Subject: RE: download a file


Adrian,

The code is below.  It is a modification of BasicAuthenticationExample.java.
I've just added the port number to the url of the GetMethod constructor.
Thanks for you help.

        HttpClient client = new HttpClient();

        // pass our credentials to HttpClient, they will only be used for
        // authenticating to servers with realm "realm", to authenticate
agains
        // an arbitrary realm change this to null.
        client.getState().setCredentials(
            null,
            new UsernamePasswordCredentials("user", "pwd")
        );

        // create a GET method that reads a file over HTTPS, we're assuming
        // that this file requires basic authentication using the realm
above.
        GetMethod get = new
GetMethod("https://www.xyz.com:2082/getsqlbackup/trace.gz");

        // Tell the GET method to automatically handle authentication. The
        // method will use any appropriate credentials to handle basic
        // authentication requests.  Setting this value to false will cause
        // any request for authentication to return with a status of 401.
        // It will then be up to the client to handle the authentication.
        get.setDoAuthentication( true );


        // execute the GET
        int status = client.executeMethod( get );

---------------------------------------------------------------------
To unsubscribe, e-mail:
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
commons-httpclient-dev-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail:
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
commons-httpclient-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail:
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
commons-httpclient-dev-help@jakarta.apache.org




Mime
View raw message