On Wed, 2012-04-11 at 15:47 +0200, [email protected] wrote:
> We have a problem with redirecting POST requests. The httpclient Version 
> 4.1.1 changes them to GET requests.
> 
> This was already treated as a bug in a former release of httpclient and 
> should be fixed in 4.1.x, please see:
> http://www.apache.org/dist/httpcomponents/httpclient/RELEASE_NOTES-4.1.x.txt
> 
> [HTTPCLIENT-860] HttpClient no longer converts redirects of PUT/POST to GET
>   for status codes 301, 302, 307, as required by the HTTP spec.
> 
> Is this still a bug in 4.1.1?
> Is this bug fixed in the current release?
> 

Per section 10.3.4 of the HTTP spec (RFC 2616) requests that result in
303 should be redirected using GET method. One can override protocol
compliant behavior using a custom redirect strategy such as
LaxRedirectStrategy shipped with Httpclient 4.2

Oleg

> Below a http-log of POST-to-GET issue.
> 
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "POST /export HTTP/1.1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Content-Type: 
> text/xml;charset=UTF-8[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "SOAPAction: 
> "http://.../soap1.1"[\r][\n]";
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Content-Length: 308[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Host: someserver.com[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 
> (java 1.5)[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Cookie: ....[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Cookie2: $Version=1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "<soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
> xmlns:exp="http://....";>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> " <soapenv:Header/>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> " <soapenv:Body>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> " 
> <exp:ActRequest>xxx</exp:ActRequest>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> " </soapenv:Body>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "</soapenv:Envelope>"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "HTTP/1.1 302 Found[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Date: Tue, 10 Apr 2012 13:47:27 
> GMT[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Server: Apache[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Location: https://.....[\r][\n]";
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Content-Length: 245[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Keep-Alive: timeout=10, 
> max=500[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Connection: Keep-Alive[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Content-Type: text/html; 
> charset=iso-8859-1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<!DOCTYPE HTML PUBLIC "-//IETF//DTD 
> HTML 2.0//EN">[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<html><head>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<title>302 Found</title>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "</head><body>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<h1>Found</h1>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<p>The document has moved <a 
> href=".....">here</a>.</p>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "</body></html>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "GET /targetapp/param_mapping/zzz 
> HTTP/1.1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Content-Type: 
> text/xml;charset=UTF-8[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "SOAPAction: 
> "http://..../soap1.1"[\r][\n]";
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Host: ....[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 
> (java 1.5)[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Cookie: .....=[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Cookie2: $Version=1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "HTTP/1.1 303 See Other[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Date: Tue, 10 Apr 2012 13:47:27 
> GMT[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Server: Apache[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Location: 
> /auth/login?Location=https%3A%2F%2F....[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Keep-Alive: timeout=10, 
> max=499[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Connection: Keep-Alive[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Transfer-Encoding: chunked[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Content-Type: text/html[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "98[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<html><A 
> HREF="/auth/login?Location=https%3A%2F%2F....">Please follow this 
> link.</A></html>"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "0[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "GET 
> /auth/login?Location=https%3A%2F%2F.... HTTP/1.1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Content-Type: 
> text/xml;charset=UTF-8[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "SOAPAction: 
> "http://..../soap1.1"[\r][\n]";
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Host: ....[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 
> (java 1.5)[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Cookie: ....[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Cookie2: $Version=1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "HTTP/1.1 302 Found[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Date: Tue, 10 Apr 2012 13:47:27 
> GMT[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Server: Apache[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Content-Length: 0[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Location: /export/[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "X-FRAME-OPTIONS: SAMEORIGIN[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Keep-Alive: timeout=10, 
> max=498[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Connection: Keep-Alive[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "GET /export/ HTTP/1.1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Content-Type: 
> text/xml;charset=UTF-8[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "SOAPAction: 
> "http://..../soap1.1"[\r][\n]";
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Host: ....[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 
> (java 1.5)[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Cookie: ....[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "Cookie2: $Version=1[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:>> "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "HTTP/1.1 200 OK[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Date: Tue, 10 Apr 2012 13:47:27 
> GMT[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Server: Apache[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "content-type: text/html; 
> charset=utf8[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "X-FRAME-OPTIONS: SAMEORIGIN[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Keep-Alive: timeout=10, 
> max=497[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Connection: Keep-Alive[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "Transfer-Encoding: chunked[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "2a2[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<html>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< 
> "<head><title>MessageServlet</title></head>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<body>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "<h3>Message Servlet is in Status 
> OK</h3>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "</body></html>[\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "0[\r][\n]"
> Tue Apr 10 15:47:26 CEST 2012:DEBUG:<< "[\r][\n]"
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to