hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yoram Dayagi (Gmail)" <yor...@gmail.com>
Subject Re: Heades in Async redirect
Date Tue, 01 Apr 2014 09:21:56 GMT
Hi,
Apparently, this is the behaviour of the client.

I did something like that, in order to copy the “Range” header:

builder.setRedirectStrategy(new DefaultRedirectStrategy() {
                @Override
                public HttpUriRequest getRedirect(HttpRequest request, HttpResponse
response, HttpContext context) throws ProtocolException {
                    HttpUriRequest redirectRequest = super.getRedirect(request,
response, context);
                    // copy "Range" headers, if exist
                    Header[] rangeHeaders = request.getHeaders(HttpHeaders.RANGE);
                    if (rangeHeaders != null) {
                        for (Header header : rangeHeaders) {
                            redirectRequest.addHeader(header);
                        }
                    }
                    return redirectRequest;
                }
            });

Hope it’s the correct approach.

-- 
Yoram Dayagi (Gmail)
Sent with Airmail

On April 1, 2014 at 12:15:58 PM, Lukáš Křečan (lukas@krecan.net) wrote:

Hi,  
I am using httpasyncclient 4.0.1 and I am setting custom Accept  
header. The server returns 302 redirect, the client correctly follows  
the location header and sends redirect. The trouble is, that Accept  
header from the original request is not copied to the redirect so the  
server returns unexpected Content-Type. Is it a bug or am I doing  
something work?  
Cheers  
Lukas  

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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message