Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit 3667601

Browse files
committed
fix #4, properly close unused resp body
1 parent f7f5802 commit 3667601

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

digest_auth_client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func (dr *DigestRequest) Execute() (resp *http.Response, err error) {
8989
return dr.executeNewDigest(resp)
9090
}
9191

92+
// return the resp to user to handle resp.body.Close()
9293
return resp, nil
9394
}
9495

@@ -99,6 +100,9 @@ func (dr *DigestRequest) executeNewDigest(resp *http.Response) (resp2 *http.Resp
99100
waString string
100101
)
101102

103+
// body not required for authentication, closing
104+
resp.Body.Close()
105+
102106
if waString = resp.Header.Get("WWW-Authenticate"); waString == "" {
103107
return nil, fmt.Errorf("failed to get WWW-Authenticate header, please check your server configuration")
104108
}

0 commit comments

Comments
 (0)