Hi,

Oleg Kalnichevski <[EMAIL PROTECTED]> 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?


Regards,
Olaf

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to