[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508856
 ] 

Roland Weber commented on HTTPCLIENT-660:
-----------------------------------------

That sounds like a case for an optional request interceptor.


> 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
>             Fix For: 4.0 Alpha 1
>
>
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to