RFC 2616 states "The purpose of the 100 (Continue) status (see Section 10.1.1) is to allow a client that is sending
a request message with a request body to determine if the origin server is willing to accept the request (based on the
request headers) before the client sends the request body."
Unfortunately, even if an Expect: 100-continue header is set, ruby's Net::HTTP#request still sends the body before receiving
a 100 Continue.
See Net::HTTP#transport_request :
def transport_request(req)
begin_transport req
req.exec @socket, @curr_http_version, edit_path(req.path)
begin
res = HTTPResponse.read_new(@socket)
end while res.kind_of?(HTTPContinue)
res.reading_body(@socket, req.response_body_permitted?) {
yield res if block_given?
}
end_transport req, res
res
end
It's inside the req.exec() call that the body is sent. This is done before any response is read. |