mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-08 11:36:45 +00:00
跳过二进制的返回数据读取
This commit is contained in:
parent
25188b24e8
commit
680d18a573
@ -18,12 +18,20 @@ func NewBaseline(u, host string, resp *ihttp.Response) *Baseline {
|
|||||||
Frameworks: make(parsers.Frameworks),
|
Frameworks: make(parsers.Frameworks),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if t, ok := ContentTypeMap[resp.ContentType()]; ok {
|
||||||
|
bl.ContentType = t
|
||||||
|
bl.Title = t + " data"
|
||||||
|
} else {
|
||||||
|
bl.ContentType = "other"
|
||||||
|
}
|
||||||
|
|
||||||
header := resp.Header()
|
header := resp.Header()
|
||||||
bl.Header = make([]byte, len(header))
|
bl.Header = make([]byte, len(header))
|
||||||
copy(bl.Header, header)
|
copy(bl.Header, header)
|
||||||
bl.HeaderLength = len(bl.Header)
|
bl.HeaderLength = len(bl.Header)
|
||||||
|
|
||||||
if i := resp.ContentLength(); i != 0 {
|
if i := resp.ContentLength(); i != 0 && bl.ContentType != "bin" {
|
||||||
body := resp.Body()
|
body := resp.Body()
|
||||||
bl.Body = make([]byte, len(body))
|
bl.Body = make([]byte, len(body))
|
||||||
copy(bl.Body, body)
|
copy(bl.Body, body)
|
||||||
@ -36,12 +44,6 @@ func NewBaseline(u, host string, resp *ihttp.Response) *Baseline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if t, ok := ContentTypeMap[resp.ContentType()]; ok {
|
|
||||||
bl.ContentType = t
|
|
||||||
bl.Title = t + " data"
|
|
||||||
} else {
|
|
||||||
bl.ContentType = "other"
|
|
||||||
}
|
|
||||||
bl.Raw = append(bl.Header, bl.Body...)
|
bl.Raw = append(bl.Header, bl.Body...)
|
||||||
if r := resp.GetHeader("Location"); r != "" {
|
if r := resp.GetHeader("Location"); r != "" {
|
||||||
bl.RedirectURL = r
|
bl.RedirectURL = r
|
||||||
|
Loading…
x
Reference in New Issue
Block a user