From: carl.hoerberg@... Date: 2018-02-16T13:36:34+00:00 Subject: [ruby-core:85602] [Ruby trunk Bug#14466] Errno::ECONNRESET or Errno::EPIPE raised instead of HTTPResponse returned when POSTing with large body Issue #14466 has been updated by carl.hoerberg (Carl H��rberg). sk (SK Liew) wrote: > Expected: HTTPResponse with status code of 404. > Observed: Errno::ECONNRESET or Errno::EPIPE error. are you sure it's not the server that's aborting the connection before returning a 404? use eg. wireshark to confirm. ---------------------------------------- Bug #14466: Errno::ECONNRESET or Errno::EPIPE raised instead of HTTPResponse returned when POSTing with large body https://bugs.ruby-lang.org/issues/14466#change-70396 * Author: sk (SK Liew) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux], ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Using `net/http`, when trying to POST to an endpoint with a large body, Errno::ECONNRESET or Errno::EPIPE would be raised. How to reproduce: 1. In a terminal, run `ruby -run -e httpd -- -p 3000 .` to run a HTTP webserver. 2. In another terminal, run the code below: ~~~ ruby require 'net/http' def post_with_size(dest_url, size) string_to_send = ' ' * size uri_to_post = URI(dest_url) request = Net::HTTP::Post.new(uri_to_post) request.body = string_to_send http_client = Net::HTTP.new(uri_to_post.host, uri_to_post.port) http_client.use_ssl = (uri_to_post.scheme == 'https') response = http_client.request(request) puts response.body puts response.code puts response end dest_url = 'http://localhost:3000' size = 6000000 post_with_size(dest_url, size) ~~~ Expected: HTTPResponse with status code of 404. Observed: Errno::ECONNRESET or Errno::EPIPE error. -- https://bugs.ruby-lang.org/ Unsubscribe: