You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ra...@apache.org on 2019/09/05 01:55:35 UTC

[camel] branch master updated: "CAMEL-13880:netty4-http component is setting an invalid "host" HTTP header"

This is an automated email from the ASF dual-hosted git repository.

ramu12 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new bff1a32  "CAMEL-13880:netty4-http component is setting an invalid "host" HTTP header"
bff1a32 is described below

commit bff1a323848b284c6cd26be8bf18470d9137a83d
Author: Kodanda Ramu Kakarla <kk...@kkakarla.pnq.csb>
AuthorDate: Thu Sep 5 07:24:42 2019 +0530

    "CAMEL-13880:netty4-http component is setting an invalid "host" HTTP header"
---
 .../org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
index f7e11d4..8339e7e 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
@@ -641,7 +641,8 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
         // must include HOST header as required by HTTP 1.1
         // use URI as its faster than URL (no DNS lookup)
         URI u = new URI(fullUri);
-        String hostHeader = u.getHost() + (u.getPort() == 80 ? "" : ":" + u.getPort());
+        int port = u.getPort();
+        String hostHeader = u.getHost() + (port == 80 || port == -1 ? "" : ":" + u.getPort());
         request.headers().set(HttpHeaderNames.HOST.toString(), hostHeader);
         LOG.trace("Host: {}", hostHeader);