mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Merge pull request #396 from ylegat/bugfix/handle-content-length-missing-for-1xx-204-304
Resolve buger/gor#394 : Timeout for NO_CONTENT responses
This commit is contained in:
+8
-3
@@ -207,9 +207,14 @@ func (c *HTTPClient) Send(data []byte) (response []byte, err error) {
|
||||
if bytes.Equal(proto.Header(c.respBuf, []byte("Transfer-Encoding")), []byte("chunked")) {
|
||||
chunked = true
|
||||
} else {
|
||||
l := proto.Header(c.respBuf, []byte("Content-Length"))
|
||||
if len(l) > 0 {
|
||||
contentLength, _ = strconv.Atoi(string(l))
|
||||
status, _ := strconv.Atoi(string(proto.Status(c.respBuf)))
|
||||
if (status >= 100 && status < 200) || status == 204 || status == 304 {
|
||||
contentLength = 0
|
||||
} else {
|
||||
l := proto.Header(c.respBuf, []byte("Content-Length"))
|
||||
if len(l) > 0 {
|
||||
contentLength, _ = strconv.Atoi(string(l))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user