goproxy
goproxy copied to clipboard
/Mea culpa/ Bug in https.go, you treat err == "EOF" as error
https://github.com/elazarl/goproxy/blob/0581fc3aee2d07555835bed1a876aca196a4a511/https.go#L267
This line here has inadequate checking, should be:
if _, err := io.Copy(chunked, resp.Body); err != nil && "EOF" != err.Error() {
https://golang.org/pkg/io/#Copy
A successful Copy returns err == nil, not err == EOF. Because Copy is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported.
Argh, true, copy doesnt matches err.Error() but matches err pointer within copy so the only proper way of returning error from read is io.EOF.