Commit 8511ed45 authored by Dave Cheney's avatar Dave Cheney Committed by Brad Fitzpatrick

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
parent 1f0d277c
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment