I am working on an app with communicates with our server. There is a bug in one of the libraries on the server side. This bug makes it a requirement to send the port along with the host.
The problem is that when I am sending a request the port seems to be striped out. I was originally using HTTPClient and setting the header like so
httpClient.addHeader(new BasicHeader("Host", "company.net:80"));
but server side they only received "company.net"
I also tried using an requestInterceptor like so
httpClient.addRequestInterceptor(new HttpRequestInterceptor() {
public void process(
final HttpRequest request,
final HttpContext context) throws HttpException, IOException {
request.setHeader("Host", "company.net:80");
Log.i(TAG, "intercepted and set host header");
}
});
But alas, the same problem occurred.
My final attempt was to use URLConnection instead of httpClient
urlConnection.addRequestProperty("Host", "company.net:80");
You can probably guess the outcome.
How do I send the host including the port?