mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
fix multi http parse bug
This commit is contained in:
parent
dc8829ecca
commit
ebc74c1987
@ -1,8 +1,8 @@
|
||||
package ihttp
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/chainreactors/logs"
|
||||
"github.com/chainreactors/utils/httputils"
|
||||
"github.com/valyala/fasthttp"
|
||||
"io"
|
||||
"net/http"
|
||||
@ -93,15 +93,7 @@ func (r *Response) Header() []byte {
|
||||
if r.FastResponse != nil {
|
||||
return r.FastResponse.Header.Header()
|
||||
} else if r.StandardResponse != nil {
|
||||
var header bytes.Buffer
|
||||
header.WriteString(r.StandardResponse.Proto + " " + r.StandardResponse.Status)
|
||||
for k, v := range r.StandardResponse.Header {
|
||||
for _, i := range v {
|
||||
header.WriteString(k + ": " + i + "\r\n")
|
||||
}
|
||||
}
|
||||
header.WriteString("\r\n")
|
||||
return header.Bytes()
|
||||
return append(httputils.ReadRawHeader(r.StandardResponse), []byte("\r\n")...)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
@ -36,9 +36,10 @@ func NewBaseline(u, host string, resp *ihttp.Response) *Baseline {
|
||||
bl.HeaderLength = len(bl.Header)
|
||||
|
||||
if i := resp.ContentLength(); ihttp.CheckBodySize(i) {
|
||||
body := resp.Body()
|
||||
if body := resp.Body(); body != nil {
|
||||
bl.Body = make([]byte, len(body))
|
||||
copy(bl.Body, body)
|
||||
}
|
||||
|
||||
if i == -1 {
|
||||
bl.Chunked = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user