mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 03:24:00 +02:00
Bump up net-http 0.3.0
This commit is contained in:
parent
8bce7c1a72
commit
f08dee67dc
12 changed files with 858 additions and 296 deletions
|
@ -338,9 +338,10 @@ module Net::HTTPHeader
|
|||
# fits inside the full entity body, as range of byte offsets.
|
||||
def content_range
|
||||
return nil unless @header['content-range']
|
||||
m = %r<bytes\s+(\d+)-(\d+)/(\d+|\*)>i.match(self['Content-Range']) or
|
||||
m = %r<\A\s*(\w+)\s+(\d+)-(\d+)/(\d+|\*)>.match(self['Content-Range']) or
|
||||
raise Net::HTTPHeaderSyntaxError, 'wrong Content-Range format'
|
||||
m[1].to_i .. m[2].to_i
|
||||
return unless m[1] == 'bytes'
|
||||
m[2].to_i .. m[3].to_i
|
||||
end
|
||||
|
||||
# The length of the range represented in Content-Range: header.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue