Set port in the request header from the endpoint

This commit is contained in:
vijaykiran 2012-06-01 11:31:07 +02:00 committed by Adrian Cole
parent a5b20ecd4a
commit 9620389e5a
1 changed files with 6 additions and 1 deletions

View File

@ -209,7 +209,12 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
connection.setRequestProperty(header, value);
}
}
connection.setRequestProperty(HttpHeaders.HOST, request.getEndpoint().getHost());
String host = request.getEndpoint().getHost();
if(request.getEndpoint().getPort() != -1) {
host += ":" + request.getEndpoint().getPort();
}
connection.setRequestProperty(HttpHeaders.HOST, host);
connection.setRequestProperty(HttpHeaders.USER_AGENT, USER_AGENT);
if (request.getPayload() != null) {