hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: virtual protocol registration with customSSLProtocolSocketFactory ignored
Date Mon, 11 Jun 2007 18:01:37 GMT
On Mon, 2007-06-11 at 19:07 +0200, Olaf Sebelin wrote:
> Hi,
> 
> 
> Oleg Kalnichevski <olegk@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


Mime
View raw message