mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 19:50:18 +00:00
fix NewBaseline panic
This commit is contained in:
parent
a965412c1a
commit
b84535a06b
@ -50,7 +50,12 @@ func NewBaseline(u, host string, resp *ihttp.Response) *Baseline {
|
|||||||
|
|
||||||
bl.Raw = append(bl.Header, bl.Body...)
|
bl.Raw = append(bl.Header, bl.Body...)
|
||||||
bl.Response, err = ParseRawResponse(bl.Raw)
|
bl.Response, err = ParseRawResponse(bl.Raw)
|
||||||
|
if err != nil {
|
||||||
|
bl.IsValid = false
|
||||||
|
bl.Reason = ErrResponseError.Error()
|
||||||
|
bl.ErrString = err.Error()
|
||||||
|
return bl
|
||||||
|
}
|
||||||
if r := bl.Response.Header.Get("Location"); r != "" {
|
if r := bl.Response.Header.Get("Location"); r != "" {
|
||||||
bl.RedirectURL = r
|
bl.RedirectURL = r
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,6 +16,7 @@ const (
|
|||||||
ErrFuzzyRedirect
|
ErrFuzzyRedirect
|
||||||
ErrFuzzyNotUnique
|
ErrFuzzyNotUnique
|
||||||
ErrUrlError
|
ErrUrlError
|
||||||
|
ErrResponseError
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrMap = map[ErrorType]string{
|
var ErrMap = map[ErrorType]string{
|
||||||
@ -32,6 +33,7 @@ var ErrMap = map[ErrorType]string{
|
|||||||
ErrFuzzyRedirect: "fuzzy redirect",
|
ErrFuzzyRedirect: "fuzzy redirect",
|
||||||
ErrFuzzyNotUnique: "not unique",
|
ErrFuzzyNotUnique: "not unique",
|
||||||
ErrUrlError: "url parse error",
|
ErrUrlError: "url parse error",
|
||||||
|
ErrResponseError: "response parse error",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e ErrorType) Error() string {
|
func (e ErrorType) Error() string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user