Project

General

Profile

Bug #14466 ยป net-http-epipe.patch

jeremyevans0 (Jeremy Evans), 06/20/2019 08:03 PM

View differences:

lib/net/http.rb
1504 1504
      begin
1505 1505
        begin_transport req
1506 1506
        res = catch(:response) {
1507
          req.exec @socket, @curr_http_version, edit_path(req.path)
1507
          begin
1508
            req.exec @socket, @curr_http_version, edit_path(req.path)
1509
          rescue Errno::EPIPE
1510
            # Failure when writing full request, but we can probably
1511
            # still read the received response.
1512
          end
1513

  
1508 1514
          begin
1509 1515
            res = HTTPResponse.read_new(@socket)
1510 1516
            res.decode_content = req.decode_content
test/net/http/test_http.rb
884 884
    Net::HTTP.version_1_2
885 885
    super
886 886
  end
887

  
888
  def test_send_large_POST_request
889
    start {|http|
890
      data = ' '*6000000
891
      res = http.send_request('POST', '/', data, 'content-type' => 'application/x-www-form-urlencoded')
892
      assert_kind_of Net::HTTPResponse, res
893
      assert_kind_of String, res.body
894
      assert_equal data.size, res.body.size
895
      assert_equal data, res.body
896
    }
897
  end
887 898
end
888 899

  
889 900
class TestNetHTTP_v1_2_chunked < Test::Unit::TestCase
890
-