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: Setting the Port
Date Tue, 27 Sep 2005 10:58:04 GMT
On Tue, Sep 27, 2005 at 03:48:58PM +0530, Preethi P R wrote:
> Oleg Kalnichevski wrote:
> >On Tue, Sep 27, 2005 at 10:39:10AM +0530, Preethi P R wrote:
> >
> >>I am able to set the virtual host...want to know how to set the virtual 
> >>port for it...
> >>
> >
> >
> >As far as I know there's no such thing as a virtual port. If the target
> >HTTP server is configured to listen on different ports per virtual host,
> >it does not make the ports virtual.
> >
> >Oleg
> 
> If you see
> http://mail-archives.apache.org/mod_mbox/jakarta-httpclient-user/200504.mbox/%3c20050401074602.GB20461@xbox.localdomain%3e
> you recommended using the setVirtualHost method for setting the "Host" 
> header . If you see  http 1.1 RFC sec 14.23
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23,
> the host header consists of host and port.
> " The Host request-header field specifies the Internet host and port 
> number of the resource being requested, as obtained from the original 
> URI given by the user or referring resource"
> 
> This is what I meant by virtual port. There should be a way in http 
> client to specify what should be the host header when a request is made. 
> This was possible in 2.0.2 and not fully possible in 3.0. Please provide 
> this feature. Currently if we specify "host:port" in the setVirtualHost, 
>  the http client adds its target port to this and makes it 
> "host:port:targetPort". This request is eventually rejected by the 
> server as not being valid.
> 
> A Host header is used when the end client (browser) makes a request to a 
>  server, and that server in turn passes the request to another server 
> and  wants to indicate that the end user used a particular host:port to 
> access the resource.
> 

Again. As far as I know there's no such thing as a virtual port. Take
the following configuration for example

IP: 192.168.0.254
virtual-host1: yadayada:8081
virtual-host2: blahblah:8082

In order to get a resource form the virtual-host1 do:
bind to 192.168.0.254:8081
GET /some/stuff HTTP/1.1
Host: yadayada:8081

In order to get a resource from the virtual-host2 do:
bind to 192.168.0.254:8082
GET /some/stuff HTTP/1.1
Host: blahblah:8082

HttpClient always binds the socket to the physical port associated with
the virtual host

Hope this helps

Oleg


> Thanks
> Preethi
> >
> >
> >
> >>Regards,
> >>Preethi
> >>
> >>
> >>Oleg Kalnichevski wrote:
> >>
> >>>On Mon, Sep 26, 2005 at 06:03:34PM +0530, Preethi P R wrote:
> >>>
> >>>
> >>>>How to set the VirtualPort for a HttpMethod?
> >>>>
> >>>
> >>>
> >>>Do you mean the virtual host, don't you?
> >>>
> >>>Oleg
> >>>
> >>>
> >>>
> >>>>Regards,
> >>>>Preethi
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>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
> >>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>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
> >
> 
> 
> ---------------------------------------------------------------------
> 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