Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C36F8D5B6 for ; Wed, 10 Oct 2012 00:22:04 +0000 (UTC) Received: (qmail 46620 invoked by uid 500); 10 Oct 2012 00:22:04 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 46548 invoked by uid 500); 10 Oct 2012 00:22:04 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 46399 invoked by uid 99); 10 Oct 2012 00:22:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Oct 2012 00:22:04 +0000 Date: Wed, 10 Oct 2012 00:22:04 +0000 (UTC) From: "Justus Pendleton (JIRA)" To: dev@hc.apache.org Message-ID: <145846137.17511.1349828524211.JavaMail.jiratomcat@arcas> In-Reply-To: <134640548.17433.1349827323113.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (HTTPCLIENT-1248) LaxRedirectStrategy converts POST to GET MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Justus Pendleton updated HTTPCLIENT-1248: ----------------------------------------- Affects Version/s: 4.2.1 > LaxRedirectStrategy converts POST to GET > ---------------------------------------- > > Key: HTTPCLIENT-1248 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1248 > Project: HttpComponents HttpClient > Issue Type: Bug > Affects Versions: 4.2.1 > Reporter: Justus Pendleton > > The LaxRedirectStrategy extends the DefaultRedirectStrategy. The DefaultAsyncRequestDirector calls _redirectStrategy.isRedirected()_ and LaxRedirectStrategy will return *true* on a POST. Then the director calls _redirectStrategy.getRedirect()_. The LaxRedirectStrategy doesn't implement this method so the one in the DefaultRedirectStrategy is called: > {code} > if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) { > return new HttpHead(uri); > } else { > return new HttpGet(uri); > } > {code} > This turns the POST into a GET on redirect. IMHO the LaxRedirectStrategy should be > {code} > public HttpUriRequest getRedirect( > final HttpRequest request, > final HttpResponse response, > final HttpContext context) throws ProtocolException { > URI uri = getLocationURI(request, response, context); > String method = request.getRequestLine().getMethod(); > if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) { > return new HttpHead(uri); > else if (method.equalsIgnoreCase(HttpPost.METHOD_NAME)) { > return new HttpPost(uri); > } else if (method.equalsIgnoreCase(HttpGet.METHOD_NAME)) { > return new HttpGet(uri); > } else { > throw new IllegalStateException("Redirect called on un-redirectable http method: " + method); > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org