From 631d9df785fc79c933e6cd42bc3a872aac194a83 Mon Sep 17 00:00:00 2001 From: Alexander Payne <41962150+alexpayne482@users.noreply.github.com> Date: Thu, 7 Mar 2019 12:22:17 +0200 Subject: [PATCH] fix for issue #394 issue #394 Port Number is not present in the authority header based on https://tools.ietf.org/html/rfc7540#section-8.1.2.3 and https://tools.ietf.org/html/rfc3986#section-3.2.3 --- hyper/http20/connection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hyper/http20/connection.py b/hyper/http20/connection.py index b8be292b..40dae298 100644 --- a/hyper/http20/connection.py +++ b/hyper/http20/connection.py @@ -505,7 +505,8 @@ def putrequest(self, method, selector, **kwargs): # ":path". We can set all of these now. s.add_header(":method", method) s.add_header(":scheme", "https" if self.secure else "http") - s.add_header(":authority", self.host) + port = "" if ((self.secure and self.port == 443) or (not self.secure and self.port == 80)) else (":" + str(self.port)) + s.add_header(":authority", self.host + port) s.add_header(":path", selector) # Save the stream.