mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-24 06:15:27 +00:00
Improving body dump logic
This commit is contained in:
parent
c8753b7ee9
commit
73a8f9bf5f
@ -117,15 +117,17 @@ func dump(req *generatedRequest, reqURL string) ([]byte, error) {
|
|||||||
if req.request != nil {
|
if req.request != nil {
|
||||||
// Create a copy on the fly of the request body - ignore errors
|
// Create a copy on the fly of the request body - ignore errors
|
||||||
bodyBytes, _ := req.request.BodyBytes()
|
bodyBytes, _ := req.request.BodyBytes()
|
||||||
|
var dumpBody bool
|
||||||
if len(bodyBytes) > 0 {
|
if len(bodyBytes) > 0 {
|
||||||
req.request.Request.ContentLength = int64(len(bodyBytes))
|
req.request.Request.ContentLength = int64(len(bodyBytes))
|
||||||
req.request.Request.Body = ioutil.NopCloser(bytes.NewReader(bodyBytes))
|
req.request.Request.Body = ioutil.NopCloser(bytes.NewReader(bodyBytes))
|
||||||
} else {
|
} else {
|
||||||
req.request.Request.ContentLength = 0
|
req.request.Request.ContentLength = 0
|
||||||
req.request.Request.Body = nil
|
req.request.Request.Body = nil
|
||||||
|
delete(req.request.Request.Header, "Content-length")
|
||||||
}
|
}
|
||||||
|
|
||||||
dumpBytes, err := httputil.DumpRequestOut(req.request.Request, true)
|
dumpBytes, err := httputil.DumpRequestOut(req.request.Request, dumpBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user