Closed
Description
Currently at net/http/server.go:1339 c.serve() responds to a bad request (e.g. http://golang.org/%L3 ) by responding with 400 Bad request without a body. This results in a blank browser window when not behind a proxy, which is not helpful for end users, and nothing in logs to indicate the cause. Would it be possible to add a simple body to this request with something like:
io.WriteString(c.rwc, "HTTP/1.1 400 Bad Request\r\n\r\n400 Bad Request")
and/or to insert a line of logging before the response:
c.server.logf("http: 400 Bad Request: %v", err)
so that the server logs all significant errors encountered during this serve() method, as it does for TLS handshake error and panics in the handlers?