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

Oleg Kalnichevski commented on HTTPCLIENT-1628:
-----------------------------------------------

Hi Dennis
Are you sure about the issue? The reason the  AuthScope#AuthScope(HttpHost, 
String, String) constructor does not convert hostname to lowercase because this 
has already been done by HttpHost#HttpHost(String, int, String) 

http://hc.apache.org/httpcomponents-core-4.4.x/httpcore/xref/org/apache/http/HttpHost.html#78

Could you please double-check or better yet create a unit test demonstrating 
auth cache failure?

Oleg

> Auth cache can fail when domain name contains uppercase characters
> ------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1628
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1628
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpAuth
>    Affects Versions: 4.4 Final
>            Reporter: Dennis Ju
>            Priority: Minor
>
> Following the example for using preemptive authentication given in the 
> documentation 
> [here|http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html]
>  will fail to authenticate if you use uppercase characters in the domain name 
> like loCalHoST or aPache.org.
> This is a new issue with 4.4 because of the new constructor AuthScope(final 
> HttpHost origin, final String realm, final String schemeName). This 
> constructor differs from the original constructor AuthScope(final String 
> host, final int port, final String realm, final String schemeName) where the 
> hostname is converted to lowercase. The example uses the latter constructor 
> when it creates the AuthScope, so the hostname is lowercase. When a request 
> is executed, BasicCredentialsProvider.matchCredentials(...) will try to 
> compare this lowercase hostname with a newly created AuthScope that doesn't 
> convert to lowercase, so it always returns false.
> The easy fix would be to convert the hostname to lowercase for the first 
> constructor.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to