hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Hopper (JIRA)" <j...@apache.org>
Subject [jira] Created: (HTTPCLIENT-660) Should host header be send in all lowercase
Date Wed, 27 Jun 2007 19:50:26 GMT
Should host header be send in all lowercase
-------------------------------------------

                 Key: HTTPCLIENT-660
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-660
             Project: HttpComponents HttpClient
          Issue Type: Improvement
    Affects Versions: 3.1 RC1
         Environment: Windows XP
Sun 1.6_01 JVM
            Reporter: Daniel Hopper
            Priority: Minor


Current the host header is sent as is from any 302 or standard url request.  Now obviously
according to the spec host names should be compared case insensitive but this isn't always
the case.  Most if not all browser will always lowercase the domain names when a  request
is sent.  This problem happened when we were trying to valid urls from merchants.  The one
in particular was

http://www.jdoqocy.com/click-1916095-10274762

which will finally end up redirecting to 

http://www.BestArt.com/default.asp?aff=1

With that case in the domain name and that is the way the host header is written.  This will
actually return a 404 if you request this URL from commons-httpclient, but will give no problem
with a request in IE or FireFox b/c they lowercase the domain name before sending.  This is
b/c its trying to match BestArt instead of bestart.  Now I know this isn't a problem with
commons-httpclient but rather how they have their server configured.  I think it would be
nice to provide a property for this configuration settting or rather follow the way all browsers
handle this as well.

I know this isn't a major issue and was able to get around it by just sub classing the GetMethod
and overriding addRequestHeader.

@Override
public void addRequestHeader(Header header) {
	if(header.getName().equalsIgnoreCase("host")) {
		header = new Header(header.getName(), header.getValue().toLowerCase(), header.isAutogenerated());
	}
	super.addRequestHeader(header);
}

Just thought this may be of interest as well as it is quite a simple fix.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message