-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Description
What version of Go are you using (go version
)?
$ go version go version go1.15.7 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
Not relevant
What did you do?
Run up an HTTP server using net/http.Server.ListenAndServe()
Send an illegal HTTP/1.1 request (missing Host
header):
POST /endpoint HTTP/1.1 Content-Type: application/octet-stream Content-Length: 12 Some content
I also looked at #35283 as being a possible solution but clearly not as it has been rejected.
What did you expect to see?
Valid response to request.
I am trying to write a server application that will accept these (invalid) requests from client software over which I have no control. Some of the clients in the field no longer have firmware updates available and so no fix can be expected there. I am looking for a means to modify the behaviour of only a small part of the standard http server.
What did you see instead?
Error response generated by server.go:(c *conn)readRequest()
hosts, haveHost := req.Header["Host"] isH2Upgrade := req.isH2Upgrade() if req.ProtoAtLeast(1, 1) && (!haveHost || len(hosts) == 0) && !isH2Upgrade && req.Method != "CONNECT" { return nil, badRequestError("missing required Host header") }
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.