* lib/net/http.rb: Response#range_length was not debugged.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2001-02-17 20:40:50 +00:00
parent 92e4b1b06e
commit b2deafb277
2 changed files with 16 additions and 16 deletions

View File

@ -1,3 +1,7 @@
Sun Feb 18 05:46:03 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/http.rb: Response#range_length was not debugged.
Sun Feb 18 00:09:50 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> Sun Feb 18 00:09:50 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* win32/win32.c: fasten file I/O on mswin32/mingw32. * win32/win32.c: fasten file I/O on mswin32/mingw32.

View File

@ -1004,21 +1004,17 @@ module Net
end end
def range_length def range_length
if @header.key? 'content-range' then s = @header['content-range']
m = %r<bytes\s+(\d+)-(\d+)/\d+>.match( @header['content-range'] ) s or return nil
unless m then
raise HTTPBadResponse, 'wrong Content-Range format' m = %r<bytes\s+(\d+)-(\d+)/(?:\d+|\*)>.match( s )
end m or raise HTTPBadResponse, 'wrong Content-Range format'
l = m[2].to_i
u = m[1].to_i low = m[1].to_i
if l > u then up = m[2].to_i
nil return nil if low > up
else
u - l up - low + 1
end
else
nil
end
end end
def stream_check def stream_check
@ -1035,7 +1031,7 @@ module Net
if block then if block then
::Net::NetPrivate::ReadAdapter.new block ::Net::NetPrivate::ReadAdapter.new block
else else
dest or '' dest || ''
end end
end end