diff options
-rw-r--r-- | pkgs/tools/networking/ssl-proxy/default.nix | 4 | ||||
-rw-r--r-- | pkgs/tools/networking/ssl-proxy/go120-compatibility.patch | 18 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 |
3 files changed, 23 insertions, 3 deletions
diff --git a/pkgs/tools/networking/ssl-proxy/default.nix b/pkgs/tools/networking/ssl-proxy/default.nix index 5b72fb14fd9c..1bfb1418355f 100644 --- a/pkgs/tools/networking/ssl-proxy/default.nix +++ b/pkgs/tools/networking/ssl-proxy/default.nix @@ -13,6 +13,10 @@ buildGoModule rec { vendorHash = "sha256-310K9ZSxy/OQ4HYFCcHQaj4NQwzATrOZ2YkhiSkhY5I="; + patches = [ + ./go120-compatibility.patch + ]; + checkTarget = "test"; meta = with lib; { diff --git a/pkgs/tools/networking/ssl-proxy/go120-compatibility.patch b/pkgs/tools/networking/ssl-proxy/go120-compatibility.patch new file mode 100644 index 000000000000..868ca39a5414 --- /dev/null +++ b/pkgs/tools/networking/ssl-proxy/go120-compatibility.patch @@ -0,0 +1,18 @@ +Check whether User-Agent is defined before trying to override it + +Since Go 1.20 [1], ReverseProxy no longer adds a User-Agent header to forwarded +requests. + +[1] https://github.com/golang/go/commit/f001df540b3fc66a475985c1b7c810e7df063c8f + +--- a/reverseproxy/reverseproxy.go ++++ b/reverseproxy/reverseproxy.go +@@ -32,7 +32,7 @@ func newDirector(target *url.URL, extraDirector func(*http.Request)) func(*http. + } else { + req.URL.RawQuery = targetQuery + "&" + req.URL.RawQuery + } +- if _, ok := req.Header["User-Agent"]; !ok { ++ if req.Header.Get("User-Agent") != "" { + // explicitly disable User-Agent so it's not set to default value + req.Header.Set("User-Agent", "") + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2be7ceca607f..be7067a548f1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -42031,9 +42031,7 @@ with pkgs; yazi = callPackage ../applications/file-managers/yazi { inherit (darwin.apple_sdk.frameworks) Foundation; }; - ssl-proxy = callPackage ../tools/networking/ssl-proxy { - buildGoModule = buildGo119Module; # build fails with 1.20 - }; + ssl-proxy = callPackage ../tools/networking/ssl-proxy { }; code-maat = callPackage ../development/tools/code-maat {}; |