--- org\apache\commons\httpclient\HttpMethodBase.java.orig 2006-01-05 04:03:48.000000000 +0100 +++ org\apache\commons\httpclient\HttpMethodBase.java 2006-01-05 14:02:22.108177600 +0100 @@ -1221,7 +1221,13 @@ } else { host = conn.getHost(); } - int port = conn.getPort(); + int port = this.params.getVirtualHostPort(); + if (port == -1) { + port = conn.getPort(); + } + else { + LOG.debug("Using virtual host port: " + port); + } // Note: RFC 2616 uses the term "internet host name" for what goes on the // host line. It would seem to imply that host should be blank if the --- org\apache\commons\httpclient\params\HostParams.java.orig 2006-01-05 04:03:48.000000000 +0100 +++ org\apache\commons\httpclient\params\HostParams.java 2006-01-05 14:01:37.857044800 +0100 @@ -97,5 +97,23 @@ public String getVirtualHost() { return (String) getParameter(HttpMethodParams.VIRTUAL_HOST); } + + /** + * Sets the virtual host port. + * + * @param port The port + */ + public void setVirtualHostPort(int port) { + setIntParameter(HttpMethodParams.VIRTUAL_HOST_PORT, port); + } + + /** + * Returns the virtual host port. + * + * @return The virtual host port + */ + public int getVirtualHostPort() { + return getIntParameter(HttpMethodParams.VIRTUAL_HOST_PORT, -1); + } } --- org\apache\commons\httpclient\params\HttpMethodParams.java.orig 2006-01-05 04:03:48.000000000 +0100 +++ org\apache\commons\httpclient\params\HttpMethodParams.java 2006-01-05 14:10:34.334917000 +0100 @@ -265,6 +265,14 @@ public static final String VIRTUAL_HOST = "http.virtual-host"; /** + * Defines the virtual host port. + *

+ * This parameter expects a value of type (@link Integer). + *

+ */ + public static final String VIRTUAL_HOST_PORT = "http.virtual-host-port"; + + /** * Sets the value to use as the multipart boundary. *

* This parameter expects a value if type {@link String}. @@ -459,6 +467,24 @@ return (String) getParameter(VIRTUAL_HOST); } + /** + * Sets the virtual host port. + * + * @param port The host port + */ + public void setVirtualHostPort(int port) { + setIntParameter(VIRTUAL_HOST_PORT, port); + } + + /** + * Returns the virtual host port. + * + * @return The virutal host port. + */ + public int getVirtualHostPort() { + return getIntParameter(VIRTUAL_HOST_PORT, -1); + } + private static final String[] PROTOCOL_STRICTNESS_PARAMETERS = { UNAMBIGUOUS_STATUS_LINE, SINGLE_COOKIE_HEADER,