MCPcopy
hub / github.com/fabiolb/fabio / TestProxyHTTPSUpstreamSkipVerify

Function TestProxyHTTPSUpstreamSkipVerify

proxy/http_integration_test.go:621–647  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

619}
620
621func TestProxyHTTPSUpstreamSkipVerify(t *testing.T) {
622 server := httptest.NewUnstartedServer(okHandler)
623 server.TLS = &tls.Config{}
624 server.StartTLS()
625 defer server.Close()
626 proxy := httptest.NewServer(&HTTPProxy{
627 ProtectHeaders: testProtectHeaders,
628 Config: config.Proxy{},
629 Transport: http.DefaultTransport,
630 InsecureTransport: &http.Transport{
631 TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
632 },
633 Lookup: func(r *http.Request) *route.Target {
634 tbl, _ := route.NewTable(bytes.NewBufferString("route add srv / " + server.URL + ` opts "proto=https tlsskipverify=true"`))
635 return tbl.Lookup(r, route.Picker["rr"], route.Matcher["prefix"], globCache, globEnabled)
636 },
637 })
638 defer proxy.Close()
639
640 resp, body := mustGet(proxy.URL)
641 if got, want := resp.StatusCode, http.StatusOK; got != want {
642 t.Fatalf("got status %d want %d", got, want)
643 }
644 if got, want := string(body), "OK"; got != want {
645 t.Fatalf("got body %q want %q", got, want)
646 }
647}
648
649func TestProxyGzipHandler(t *testing.T) {
650 tests := []struct {

Callers

nothing calls this directly

Calls 5

CloseMethod · 0.95
LookupMethod · 0.95
NewTableFunction · 0.92
mustGetFunction · 0.85
StartTLSMethod · 0.80

Tested by

no test coverage detected