Include port info in HTTP headers for Netty client

This commit adds the port information in the "Host" HTTP request header
for the Netty-based HTTP client.

Issue: SPR-15706
This commit is contained in:
Brian Clozel
2017-07-04 12:13:06 +02:00
parent 7a171c6ae9
commit baaa84e90f
2 changed files with 3 additions and 1 deletions

View File

@@ -142,7 +142,7 @@ class Netty4ClientHttpRequest extends AbstractAsyncClientHttpRequest implements
FullHttpRequest nettyRequest = new DefaultFullHttpRequest(
HttpVersion.HTTP_1_1, nettyMethod, path, this.body.buffer());
nettyRequest.headers().set(HttpHeaders.HOST, this.uri.getHost());
nettyRequest.headers().set(HttpHeaders.HOST, this.uri.getHost() + ":" + getPort(uri));
nettyRequest.headers().set(HttpHeaders.CONNECTION, "close");
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
nettyRequest.headers().add(entry.getKey(), entry.getValue());