summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-07 19:00:48 +0000
committerwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-07 19:00:48 +0000
commit70271340af90bdfedd52854b45704cb488946d92 (patch)
treebfbacc2fb9c4dfa20cc36cdb83cbdaf5e21db217 /lib
parent1e86a6b9ca71dbf12cab2795410a0ca3f0cd5b3a (diff)
lib/net/http.rb: Backport #1284 [ruby-core:22874]; Change Net:HTTP to use a block size of 16k instead of 1k when streaming or chunking POST bodies.
test/net/http/test_post_io.rb: Backport #1284 [ruby-core:22874]; A test to go with the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/http.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 7dd1f24d4c..0c8c3ec319 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1463,6 +1463,8 @@ module Net #:nodoc:
include HTTPHeader
+ BUFSIZE = 16*1024
+
def initialize(m, reqbody, resbody, path, initheader = nil)
@method = m
@request_has_body = reqbody
@@ -1548,12 +1550,12 @@ module Net #:nodoc:
supply_default_content_type
write_header sock, ver, path
if chunked?
- while s = f.read(1024)
+ while s = f.read(BUFSIZE)
sock.write(sprintf("%x\r\n", s.length) << s << "\r\n")
end
sock.write "0\r\n\r\n"
else
- while s = f.read(1024)
+ while s = f.read(BUFSIZE)
sock.write s
end
end