Project

General

Profile

Feature #16559 ยป dont-default-connection-close.patch

f3ndot (Justin Bull), 01/24/2020 03:19 PM

View differences:

lib/net/http.rb
1233 1233
    # +dest+ argument is obsolete.
1234 1234
    # It still works but you must not use it.
1235 1235
    #
1236
    # If called before the connection has started, this method will open the
1237
    # connection and finish it once complete.
1238
    #
1236 1239
    # This method never raises an exception.
1237 1240
    #
1238 1241
    #     response = http.get('/index.html')
......
1258 1261
    #
1259 1262
    # This method returns a Net::HTTPResponse object.
1260 1263
    #
1264
    # If called before the connection has started, this method will open the
1265
    # connection and finish it once complete.
1266
    #
1261 1267
    # This method never raises an exception.
1262 1268
    #
1263 1269
    #     response = nil
......
1280 1286
    # the socket.  Note that in this case, the returned response
1281 1287
    # object will *not* contain a (meaningful) body.
1282 1288
    #
1289
    # If called before the connection has started, this method will open the
1290
    # connection and finish it once complete.
1291
    #
1283 1292
    # +dest+ argument is obsolete.
1284 1293
    # It still works but you must not use it.
1285 1294
    #
......
1484 1493
    # the block can process it using HTTPResponse#read_body,
1485 1494
    # if desired.
1486 1495
    #
1496
    # If called before the connection has started, this method will open the
1497
    # connection and finish it once complete.
1498
    #
1487 1499
    # This method never raises Net::* exceptions.
1488 1500
    #
1489 1501
    def request(req, body = nil, &block)  # :yield: +response+
1490 1502
      unless started?
1491
        start {
1492
          req['connection'] ||= 'close'
1493
          return request(req, body, &block)
1494
        }
1503
        start { return request(req, body, &block) }
1495 1504
      end
1496 1505
      if proxy_user()
1497 1506
        req.proxy_basic_auth proxy_user(), proxy_pass() unless use_ssl?
......
1585 1594
        end
1586 1595
      end
1587 1596

  
1588
      if not req.response_body_permitted? and @close_on_empty_response
1589
        req['connection'] ||= 'close'
1590
      end
1591

  
1592 1597
      req.update_uri address, port, use_ssl?
1593 1598
      req['host'] ||= addr_port()
1594 1599
    end