[ https://issues.apache.org/jira/browse/HTTPCLIENT-547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved HTTPCLIENT-547. ------------------------------------------ Resolution: Fixed Implemented in SVN trunk Oleg > Provide access to port of Host header > ------------------------------------- > > Key: HTTPCLIENT-547 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-547 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient > Affects Versions: 3.0 Final > Environment: Operating System: other > Platform: Other > Reporter: Ortwin Glück > Assigned To: Ortwin Glück > Priority: Minor > Fix For: 4.0 Alpha 1 > > Attachments: patchfile.txt > > > We use a load balancer that connects to the HTTP server and the HTTP server > connects to the application server. We use port translation in our load > balancer. So when e.g. a client connects to 90 of the load balancer, the load > balancer connects to port 100 of the HTTP server. The load balancer doesn't > change the Host request header, so in the host request header is still the > original virtual host name and port, in this case port 90. For this reason, > the > virtual hosts of the HTTP server and application server are configured based > on > the external port numbers, so in this case port 90. > > For test purposes, we sometimes want to connect directly to the HTTP server or > the application server, bypassing the load balancer. To do this, we need to > connect to the same port as the load balancer would, in this example port 100, > but the host header of this request should be the same as if the request would > go through the load balancer, so in this example port 90, because the HTTP > server and application server's virtual hosts are configured for this port. > The attached patch adds the possibility to specify the port number for virtual > hosts. > 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(); > params.setVirtualHost("localhost"); > params.setVirtualHostPort(100); > hostConfiguration.setParams(params); > httpClient.executeMethod(hostConfiguration, method); > System.out.println(method.getResponseBodyAsString()); > method.releaseConnection(); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]