[Zope-Checkins] CVS: Zope/lib/python/OFS - Image.py:1.130.4.2
Martijn Pieters
mj@zope.com
Tue, 18 Dec 2001 12:43:44 -0500
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv6598/lib/python/OFS
Modified Files:
Tag: Zope-2_4-branch
Image.py
Log Message:
MErge draft-spec ranges fix from 2.5 branch.
=== Zope/lib/python/OFS/Image.py 1.130.4.1 => 1.130.4.2 ===
# HTTP Range header handling
range = REQUEST.get_header('Range', None)
+ request_range = REQUEST.get_header('Request-Range', None)
+ if request_range is not None:
+ # Netscape 2 through 4 and MSIE 3 implement a draft version
+ # Later on, we need to serve a different mime-type as well.
+ range = request_range
if_range = REQUEST.get_header('If-Range', None)
if range is not None:
ranges = HTTPRangeSupport.parseRange(range)
@@ -356,12 +361,17 @@
end - start)
+ # Some clients implement an earlier draft of the spec, they
+ # will only accept x-byteranges.
+ draftprefix = (request_range is not None) and 'x-' or ''
+
RESPONSE.setHeader('Content-Length', size)
RESPONSE.setHeader('Accept-Ranges', 'bytes')
RESPONSE.setHeader('Last-Modified',
rfc1123_date(self._p_mtime))
RESPONSE.setHeader('Content-Type',
- 'multipart/byteranges; boundary=%s' % boundary)
+ 'multipart/%sbyteranges; boundary=%s' % (
+ draftprefix, boundary))
RESPONSE.setStatus(206) # Partial content
pos = 0