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 ED66517951 for ; Fri, 17 Apr 2015 14:57:58 +0000 (UTC) Received: (qmail 94864 invoked by uid 500); 17 Apr 2015 14:57:58 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 94816 invoked by uid 500); 17 Apr 2015 14:57:58 -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 94804 invoked by uid 99); 17 Apr 2015 14:57:58 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Apr 2015 14:57:58 +0000 Date: Fri, 17 Apr 2015 14:57:58 +0000 (UTC) From: "Nick Trown (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HTTPCLIENT-1641) CircularRedirect due to rebuilding URI after decoding path, etc. 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-1641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14499954#comment-14499954 ] Nick Trown commented on HTTPCLIENT-1641: ---------------------------------------- getPath(), for example, decodes the path. Therefore, by the time URI(String) is called the path is decoded and not fully escaped already. Regardless, the redirect URL being returned is getting mangled due to the path getting decoded, which results in the circular redirect. > CircularRedirect due to rebuilding URI after decoding path, etc. > ---------------------------------------------------------------- > > Key: HTTPCLIENT-1641 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1641 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.3.5 > Reporter: Nick Trown > Priority: Minor > > When I use HttpClient for the following URL the DefaultRedirectStrategy fails to build a redirected URI properly. > http://hotpads.com/apartments/Camelot-Apartments-(-Drexel-&-UPenn-)-Philadelphia-PA-19104--3phq8mahfzya3 > The reason is that the redirect URL returned is: > /apartments/Camelot-Apartments-%28-Drexel-%26-UPenn-%29-Philadelphia-PA-19104--3phq8mahfzya3 > ** Note: the only difference is that the redirect URL has the parens encoded. > The DefaultDirectEncoder does get the redirect URL, and since it is not absolute eventually calls URIUtils.resolve(). This then calls normalizeSyntax() where the bug is. > In normalizeSyntax() the URI is reconstructed. However, it incorrectly uses getPath(), getFragment(), etc. instead of the raw equivalents such as getRawPath(), getRawFragment(), etc. > In this case, the getPath() returned is therefore: > apartments/Camelot-Apartments-(-Drexel-&-UPenn-)-Philadelphia-PA-19104--3phq8mahfzya3 > Where the parens are back. The DefaultRedirectStrategy detects this as a circular redirect. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org