hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phoebe Shao" <phoebes...@gmail.com>
Subject Over writing the host header with port
Date Fri, 30 Mar 2007 20:16:28 GMT
Is there a way to set the port in the Host header to a port that is
different from the port in the URI?    I tried setVirtualHost but that sets
the host part only and port is still the port in the URI.

For example:

HttpClient client = new HttpClient();
PostMethod postMethod =  new PostMethod("localhost:8888");
client.getParams().setVirtualHost("my.realhost.com:80");

The above will set the Host header as:
Host: my.realhost.com:8888

How can I set it to Host: my.realhost.com:80 ?

I need to do this because of I need to use ssh port forwarding to access a
server which is only accessible from a certain IP.

Thanks,

Phoebe

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message