hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chang Sau Sheong" <csshe...@pacific.net.sg>
Subject Strange behavior in HttpClient
Date Fri, 06 Dec 2002 17:05:00 GMT
Hi,

This could be an intended design but I discovered something that struck me
as odd when I was using HttpClient. This is what I did:

1. Create a HttpClient instance
2. Create a HostConfiguration and set it to the HttpClient instance
3. Create a UrlPostMethod instance
4. Execute the UrlPostMethod against the HttpClient instance
5. release the UrlPostMethod instance connection using releaseConnection()
6. Create a UrlGetMethod instance
7. Execute the UrlGetMethod against the same HttpClient instance

This is what happened:
1. The UrlPostMethod was executed without a hitch
2. While executing the UrlGetMethod against the same HttpClient (step 7),
this error crops up:

org.apache.commons.httpclient.HttpRecoverableException: Error in parsing the
status  line from the response: unable to find line starting with "HTTP/"
 at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.j
ava:1791)
 at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.jav
a:1559)
 at
org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.j
ava:2219)
 at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:828
)
 at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:574)
 at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:493)

However when I used a getResponseBody() against the UrlPostMethod after
executing it (i.e. between step 4 and 5) the error is resolved!

Can anyone tell me what's going on? This behaviour looks very strange to me
and after looking at the code itself for a while I still cannot figure out
why this is so.

Thanks in advance!!

.sausheong
elipva Ltd



Mime
View raw message