Skip to content

Commit

Permalink
silence "Unsolicited response received" again
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Mar 21, 2024
1 parent c3fdf3d commit 130ee60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ This file documents the revision history for check_nsc_web

next:
- minimum go version is now 1.22
- silence "Unsolicited response received" messages

0.7.1 Wed Mar 13 20:30:41 CET 2024
- remove url parameters from error output
Expand Down
4 changes: 2 additions & 2 deletions pkg/checknscweb/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int {

return 3
}
defer hClient.CloseIdleConnections()

log.SetOutput(io.Discard) // avoid "Unsolicited response received on idle HTTP channel starting with" messages
req, err := buildRequest(ctx, output, queryURL.String(), flags)
if err != nil {
fmt.Fprintf(output, "UNKNOWN - %s", err.Error())
Expand All @@ -251,6 +251,7 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int {

return errorExit
}
hClient.CloseIdleConnections()

if flags.Verbose {
dumpres, err2 := httputil.DumpResponse(res, true)
Expand All @@ -261,7 +262,6 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int {
fmt.Fprintf(output, "<<<<<<RESPONSE:\n%s\n<<<<<<\n", dumpres)
}

log.SetOutput(io.Discard)
contents, err := extractHTTPResponse(res)
if err != nil {
fmt.Fprintf(output, "RESPONSE-ERROR: %s\n", err.Error())
Expand Down

0 comments on commit 130ee60

Please sign in to comment.