Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTTP servers typically wait until the whole request body has been received before sending the response. However, some servers might send out a response early, before they've read the whole request body. For example, they might detect the request headers were invalid, and they want to tell that to the client immediately. For example, sending a large request to http://google.com will return an early `400 Bad Request` response. In this case HTTP.rb will raise an Errno::EPIPE exception, because it tried to write to the socket but it couldn't because the server closed its end. However, the server still returned a valid response, so it's not really erroneous behaviour (e.g. curl doesn't print any errors in the same situations). # Before HTTP.get("http://google.com", body: "a" * 1*1024*1024) #~> Errno::EPIPE # After HTTP.get("http://google.com", body: "a" * 1*1024*1024) #=> #<HTTP::Response 400 Bad Request ...> This commit ignores Errno::EPIPE exceptions when writing request data to the socket.
- Loading branch information