(incoming, outgoing *http.Request)
| 726 | type proxyUrlContextKey struct{} |
| 727 | |
| 728 | func forwardToProxy(incoming, outgoing *http.Request) *http.Request { |
| 729 | proxyURL := &url.URL{ |
| 730 | Scheme: outgoing.URL.Scheme, |
| 731 | Host: outgoing.URL.Host, |
| 732 | } |
| 733 | |
| 734 | outgoing.URL.Host = incoming.Host |
| 735 | outgoing.URL.Scheme = schemeFromRequest(incoming) |
| 736 | |
| 737 | return outgoing.WithContext(stdlibcontext.WithValue(outgoing.Context(), proxyUrlContextKey{}, proxyURL)) |
| 738 | } |
| 739 | |
| 740 | func proxyFromContext(req *http.Request) (*url.URL, error) { |
| 741 | proxyURL, _ := req.Context().Value(proxyUrlContextKey{}).(*url.URL) |
searching dependent graphs…