From ba1c5bd30cabaae1261e7832594e62c155253098 Mon Sep 17 00:00:00 2001
From: "Adam D. Ruppe" <destructionator@gmail.com>
Date: Wed, 9 Sep 2020 11:20:17 -0400
Subject: [PATCH] include port in host header

---
 http2.d | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/http2.d b/http2.d
index 784b44b..c31f872 100644
--- a/http2.d
+++ b/http2.d
@@ -765,7 +765,17 @@ class HttpRequest {
 			headers ~= " HTTP/1.1\r\n";
 		else
 			headers ~= " HTTP/1.0\r\n";
-		headers ~= "Host: "~requestParameters.host~"\r\n";
+
+		// the whole authority section is supposed to be there, but curl doesn't send if default port
+		// so I'll copy what they do
+		headers ~= "Host: ";
+		headers ~= requestParameters.host;
+		if(requestParameters.port != 80 && requestParameters.port != 443) {
+			headers ~= ":";
+			headers ~= to!string(requestParameters.port);
+		}
+		headers ~= "\r\n";
+
 		if(requestParameters.userAgent.length)
 			headers ~= "User-Agent: "~requestParameters.userAgent~"\r\n";
 		if(requestParameters.contentType.length)