mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
6abca35457
commit
7050611cf9
2 changed files with 7 additions and 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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue