mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-24 09:15:25 +00:00
http: prevent HTTP 'connection' header from being added twice (#2480)
* http: prevent HTTP 'connection' header from being added twice * misc fix Co-authored-by: sandeep <sandeep@projectdiscovery.io>
This commit is contained in:
parent
cdb9e617e6
commit
ecb3f21076
@ -586,7 +586,7 @@ func (h *httpRawUnsafeRequest) Execute(filePath string) error {
|
||||
|
||||
ts := testutils.NewTCPServer(nil, defaultStaticPort, func(conn net.Conn) {
|
||||
defer conn.Close()
|
||||
_, _ = conn.Write([]byte("HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 36\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThis is test raw-unsafe-matcher test"))
|
||||
_, _ = conn.Write([]byte("HTTP/1.1 200 OK\r\nContent-Length: 36\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nThis is test raw-unsafe-matcher test"))
|
||||
})
|
||||
defer ts.Close()
|
||||
|
||||
|
||||
@ -237,6 +237,7 @@ func (request *Request) Compile(options *protocols.ExecuterOptions) error {
|
||||
NoTimeout: false,
|
||||
FollowRedirects: request.Redirects,
|
||||
CookieReuse: request.CookieReuse,
|
||||
Connection: &httpclientpool.ConnectionConfiguration{},
|
||||
}
|
||||
// If we have request level timeout, ignore http client timeouts
|
||||
for _, req := range request.Raw {
|
||||
@ -248,7 +249,7 @@ func (request *Request) Compile(options *protocols.ExecuterOptions) error {
|
||||
|
||||
// if the headers contain "Connection" we need to disable the automatic keep alive of the standard library
|
||||
if _, hasConnectionHeader := request.Headers["Connection"]; hasConnectionHeader {
|
||||
connectionConfiguration.Connection = &httpclientpool.ConnectionConfiguration{DisableKeepAlive: false}
|
||||
connectionConfiguration.Connection.DisableKeepAlive = true
|
||||
}
|
||||
|
||||
client, err := httpclientpool.Get(options.Options, connectionConfiguration)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user