You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2007/06/11 20:01:37 UTC

Re: virtual protocol registration with customSSLProtocolSocketFactory ignored

On Mon, 2007-06-11 at 19:07 +0200, Olaf Sebelin wrote:
> Hi,
> 
> 
> Oleg Kalnichevski <ol...@apache.org> schrieb am 04.08.2006 um 16:42:
> 
> > On Fri, 2006-08-04 at 19:54 +0530, Adalbert Wysocki wrote:
> > > Thanks Oleg! It helps but...
> > > 
> > > Do you recommend using a HostConfiguration configured with my
> > > particular Protocol (and the socket factory) instead of registering
> > > the protocol with Protocol.registerProtocol(...)?
> > > 
> > > Or
> > > 
> > > Using as parameter to the PostMethod a relative URI without any
> > > scheme and starting from the first / ?
> > > 
> > 
> > Aldo,
> > It very much depends upon your design consideration. If you want a
> > Protocol instance to apply globally, it should be registered using
> > Protocol#registerProtocol method. If, however, you want a Protocol
> > instance to apply to a specific host, then you should be using a
> > custom HostConfiguration parameter.
> > 
> > > Is there a milestone to solve this issue?
> > > Thanks,
> > > 
> > 
> > This issue simply highlights deficiencies of the 3.x API. There's not
> > much that can be done about it without breaking the API compatibility.
> > 
> 
> Isn't it just a small patch (against 3.1-rc1) like this?
> 
> +++ HttpClient.java     2007-06-11 18:53:52.000000000 +0200
> @@ -384,9 +384,14 @@ public class HttpClient {
>          if (hostconfig == defaulthostconfig || uri.isAbsoluteURI()) {
>              // make a deep copy of the host defaults
>              hostconfig = (HostConfiguration) hostconfig.clone();
>              if (uri.isAbsoluteURI()) {
> -                hostconfig.setHost(uri);
> +                if (hostconfig.getProtocol()!=null && 
> +                    hostconfig.getProtocol().getScheme().equals(uri.getScheme())) {
> +                    hostconfig.setHost(uri.getHost(), uri.getPort(), hostconfig.getProtocol());
> +                } else {
> +                    hostconfig.setHost(uri);
> +                }
>              }
>          }
>          
>          HttpMethodDirector methodDirector = new HttpMethodDirector(
> 
> 
> I think, the problem is, that an individual Protocol hanlder is
> overwritten by hostconfig.setHost(uri). So the Solution would be just
> to use another setHost()-Method of hostConfig in case an individual
> Protocol is used. Does this break compatibility?
> 

Olaf,

Have you tried running the test cases against the SVN trunk with the
patch applied? 

Oleg

> 
> Regards,
> Olaf
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 


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


Re: virtual protocol registration with customSSLProtocolSocketFactory ignored

Posted by Olaf Sebelin <os...@bos-bremen.de>.
Oleg Kalnichevski <ol...@apache.org> schrieb am 11.06.2007 um 20:01:

[...]

> > I think, the problem is, that an individual Protocol hanlder is
> > overwritten by hostconfig.setHost(uri). So the Solution would be
> > just to use another setHost()-Method of hostConfig in case an
> > individual Protocol is used. Does this break compatibility?
> > 
> 
> Olaf,
> 
> Have you tried running the test cases against the SVN trunk with the
> patch applied? 
> 

Yes, and it passes. So I opened an issue
(https://issues.apache.org/jira/browse/HTTPCLIENT-658) and attached a
patch.


Regards,
Olaf

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