mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-24 06:05:28 +00:00
Fixing full URL output with unsafe requests (#1445)
* Fixing full URL output with unsafe requests * using request url as matched url if empty
This commit is contained in:
parent
b77723941d
commit
3748eae5fb
@ -116,6 +116,8 @@ func Parse(request, baseURL string, unsafe bool) (*Request, error) {
|
||||
if strings.HasSuffix(parsedURL.Path, "/") && strings.HasPrefix(rawRequest.Path, "/") {
|
||||
parsedURL.Path = strings.TrimSuffix(parsedURL.Path, "/")
|
||||
}
|
||||
|
||||
if !unsafe {
|
||||
if parsedURL.Path != rawRequest.Path {
|
||||
rawRequest.Path = fmt.Sprintf("%s%s", parsedURL.Path, rawRequest.Path)
|
||||
}
|
||||
@ -126,9 +128,10 @@ func Parse(request, baseURL string, unsafe bool) (*Request, error) {
|
||||
|
||||
// If raw request doesn't have a Host header and isn't marked unsafe,
|
||||
// this will generate the Host header from the parsed baseURL
|
||||
if !unsafe && rawRequest.Headers["Host"] == "" {
|
||||
if rawRequest.Headers["Host"] == "" {
|
||||
rawRequest.Headers["Host"] = hostURL
|
||||
}
|
||||
}
|
||||
|
||||
// Set the request body
|
||||
b, err := ioutil.ReadAll(reader)
|
||||
|
||||
@ -418,6 +418,11 @@ func (request *Request) executeRequest(reqURL string, generatedRequest *generate
|
||||
}
|
||||
}
|
||||
|
||||
// use request url as matched url if empty
|
||||
if formedURL == "" {
|
||||
formedURL = reqURL
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
// rawhttp doesn't support draining response bodies.
|
||||
if resp != nil && resp.Body != nil && generatedRequest.rawRequest == nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user