diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-07 11:42:21 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-07 11:42:21 +0000 |
commit | 7050611cf98fc25d012d7dcdab92915b7fcb7f35 (patch) | |
tree | 4f0b8725f22c7bac5542e497ec55befe83c6af8f | |
parent | 6abca35457d4e16b561fed8b7936b06068b33697 (diff) | |
download | ruby-7050611cf98fc25d012d7dcdab92915b7fcb7f35.tar.gz |
* lib/net/http.rb (HTTPHeader#content_length): should return nil unless header exists. [ruby-dev:22519]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/net/http.rb | 3 |
2 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Jan 7 20:42:06 2004 Minero Aoki <aamine@loveruby.net> + + * lib/net/http.rb (HTTPHeader#content_length): should return nil + unless header exists. [ruby-dev:22519] + Wed Jan 7 14:26:05 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> * ext/tk/lib/tk.rb (TkPanedWindow): use epath for embedded windows. diff --git a/lib/net/http.rb b/lib/net/http.rb index 90c473eaf4..90843576ba 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1032,7 +1032,8 @@ module Net # :nodoc: # Returns an Integer object which represents the Content-Length: header field # or +nil+ if that field is not provided. def content_length - len = @header['content-length'].to_s.slice(/\d+/) or + return nil unless @header.key?('content-length') + len = @header['content-length'].slice(/\d+/) or raise HTTPHeaderSyntaxError, 'wrong Content-Length format' len.to_i end |