Project

General

Profile

Backport #1284 ยป net-http-bufsize.patch

candlerb (Brian Candler), 03/13/2009 05:23 PM

View differences:

net/http.rb 2009-03-13 08:11:47.000000000 +0000
1472 1472

  
1473 1473
    include HTTPHeader
1474 1474

  
1475
    BUFSIZE = 16*1024
1476

  
1475 1477
    def initialize(m, reqbody, resbody, path, initheader = nil)
1476 1478
      @method = m
1477 1479
      @request_has_body = reqbody
......
1557 1559
      supply_default_content_type
1558 1560
      write_header sock, ver, path
1559 1561
      if chunked?
1560
        while s = f.read(1024)
1562
        while s = f.read(BUFSIZE)
1561 1563
          sock.write(sprintf("%x\r\n", s.length) << s << "\r\n")
1562 1564
        end
1563 1565
        sock.write "0\r\n\r\n"
1564 1566
      else
1565
        while s = f.read(1024)
1567
        while s = f.read(BUFSIZE)
1566 1568
          sock.write s
1567 1569
        end
1568 1570
      end