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

Function TestProxyHTTPSUpstream

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

Source from the content-addressed store, hash-verified

550}
551
552func TestProxyHTTPSUpstream(t *testing.T) {
553 server := httptest.NewUnstartedServer(okHandler)
554 server.TLS = tlsServerConfig()
555 server.StartTLS()
556 defer server.Close()
557
558 proxy := httptest.NewServer(&HTTPProxy{
559 ProtectHeaders: testProtectHeaders,
560 Config: config.Proxy{},
561 Transport: &http.Transport{TLSClientConfig: tlsClientConfig()},
562 Lookup: func(r *http.Request) *route.Target {
563 tbl, _ := route.NewTable(bytes.NewBufferString("route add srv / " + server.URL + ` opts "proto=https"`))
564 return tbl.Lookup(r, route.Picker["rr"], route.Matcher["prefix"], globCache, globEnabled)
565 },
566 })
567 defer proxy.Close()
568
569 resp, body := mustGet(proxy.URL)
570 if got, want := resp.StatusCode, http.StatusOK; got != want {
571 t.Fatalf("got status %d want %d", got, want)
572 }
573 if got, want := string(body), "OK"; got != want {
574 t.Fatalf("got body %q want %q", got, want)
575 }
576}
577
578type sniHandler struct {
579 sni string

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected