Make the "bytes=" unit case-insensitive in Range header #62

Merged
merged 1 commit into from Jul 12, 2012
@@ -14,6 +14,7 @@ def test_not_satisfiable():
def test_range_parse():
assert isinstance(Range.parse('bytes=0-99'), Range)
+ assert isinstance(Range.parse('BYTES=0-99'), Range)
assert isinstance(Range.parse('bytes = 0-99'), Range)
assert isinstance(Range.parse('bytes=0 - 102'), Range)
assert Range.parse('bytes=10-5') is None
View
@@ -2,7 +2,7 @@
__all__ = ['Range', 'ContentRange']
-_rx_range = re.compile('bytes *= *(\d*) *- *(\d*)')
+_rx_range = re.compile('bytes *= *(\d*) *- *(\d*)', flags=re.I)
_rx_content_range = re.compile(r'bytes (?:(\d+)-(\d+)|[*])/(?:(\d+)|[*])')
class Range(object):