hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francesco Lazzarino <f...@ufl.edu>
Subject handle response when connection is closed.
Date Tue, 29 Apr 2008 20:22:30 GMT
# scenario:
PUTting a large file to a URL.
server reads Content-Length header and determines the file is to large.
server sends a 413 response.
server closes connection.

# my problem:
Since it is a large file the entity is not completely buffered, the  
server closes the connection before HttpClient completes the request  
transmission. I implemented a HttpMethodRetryHandler to handle this  
but method.getStatusCode() throws a NullPointerException. I want to be  
able to read the response in order to determine what happened. Any  
ideas?

# log output of a 500MB PUT (no response seems to be given)
2008/04/29 16:00:38:910 EDT [DEBUG] HttpConnection - Open connection  
to localhost:9009
2008/04/29 16:00:38:924 EDT [DEBUG] header - >> "PUT /foo HTTP/1.1[\r] 
[\n]"
2008/04/29 16:00:38:925 EDT [DEBUG] HttpMethodBase - Adding Host  
request header
2008/04/29 16:00:42:894 EDT [DEBUG] header - >> "User-Agent: Jakarta  
Commons-HttpClient/3.1[\r][\n]"
2008/04/29 16:00:42:894 EDT [DEBUG] header - >> "Host: localhost: 
9009[\r][\n]"
2008/04/29 16:00:42:894 EDT [DEBUG] header - >> "Content-Length:  
472870912[\r][\n]"
2008/04/29 16:00:42:894 EDT [DEBUG] header - >> "[\r][\n]"
2008/04/29 16:00:42:895 EDT [DEBUG] HttpMethodDirector - Closing the  
connection.
2008/04/29 16:00:42:896 EDT [DEBUG] HttpConnection - Releasing  
connection back to connection manager.

# log output of a 1k PUT (the response is read)
2008/04/29 16:20:58:945 EDT [DEBUG] HttpConnection - Open connection  
to localhost:9009
2008/04/29 16:20:58:959 EDT [DEBUG] header - >> "PUT /foo HTTP/1.1[\r] 
[\n]"
2008/04/29 16:20:58:960 EDT [DEBUG] HttpMethodBase - Adding Host  
request header
2008/04/29 16:20:58:973 EDT [DEBUG] header - >> "User-Agent: Jakarta  
Commons-HttpClient/3.1[\r][\n]"
2008/04/29 16:20:58:973 EDT [DEBUG] header - >> "Host: localhost: 
9009[\r][\n]"
2008/04/29 16:20:58:974 EDT [DEBUG] header - >> "Content-Length:  
1024[\r][\n]"
2008/04/29 16:20:58:974 EDT [DEBUG] header - >> "[\r][\n]"
2008/04/29 16:20:58:974 EDT [DEBUG] EntityEnclosingMethod - Request  
body sent
2008/04/29 16:20:58:975 EDT [DEBUG] header - << "  HTTP/1.1 413 Too  
Big[\n]"
2008/04/29 16:20:58:975 EDT [DEBUG] header - << "  HTTP/1.1 413 Too  
Big[\r][\n]"
2008/04/29 16:20:58:976 EDT [DEBUG] header - << "  Content-Type:  
none[\n]"
2008/04/29 16:20:58:976 EDT [INFO] HttpMethodBase - Response content  
length is not known
2008/04/29 16:20:58:976 EDT [DEBUG] HttpMethodBase - Force-close  
connection: true

thanks in advance,
-franco

Francesco Lazzarino
Florida Digital Archive Programmer
flaz@ufl.edu




---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message