On Thu, 2012-01-12 at 08:29 -0800, pwang wrote: > Hi, > > I'm trying to use the HTTP Async client v4.0 alpha 3 to communicate with a > HTTP v1.0-style server with Basic Digest authentication. I started with the > basic example " > http://hc.apache.org/httpcomponents-asyncclient-dev/httpasyncclient/examples/org/apache/http/examples/nio/client/AsyncClientHttpExchange.java > Asynchronous HTTP exchange ", and updated the first couple lines to this: > > DefaultHttpAsyncClient httpclient = new DefaultHttpAsyncClient(); > httpclient.getCredentialsProvider().setCredentials( > new AuthScope("localhost", 8080), > new UsernamePasswordCredentials("super", "super1")); > > The server actually returns in the response HTTP 1.1 but includes > "Connection: close" in the response header. Right after the response is > done sending, the server closes the connection. This is a snapshot of > initial transaction: > > GET / HTTP/1.1 > Host: localhost:8080 > Connection: Keep-Alive > User-Agent: Apache-HttpAsyncClient/4.0-alpha3 (java 1.5) > > HTTP/1.1 401 Unauthorized > Content-Type: application/json > Connection: close > WWW-Authenticate: Digest realm="@127.0.0.1", qop="auth", nonce="31", > opaque="deadbeef" > > When I run the modified example, the future.get() call returns with null, > and the program errors out on a null exception (due to the > response.getStatusLine()). > > My question is: Is my modification to the example valid for what I'm trying > to do? Can one of the guru tell me whether there is a problem with my > example code, or if there is a problem with the http async client library > code?
Your code looks reasonable. Quite likely the problem is caused by a bug in HttpAsyncClient. Please raise a JIRA for this issue and attach a complete wire / context log of the HTTP session to it. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
