cloneRequest returns a clone of the provided *http.Request. The clone is a shallow copy of the struct and its Header map.
(r *http.Request)
| 821 | // cloneRequest returns a clone of the provided *http.Request. |
| 822 | // The clone is a shallow copy of the struct and its Header map. |
| 823 | func cloneRequest(r *http.Request) *http.Request { |
| 824 | // Shallow copy of the struct. |
| 825 | r2 := new(http.Request) |
| 826 | *r2 = *r |
| 827 | // Deep copy of the Header. |
| 828 | r2.Header = make(http.Header) |
| 829 | for k, s := range r.Header { |
| 830 | r2.Header[k] = s |
| 831 | } |
| 832 | return r2 |
| 833 | } |
| 834 | |
| 835 | // NewTLSConfig creates a new tls.Config from the given TLSConfig. |
| 836 | func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error) { |