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 1A705910E for ; Fri, 25 May 2012 10:55:31 +0000 (UTC) Received: (qmail 48367 invoked by uid 500); 25 May 2012 10:55:30 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 47950 invoked by uid 500); 25 May 2012 10:55:30 -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 47786 invoked by uid 99); 25 May 2012 10:55:23 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2012 10:55:23 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 7B0851418B6 for ; Fri, 25 May 2012 10:55:23 +0000 (UTC) Date: Fri, 25 May 2012 10:55:23 +0000 (UTC) From: "Magnus Gustavsson (JIRA)" To: dev@hc.apache.org Message-ID: <440122985.1352.1337943323507.JavaMail.jiratomcat@issues-vm> In-Reply-To: <257802569.9804.1334929483466.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Reopened] (HTTPCLIENT-1185) IIS and fragments in "Location:" headers 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-1185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Magnus Gustavsson reopened HTTPCLIENT-1185: ------------------------------------------- > IIS and fragments in "Location:" headers > ---------------------------------------- > > Key: HTTPCLIENT-1185 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1185 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.1.3 > Reporter: Magnus Gustavsson > Fix For: 4.2 Final > > > We're using HttpClient to check the validity of links on our site, and lately users have been reporting that working links are incorrectly flagged as invalid. Looking into the problem, I find that it all boils down to us using code somewhat like this: > import java.io.IOException; > import org.apache.http.client.HttpClient; > import org.apache.http.client.methods.HttpGet; > import org.apache.http.impl.client.DefaultHttpClient; > public class BadRequest { > public static void main(String[] args) { > try { > HttpClient httpclient = new DefaultHttpClient(); > HttpGet httpget = new HttpGet("http://www.edu.mah.se/KK3231/syllabus/"); > System.out.println(httpclient.execute(httpget).getStatusLine().getStatusCode()); > } catch (IOException e) { > e.printStackTrace(); > } > } > } > Compiling and running the above example with HttpClient 4.1.3 results in a 400 code (20 April in 2012). > Specifically in the following exchanges: > GET /KK3231/syllabus/ HTTP/1.1 > Host: www.edu.mah.se > Connection: Keep-Alive > User-Agent: Apache-HttpClient/4.1.3 (java 1.5) > HTTP/1.1 301 Moved Permanently > Content-Type: text/html; charset=UTF-8 > Location: http://edu.mah.se/sv/Course/KK3231#Syllabus > Server: Microsoft-IIS/7.5 > X-Powered-By: PHP/5.3.9 > X-Powered-By: ASP.NET > Date: Fri, 20 Apr 2012 12:33:40 GMT > Content-Length: 315 > GET /sv/Course/KK3231#Syllabus HTTP/1.1 > Host: edu.mah.se > Connection: Keep-Alive > User-Agent: Apache-HttpClient/4.1.3 (java 1.5) > HTTP/1.1 400 Bad Request > Content-Type: text/html; charset=us-ascii > Server: Microsoft-HTTPAPI/2.0 > Date: Fri, 20 Apr 2012 12:33:40 GMT > Connection: close > Content-Length: 324 > I do realize that according to the HTTP 1.1 standard, the location header returned by the server is invalid. > However, all browsers seem to be able to handle a redirection like this. Thus I can hardly tell users that the error is on the server side when they can paste it into any browser and get a working page. So I was wondering if you would consider adapting to the current state of things and perhaps strip fragments from redirect URIs? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa 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