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

Oleg Kalnichevski commented on HTTPCLIENT-1903:
-----------------------------------------------

{quote}WRT "one potentially unpleasant issue." Do you want to bring this up on 
the ML? 
{quote}
@[~garydgregory] Sure. If get closer to a vote.
{quote}Would that be something that could be considered for 5.0 or is it 
totally out of question ?
{quote}
@[~bubbleguuum] This is already the case. I am trying to make sure that HC 5.0 
could be used on Android without modifications (with some Android specific 
extensions such as a custom connection socket factory). Feel free to give it a 
shot and give us some feedback.
 Oleg

> DefaultHostnameVerifier crashes on Android due to inexistent javax.naming 
> classes
> ---------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1903
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1903
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>    Affects Versions: 4.5.5
>            Reporter: Michael Pujos
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.6 Alpha1
>
>
> I'm using HttpClient on Android, repackaged to avoid conficting with the 
> platform's org.apache old packages.
> It works fine, except that making any https request will crash using the 
> defaults.
> The reason is that DefaultHostnameVerifier uses javax.naming.* classes, which 
> are not present on Android.
> So to be able to make https request, the default hostname verifier must be 
> replaced. For example:
>  
> httpClient = HttpClients.custom()
>                 .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
>                 .build();
>  
> Using NoopHostnameVerifier is rarely a good idea, so for the time being I 
> have replaced it with and older version of BrowserCompatHostnameVerifier that 
> doesn't internally call DefaultHostnameVerifier.
>  
> Ideally, I'd like DefaultHostnameVerifier to detect dynamically if 
> javax.naming.* classes are available, and switch to an alternate method not 
> using them if they are not. That way, HttpClient would work out of the box 
> for Android users.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to