From 67b66bdd406566e7345609aa95bb68a13345e197 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" <destructionator@gmail.com> Date: Tue, 8 Sep 2020 12:17:18 -0400 Subject: [PATCH 1/3] fix lib name on ubuntu --- http2.d | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/http2.d b/http2.d index 8a0d611..784b44b 100644 --- a/http2.d +++ b/http2.d @@ -1793,15 +1793,19 @@ version(use_openssl) { import core.stdc.stdio; shared static this() { - version(Posix) - ossllib_handle = dlopen("libssl.so", RTLD_NOW); - else version(Windows) { + version(Posix) { + ossllib_handle = dlopen("libssl.so.1.1", RTLD_NOW); + if(ossllib_handle is null) + ossllib_handle = dlopen("libssl.so", RTLD_NOW); + } else version(Windows) { ossllib_handle = LoadLibraryW("libssl32.dll"w.ptr); oeaylib_handle = LoadLibraryW("libeay32.dll"w.ptr); } if(ossllib_handle is null) - throw new Exception("ssl fail open"); + throw new Exception("libssl library not found"); + if(oeaylib_handle is null) + throw new Exception("libeay32 library not found"); foreach(memberName; __traits(allMembers, ossllib)) { alias t = typeof(__traits(getMember, ossllib, memberName)); From d98c4fb6917195ba061cce1b7a3270d38640e2bc Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" <destructionator@gmail.com> Date: Tue, 8 Sep 2020 14:08:06 -0400 Subject: [PATCH 2/3] gotta love repeating myself leads to bugs --- dub.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dub.json b/dub.json index 0383b51..84cf71b 100644 --- a/dub.json +++ b/dub.json @@ -269,8 +269,7 @@ "configurations": [ { "name": "with_openssl", - "versions": ["with_openssl"], - "libs": ["crypto", "ssl"] + "versions": ["with_openssl"] }, { "name": "without_openssl", From 5e9dff840fc17045a0968e405febdd89561d4c5b 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 3/3] 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)