Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
5.0 Beta6
-
None
Description
It appears that headers are not sent when following redirects.
RedirectExec.execute() contains this code:
switch (statusCode) { case HttpStatus.SC_MOVED_PERMANENTLY: case HttpStatus.SC_MOVED_TEMPORARILY: case HttpStatus.SC_SEE_OTHER: if (!Methods.isSafe(request.getMethod())) { final HttpGet httpGet = new HttpGet(redirectUri); httpGet.setHeaders(originalRequest.getHeaders()); redirect = httpGet; } else { redirect = null; } } if (redirect == null) { redirect = new BasicClassicHttpRequest(originalRequest.getMethod(), redirectUri); redirect.setEntity(originalRequest.getEntity()); }
If the method is not 'safe' and converted to a GET, headers get copied from the original request. Otherwise, the original headers are silently dropped.
Desired behavior: Headers should always be copied from the original request. That was the behavior of HttpClient 4.x.