diff --git a/http_client.go b/http_client.go index ef91696..6bc2c11 100644 --- a/http_client.go +++ b/http_client.go @@ -297,14 +297,22 @@ func (c *HTTPClient) Send(data []byte) (response []byte, err error) { } if err != nil && readBytes == 0 { - Debug("[HTTPClient] Response read timeout error", err, c.conn, readBytes, string(c.respBuf[:readBytes])) + maxRead := 100 + if readBytes < maxRead { + maxRead = readBytes + } + Debug("[HTTPClient] Response read timeout error", err, c.conn, readBytes, string(c.respBuf[:maxRead])) response = errorPayload(HTTP_TIMEOUT) c.Disconnect() return } if readBytes < 4 || string(c.respBuf[:4]) != "HTTP" { - Debug("[HTTPClient] Response read unknown error", err, c.conn, readBytes, string(c.respBuf[:readBytes])) + maxRead := 100 + if readBytes < maxRead { + maxRead = readBytes + } + Debug("[HTTPClient] Response read unknown error", err, c.conn, readBytes, string(c.respBuf[:maxRead])) response = errorPayload(HTTP_UNKNOWN_ERROR) c.Disconnect() return