mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/http: return appropriate errors from ReadRequest
Fixes #3298 R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5783080
This commit is contained in:
parent
da8efae9fe
commit
e8deb3f828
3 changed files with 24 additions and 3 deletions
|
|
@ -455,11 +455,13 @@ func ReadRequest(b *bufio.Reader) (req *Request, err error) {
|
|||
// First line: GET /index.html HTTP/1.0
|
||||
var s string
|
||||
if s, err = tp.ReadLine(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
if err == io.EOF {
|
||||
err = io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
}()
|
||||
|
||||
var f []string
|
||||
if f = strings.SplitN(s, " ", 3); len(f) < 3 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue