Skip to content

Commit

Permalink
Merge pull request #1663 from projectdiscovery/network-fix
Browse files Browse the repository at this point in the history
Fixed network response error + timeout handling
  • Loading branch information
ehsandeep committed Mar 2, 2022
2 parents 65aaf00 + 2955b94 commit db8f8b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions v2/pkg/protocols/network/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (request *Request) ExecuteWithResults(input string, metadata /*TODO review
actualAddress := replacer.Replace(kv.address, variables)

if err := request.executeAddress(variables, actualAddress, address, input, kv.tls, previous, callback); err != nil {
gologger.Verbose().Label("ERR").Msgf("Could not make network request for %s: %s\n", actualAddress, err)
gologger.Warning().Msgf("Could not make network request for %s: %s\n", actualAddress, err)
continue
}
}
Expand Down Expand Up @@ -223,7 +223,7 @@ func (request *Request) executeRequestWithPayloads(variables map[string]interfac
default:
buf := make([]byte, bufferSize)
nBuf, err := conn.Read(buf)
if err != nil && !os.IsTimeout(err) {
if err != nil && !os.IsTimeout(err) && err != io.EOF {
request.options.Output.Request(request.options.TemplatePath, address, request.Type().String(), err)
closeTimer(readInterval)
return errors.Wrap(err, "could not read from server")
Expand All @@ -236,7 +236,7 @@ func (request *Request) executeRequestWithPayloads(variables map[string]interfac
} else {
final = make([]byte, bufferSize)
n, err = conn.Read(final)
if err != nil && err != io.EOF {
if err != nil && !os.IsTimeout(err) && err != io.EOF {
request.options.Output.Request(request.options.TemplatePath, address, request.Type().String(), err)
return errors.Wrap(err, "could not read from server")
}
Expand Down

0 comments on commit db8f8b4

Please sign in to comment.