Set port in the request header from the endpoint
diff --git a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java
index 50ef222..8c71259 100644
--- a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java
+++ b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java
@@ -213,7 +213,12 @@
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) {