MCPcopy
hub / github.com/caddyserver/caddy / originalRequest

Function originalRequest

modules/caddyhttp/server.go:1015–1023  ·  view source on GitHub ↗

originalRequest returns a partial, shallow copy of req, including: req.Method, deep copy of req.URL (into the urlCopy parameter, which should be on the stack), req.RequestURI, and req.RemoteAddr. Notably, headers are not copied. This function is designed to be very fast and efficient, and useful pri

(req *http.Request, urlCopy *url.URL)

Source from the content-addressed store, hash-verified

1013// be very fast and efficient, and useful primarily for
1014// read-only/logging purposes.
1015func originalRequest(req *http.Request, urlCopy *url.URL) http.Request {
1016 cloneURL(req.URL, urlCopy)
1017 return http.Request{
1018 Method: req.Method,
1019 RemoteAddr: req.RemoteAddr,
1020 RequestURI: req.RequestURI,
1021 URL: urlCopy,
1022 }
1023}
1024
1025// determineTrustedProxy parses the remote IP address of
1026// the request, and determines (if the server configured it)

Callers 1

PrepareRequestFunction · 0.85

Calls 1

cloneURLFunction · 0.85

Tested by

no test coverage detected