mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
ensure to close @body. (http://bugs.debian.org/277520) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2ec51ee0d5
commit
f3501cd8ae
2 changed files with 24 additions and 16 deletions
|
|
@ -1,3 +1,8 @@
|
|||
Thu Oct 21 19:06:15 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||
|
||||
* lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
|
||||
ensure to close @body. (http://bugs.debian.org/277520)
|
||||
|
||||
Wed Oct 20 19:45:13 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (str_gsub): reentrant check. [ruby-dev:24432]
|
||||
|
|
|
|||
|
|
@ -254,24 +254,27 @@ module WEBrick
|
|||
private
|
||||
|
||||
def send_body_io(socket)
|
||||
if @request_method == "HEAD"
|
||||
# do nothing
|
||||
elsif chunked?
|
||||
while buf = @body.read(BUFSIZE)
|
||||
next if buf.empty?
|
||||
data = ""
|
||||
data << format("%x", buf.size) << CRLF
|
||||
data << buf << CRLF
|
||||
_write_data(socket, data)
|
||||
@sent_size += buf.size
|
||||
begin
|
||||
if @request_method == "HEAD"
|
||||
# do nothing
|
||||
elsif chunked?
|
||||
while buf = @body.read(BUFSIZE)
|
||||
next if buf.empty?
|
||||
data = ""
|
||||
data << format("%x", buf.size) << CRLF
|
||||
data << buf << CRLF
|
||||
_write_data(socket, data)
|
||||
@sent_size += buf.size
|
||||
end
|
||||
_write_data(socket, "0#{CRLF}#{CRLF}")
|
||||
else
|
||||
size = @header['content-length'].to_i
|
||||
_send_file(socket, @body, 0, size)
|
||||
@sent_size = size
|
||||
end
|
||||
_write_data(socket, "0#{CRLF}#{CRLF}")
|
||||
else
|
||||
size = @header['content-length'].to_i
|
||||
_send_file(socket, @body, 0, size)
|
||||
@sent_size = size
|
||||
ensure
|
||||
@body.close
|
||||
end
|
||||
@body.close
|
||||
end
|
||||
|
||||
def send_body_string(socket)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue