mirror of https://github.com/perkeep/perkeep.git
Work around Go bug http://code.google.com/p/go/issues/detail?id=1388
This commit is contained in:
parent
176cf7d0aa
commit
dda5a82dab
|
@ -86,9 +86,12 @@ func ReadResponse(r *bufio.Reader, requestMethod string) (resp *Response, err os
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
f := strings.Split(line, " ", 3)
|
f := strings.Split(line, " ", 3)
|
||||||
if len(f) < 3 {
|
if len(f) < 2 {
|
||||||
return nil, &badStringError{"malformed HTTP response", line}
|
return nil, &badStringError{"malformed HTTP response", line}
|
||||||
}
|
}
|
||||||
|
if len(f) == 2 {
|
||||||
|
f = append(f, f[1]) // Empty Reason-Phrase
|
||||||
|
}
|
||||||
resp.Status = f[1] + " " + f[2]
|
resp.Status = f[1] + " " + f[2]
|
||||||
resp.StatusCode, err = strconv.Atoi(f[1])
|
resp.StatusCode, err = strconv.Atoi(f[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue