hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ossf...@dubioso.net>
Subject Re: Will the request header "Range" be used for new (redirected) requests?
Date Sun, 17 Feb 2008 17:41:12 GMT
thai ha-thanh wrote:
> Hi all,
> I'm using httpclient-4.0-alpha2.jar and httpcore-4.0-alpha6.jar to download
> a zip file from a server. My problem is when I try to download part of the
 > zip file (using Get request, Range header), and the server replies with a
> '302 Found' response, httpclient automatically submits a new GET request
> (this is what I expected) but the Range header is not used for the new GET
> request. As a result, I receive a response '200 OK' instead the response
 > '206 Partial Content'.
> My question is if this behavior is correct or a bug?

Works as designed. HttpClient doesn't know about your custom headers
and will not include them in the followup request. Options for solving
your problem:

1. disable automatic redirect handling and generate the followup request
    in your application, including the Range header
2. instead of setting the Range header directly on the method, add it to
    the "default header" parameter on the method level. We fixed a bug
    there in alpha2, so it is working correctly now:

> I don't find any documents from Internet about the expected behavior in this case,

There are none except those we write ourselves. Specifications for browsers
do not apply, since HttpClient is not a browser. Specification of the Range
header says that it is optional, hence ignoring/dropping it is correct.

> but I believe that when httpclient follows a new location, it should
> send the headers of the old request to the new location.

HttpClient has no idea whatsoever which of the old headers make sense
for the redirected request and which don't. Copying headers can create
just as many problems than not copying them, but for different people.

> Attached is my sample program (Main1.java) and the log printed by
> httpclient 4.0-alpha6 (log.txt). 

Attachments are filtered by the mailing list server.
HttpClient 4.0 is at alpha2, with alpha3 coming up shortly.
IIRC, client alpha2 is running on core alpha6.

hope that helps,

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

View raw message