fix(http): set Proxy-Agent header after authenticate to avoid leak #42
This commit is contained in:
@@ -254,9 +254,6 @@ func (h *httpHandler) handleRequest(ctx context.Context, conn net.Conn, req *htt
|
|||||||
if resp.Header == nil {
|
if resp.Header == nil {
|
||||||
resp.Header = http.Header{}
|
resp.Header = http.Header{}
|
||||||
}
|
}
|
||||||
if resp.Header.Get("Proxy-Agent") == "" {
|
|
||||||
resp.Header.Set("Proxy-Agent", h.md.proxyAgent)
|
|
||||||
}
|
|
||||||
|
|
||||||
ro.HTTP = &xrecorder.HTTPRecorderObject{
|
ro.HTTP = &xrecorder.HTTPRecorderObject{
|
||||||
Host: req.Host,
|
Host: req.Host,
|
||||||
@@ -290,6 +287,14 @@ func (h *httpHandler) handleRequest(ctx context.Context, conn net.Conn, req *htt
|
|||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("authentication failed")
|
return errors.New("authentication failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if resp.Header == nil {
|
||||||
|
resp.Header = http.Header{}
|
||||||
|
}
|
||||||
|
if resp.Header.Get("Proxy-Agent") == "" {
|
||||||
|
resp.Header.Set("Proxy-Agent", h.md.proxyAgent)
|
||||||
|
}
|
||||||
|
|
||||||
ctx = ctxvalue.ContextWithClientID(ctx, ctxvalue.ClientID(clientID))
|
ctx = ctxvalue.ContextWithClientID(ctx, ctxvalue.ClientID(clientID))
|
||||||
|
|
||||||
if h.options.Bypass != nil &&
|
if h.options.Bypass != nil &&
|
||||||
|
|||||||
Reference in New Issue
Block a user