mirror of https://github.com/golang/go.git
http: return 413 instead of 400 when the request body is too large
RFC2616 says servers should return this status code when rejecting requests that are too large. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.14 R=bradfitz CC=golang-dev https://golang.org/cl/4962041
This commit is contained in:
parent
1f0d277cc1
commit
8511ed454a
|
|
@ -891,8 +891,8 @@ func TestRequestLimit(t *testing.T) {
|
|||
// we do support it (at least currently), so we expect a response below.
|
||||
t.Fatalf("Do: %v", err)
|
||||
}
|
||||
if res.StatusCode != 400 {
|
||||
t.Fatalf("expected 400 response status; got: %d %s", res.StatusCode, res.Status)
|
||||
if res.StatusCode != 413 {
|
||||
t.Fatalf("expected 413 response status; got: %d %s", res.StatusCode, res.Status)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ func (c *conn) serve() {
|
|||
// responding to them and hanging up
|
||||
// while they're still writing their
|
||||
// request. Undefined behavior.
|
||||
msg = "400 Request Too Large"
|
||||
msg = "413 Request Entity Too Large"
|
||||
} else if neterr, ok := err.(net.Error); ok && neterr.Timeout() {
|
||||
break // Don't reply
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue