We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 20bc90c commit f6d4f52Copy full SHA for f6d4f52
lib/rack/utils.rb
@@ -348,17 +348,18 @@ def get_byte_ranges(http_range, size)
348
return nil unless http_range && http_range =~ /bytes=([^;]+)/
349
ranges = []
350
$1.split(/,\s*/).each do |range_spec|
351
- return nil unless range_spec =~ /(\d*)-(\d*)/
352
- r0, r1 = $1, $2
353
- if r0.empty?
354
- return nil if r1.empty?
+ return nil unless range_spec.include?('-')
+ range = range_spec.split('-')
+ r0, r1 = range[0], range[1]
+ if r0.nil? || r0.empty?
355
+ return nil if r1.nil?
356
# suffix-byte-range-spec, represents trailing suffix of file
357
r0 = size - r1.to_i
358
r0 = 0 if r0 < 0
359
r1 = size - 1
360
else
361
r0 = r0.to_i
- if r1.empty?
362
+ if r1.nil?
363
364
365
r1 = r1.to_i
0 commit comments