Skip to content

Commit

Permalink
Fix retry on HTTP EOF.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanr committed Aug 5, 2015
1 parent 1cbaed8 commit 941d63e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ssllabs-scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,19 +391,19 @@ func invokeGetRepeatedly(url string) (*http.Response, []byte, error) {

return resp, body, nil
} else {
if err.Error() == "EOF" {
if strings.Contains(err.Error(), "EOF") {
// Server closed a persistent connection on us, which
// Go doesn't seem to be handling well. So we'll try one
// more time.
if retryCount > 5 {
log.Fatalf("[ERROR] Too many HTTP requests (5) failed with EOF (ref#1)")
log.Fatalf("[ERROR] Too many HTTP requests (5) failed with EOF (ref#3)")
}

if logLevel >= LOG_DEBUG {
log.Printf("[DEBUG] HTTP request failed with EOF (ref#1)")
log.Printf("[DEBUG] HTTP request failed with EOF (ref#3)")
}
} else {
log.Fatalf("[ERROR] HTTP request failed: %v (ref#1)", err.Error())
log.Fatalf("[ERROR] HTTP request failed: %v (ref#3)", err.Error())
}

retryCount++
Expand Down

0 comments on commit 941d63e

Please sign in to comment.