dev
Mzack9999 2020-10-23 12:14:24 +02:00
parent 25e6c4a8e8
commit a55c7a2ca8
2 changed files with 28 additions and 23 deletions

View File

@ -498,7 +498,10 @@ func (e *HTTPExecuter) handleHTTP(reqURL string, request *requests.HTTPRequest,
// if nuclei-project is enabled store the response if not previously done
if e.pf != nil && !fromcache {
e.pf.Set(dumpedRequest, resp, data)
err := e.pf.Set(dumpedRequest, resp, data)
if err != nil {
return errors.Wrap(err, "could not store in project file")
}
}
// Convert response body from []byte to string with zero copy

View File

@ -81,21 +81,22 @@ func newInternalResponse() *InternalResponse {
}
}
func toInternalRequest(req *http.Request, target string, body []byte) *InternalRequest {
intReq := newInternalRquest()
// Unused
// func toInternalRequest(req *http.Request, target string, body []byte) *InternalRequest {
// intReq := newInternalRquest()
intReq.Target = target
intReq.HTTPMajor = req.ProtoMajor
intReq.HTTPMinor = req.ProtoMinor
for k, v := range req.Header {
intReq.Headers[k] = v
}
intReq.Headers = req.Header
intReq.Method = req.Method
intReq.Body = body
// intReq.Target = target
// intReq.HTTPMajor = req.ProtoMajor
// intReq.HTTPMinor = req.ProtoMinor
// for k, v := range req.Header {
// intReq.Headers[k] = v
// }
// intReq.Headers = req.Header
// intReq.Method = req.Method
// intReq.Body = body
return intReq
}
// return intReq
// }
func toInternalResponse(resp *http.Response, body []byte) *InternalResponse {
intResp := newInternalResponse()
@ -127,12 +128,13 @@ func fromInternalResponse(intResp *InternalResponse) *http.Response {
}
}
func fromInternalRequest(intReq *InternalRequest) *http.Request {
return &http.Request{
ProtoMinor: intReq.HTTPMinor,
ProtoMajor: intReq.HTTPMajor,
Header: intReq.Headers,
ContentLength: int64(len(intReq.Body)),
Body: ioutil.NopCloser(bytes.NewReader(intReq.Body)),
}
}
// Unused
// func fromInternalRequest(intReq *InternalRequest) *http.Request {
// return &http.Request{
// ProtoMinor: intReq.HTTPMinor,
// ProtoMajor: intReq.HTTPMajor,
// Header: intReq.Headers,
// ContentLength: int64(len(intReq.Body)),
// Body: ioutil.NopCloser(bytes.NewReader(intReq.Body)),
// }
// }