about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2024-03-10 04:27:38 +0100
committerGitHub <noreply@github.com>2024-03-10 04:27:38 +0100
commit3021170dfedcd764ce912ac0f7c0bd8f42c9bc0c (patch)
tree4ea92073ebe2b272b59387c367ddf0c2b85c0904
parentb423275ce94417dfa187d39b3e684e07b2fd63b0 (diff)
parentfba9fda7397faf230adc9224035fffac6bd71c00 (diff)
downloadnixlib-3021170dfedcd764ce912ac0f7c0bd8f42c9bc0c.tar
nixlib-3021170dfedcd764ce912ac0f7c0bd8f42c9bc0c.tar.gz
nixlib-3021170dfedcd764ce912ac0f7c0bd8f42c9bc0c.tar.bz2
nixlib-3021170dfedcd764ce912ac0f7c0bd8f42c9bc0c.tar.lz
nixlib-3021170dfedcd764ce912ac0f7c0bd8f42c9bc0c.tar.xz
nixlib-3021170dfedcd764ce912ac0f7c0bd8f42c9bc0c.tar.zst
nixlib-3021170dfedcd764ce912ac0f7c0bd8f42c9bc0c.zip
Merge pull request #265687 from iblech/patch-test-socks
nixos/tests/privoxy: Verify socks support
-rw-r--r--nixos/tests/privoxy.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/tests/privoxy.nix b/nixos/tests/privoxy.nix
index 2d95c4522a01..2a18d332c877 100644
--- a/nixos/tests/privoxy.nix
+++ b/nixos/tests/privoxy.nix
@@ -77,6 +77,11 @@ in
     networking.proxy.httpsProxy = "http://localhost:8118";
   };
 
+  nodes.machine_socks4  = { ... }: { services.privoxy = { enable = true; settings.forward-socks4  = "/ 127.0.0.1:9050 ."; }; };
+  nodes.machine_socks4a = { ... }: { services.privoxy = { enable = true; settings.forward-socks4a = "/ 127.0.0.1:9050 ."; }; };
+  nodes.machine_socks5  = { ... }: { services.privoxy = { enable = true; settings.forward-socks5  = "/ 127.0.0.1:9050 ."; }; };
+  nodes.machine_socks5t = { ... }: { services.privoxy = { enable = true; settings.forward-socks5t = "/ 127.0.0.1:9050 ."; }; };
+
   testScript =
     ''
       with subtest("Privoxy is running"):
@@ -109,5 +114,13 @@ in
           machine.systemctl("start systemd-tmpfiles-clean")
           # ...and count again
           machine.succeed("test $(ls /run/privoxy/certs | wc -l) -eq 0")
+
+      with subtest("Privoxy supports socks upstream proxies"):
+          for m in [machine_socks4, machine_socks4a, machine_socks5, machine_socks5t]:
+              m.wait_for_unit("privoxy")
+              m.wait_for_open_port(8118)
+              # We expect a 503 error because the dummy upstream proxy is not reachable.
+              # In issue #265654, instead privoxy segfaulted causing curl to exit with "Empty reply from server".
+              m.succeed("http_proxy=http://localhost:8118 curl -v http://does-not-exist/ 2>&1 | grep 'HTTP/1.1 503'")
     '';
 })