summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-21 10:10:52 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-21 10:10:52 +0000
commitb73f34819e7222a08133e1a123e2950a47acd9d1 (patch)
tree0318193bbd7e617bcdc7a8fc3b0f6d996a3d929a
parent323953b26f8f3ff514f981638503beecc938db9b (diff)
downloadruby-b73f34819e7222a08133e1a123e2950a47acd9d1.tar.gz
ruby-b73f34819e7222a08133e1a123e2950a47acd9d1.tar.xz
ruby-b73f34819e7222a08133e1a123e2950a47acd9d1.zip
* lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
ensure to close @body. (http://bugs.debian.org/277520) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/webrick/httpresponse.rb35
2 files changed, 24 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 8dbcc3fd2..8e9264944 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
+
Thu Oct 21 13:11:31 2004 WATANABE Hirofumi <eban@ruby-lang.org>
* io.c (pipe_open): variable name "fpw" is conflicted.
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb
index 717329fef..d0f232d1e 100644
--- a/lib/webrick/httpresponse.rb
+++ b/lib/webrick/httpresponse.rb
@@ -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)