hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jasper van Zandbeek" <jasper.van.zandb...@quinity.com>
Subject [PATCH] HttpClient: possibility to specify port number in Host headers
Date Thu, 05 Jan 2006 14:36:04 GMT

The attached patch adds the possibility to specify the port number for virtual hosts.

HttpClient currently uses the port number of the connection in the Host request header if
the port number is different from the default port number for the protocol. Currently it isn't
possible to specify a port number different from the port number of the connection. This patch
adds this functionality.

According to the HTTP/1.1 specification, the port number specified in the Host request header
doesn't need to be the same as the port number of the connection. Some web servers, e.g. Apache,
ignore a different port number, but e.g. the application server WebSphere allows the port
number of the connection and the port number in the Host header to be different.

This patch allows users of HttpClient to use a different port number for the Host request
header if the webserver they connect to supports this.

Here's a code snippet that uses the patched code:

HttpClient httpClient = new HttpClient();
HttpMethod method = new GetMethod();
HostConfiguration hostConfiguration = new HostConfiguration();
hostConfiguration.setHost("localhost", 80, "http");
HostParams params = new HostParams();
httpClient.executeMethod(hostConfiguration, method);

Kind regards,

Jasper van Zandbeek


View raw message