Closed
Description
by jim@studt.net:
go version go1.2 linux/amd64 net/http/server.go contains an explicit check and deliberately returns StatusBadRequest when a request with an Expect: 100-continue has a zero length body. Users of curl run into this in two cases. If you attempt to POST a zero length file using the -T option, or more obscurely if you try to POST any file while using digest authentication, e.g. curl -T emptyfile http://some-go-server/ curl -u foo:bar --digest -T my.file http://some-go-server/ In the second case, you ask to upload a file using digest authentication. Since curl knows it doesn't have a nonce, it issues the request in order to get the 401 and its authentication parameters. This behavior is probably against RFC 2616 which states the client must not send the Expects header if it does not intend to send a body in section 8.2.3 (They are getting their own bug report.) Whether the PUT of an empty file contains no body, or a zero length body is a question for philosophers. Aside from being an RFC cop, the body check does not seem to have a function. Go software would be more tolerant of existing internet practices without it. There is a workaround for curl at least, once one becomes aware of the incompatibility of curl and Go's server implementation, one can use the "-H Expect:" flags to suppress the Expect header