mirror of
https://github.com/projectdiscovery/httpx.git
synced 2024-09-11 17:46:08 +03:00
Merge pull request #113 from projectdiscovery/bugfix-store-response
avoid fatal on store response error
This commit is contained in:
commit
22cc61b657
@ -535,11 +535,17 @@ retry:
|
||||
if port > 0 {
|
||||
domainFile = fmt.Sprintf("%s.%d%s", domain, port, scanopts.RequestURI)
|
||||
}
|
||||
// On various OS the file max file name length is 255 - https://serverfault.com/questions/9546/filename-length-limits-on-linux
|
||||
// Truncating length at 255
|
||||
if len(domainFile) >= 255 {
|
||||
// leaving last 4 bytes free to append ".txt"
|
||||
domainFile = domainFile[:251]
|
||||
}
|
||||
domainFile = strings.Replace(domainFile, "/", "_", -1) + ".txt"
|
||||
responsePath := path.Join(scanopts.StoreResponseDirectory, domainFile)
|
||||
err := ioutil.WriteFile(responsePath, []byte(resp.Raw), 0644)
|
||||
if err != nil {
|
||||
gologger.Fatalf("Could not write response, at path '%s', to disc.", responsePath)
|
||||
gologger.Warningf("Could not write response, at path '%s', to disc.", responsePath)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user