Open ninja-ops opened 2 years ago
linux something
😂
Agreed, this looks like a bug to me. Thanks for the extremely clear bug report.
Looked into this, it's a bit more challenging than I expected.
Essentially the net/http client in golang doesn't really expose this:
This was in my notes from a few months back. I'll give a second look through to try and see if there's a solution that doesn't require forking the go stdlib code or if anything changed in the code with the new versions of golang.
Describe the bug
the http request test does not honor the status code 403 in conjunction with a proxy, who denies the request, but its ok either.
in addition to this, headers returned from the proxy, who might be "ok", aren't honored.
How To Reproduce
setup a proxy to allow only certain domains via CONNECT or destination ips.
define different goss test's to use this proxy and test for these url's, who are not allowed in the proxy and goss is configured to accept a 403 or an expected header.
a squid.conf for squid 3.5.20 might look like ..
using podman you can setup a squid with centos7 using podman with mounting the local dir containing the squid.conf from above ..
squid can then be fired up in the foreground no-deamon setting with this line, can be break with ctrl+c
start another session for controlling what squid is serving ..
use this goss.yaml for testing ..
current output looks like this ..
Expected Behavior
goss should honor status 403 as "ok" if a proxy responds with 403 and not with "not ok" "Forbidden".
goss should honor response headers if a proxy is used, beside some "error's" during using the proxy and not "SKIP".
Actual Behavior
goss says "not ok" to requests using a proxy, where the proxy returns a 403, but the test condition ist "status: 403" or the headers from the error response of the proxy are set to "ok", either if it is a X-Squid-Error ..
Environment: