Repository: mesos
Updated Branches:
  refs/heads/master 1003d727d -> fb93d93cd


Fixed host field of request header in libprocess.

Review: https://reviews.apache.org/r/37426


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fb93d93c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fb93d93c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fb93d93c

Branch: refs/heads/master
Commit: fb93d93cdf60e9143d5ad17cdf24779e282f2e44
Parents: 1003d72
Author: Jojy Varghese <[email protected]>
Authored: Mon Aug 17 22:07:54 2015 -0700
Committer: Timothy Chen <[email protected]>
Committed: Tue Aug 18 09:41:04 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/http.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fb93d93c/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index 660950f..9ad613a 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -862,7 +862,17 @@ Future<Response> _request(
   }
 
   // Need to specify the 'Host' header.
-  headers["Host"] = stringify(address);
+  if (url.domain.isSome()) {
+    // Use ONLY domain for standard ports.
+    if (url.port == 80 || url.port == 443) {
+      headers["Host"] = url.domain.get();
+    } else {
+      // Add port for non-standard ports.
+      headers["Host"] = url.domain.get() + ":" + stringify(url.port);
+    }
+  } else {
+    headers["Host"] = stringify(address);
+  }
 
   // Tell the server to close the connection when it's done.
   headers["Connection"] = "close";

Reply via email to