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 nuclei-project is enabled store the response if not previously done
if e.pf != nil && !fromcache { 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 // 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 { // Unused
intReq := newInternalRquest() // func toInternalRequest(req *http.Request, target string, body []byte) *InternalRequest {
// intReq := newInternalRquest()
intReq.Target = target // intReq.Target = target
intReq.HTTPMajor = req.ProtoMajor // intReq.HTTPMajor = req.ProtoMajor
intReq.HTTPMinor = req.ProtoMinor // intReq.HTTPMinor = req.ProtoMinor
for k, v := range req.Header { // for k, v := range req.Header {
intReq.Headers[k] = v // intReq.Headers[k] = v
} // }
intReq.Headers = req.Header // intReq.Headers = req.Header
intReq.Method = req.Method // intReq.Method = req.Method
intReq.Body = body // intReq.Body = body
return intReq // return intReq
} // }
func toInternalResponse(resp *http.Response, body []byte) *InternalResponse { func toInternalResponse(resp *http.Response, body []byte) *InternalResponse {
intResp := newInternalResponse() intResp := newInternalResponse()
@ -127,12 +128,13 @@ func fromInternalResponse(intResp *InternalResponse) *http.Response {
} }
} }
func fromInternalRequest(intReq *InternalRequest) *http.Request { // Unused
return &http.Request{ // func fromInternalRequest(intReq *InternalRequest) *http.Request {
ProtoMinor: intReq.HTTPMinor, // return &http.Request{
ProtoMajor: intReq.HTTPMajor, // ProtoMinor: intReq.HTTPMinor,
Header: intReq.Headers, // ProtoMajor: intReq.HTTPMajor,
ContentLength: int64(len(intReq.Body)), // Header: intReq.Headers,
Body: ioutil.NopCloser(bytes.NewReader(intReq.Body)), // ContentLength: int64(len(intReq.Body)),
} // Body: ioutil.NopCloser(bytes.NewReader(intReq.Body)),
} // }
// }