byteserving vs. Adobe plugin (was Re: [Zope] kludge around byteserving problem (2.4))
Kyler B. Laird
laird@ecn.purdue.edu
Tue, 24 Jul 2001 18:44:33 -0500
It took awhile, but I finally discovered that Zope
handles multiple byte ranges with a shortcut that
Adobe's plugin does not seem to like.
If I ask for
Range: bytes=1-2, 2-3
from Apache, I'll get
206
Date: Tue, 24 Jul 2001 23:34:17 GMT
Server: Apache/1.3.9 (Unix) PHP/3.0.12 FrontPage/4.0.4.3 secured_by_Raven/1.4.1 Last-Modified: Tue, 24 Jul 2001 23:27:06 GMT
ETag: "57acf-26dfc6-3b5e044a"
Accept-Ranges: bytes
Content-Length: 185
Connection: close
Content-Type: multipart/byteranges; boundary=3b5e05f9e
--3b5e05f9e
Content-type: application/pdf
Content-range: bytes 1-2/2547654
PD
--3b5e05f9e
Content-type: application/pdf
Content-range: bytes 2-3/2547654
DF
--3b5e05f9e--
If I ask for the same thing from Zope, I get
206
Server: Zope/(Zope 2.4.0 (source release, python 2.1, linux2), python 2.1.1, linux2) ZServer/1.1b1
Date: Tue, 24 Jul 2001 23:39:01 GMT
Content-Type: application/pdf
Accept-Ranges: bytes
Connection: close
Content-Range: bytes 1-3/2547654
Last-Modified: Thu, 19 Jul 2001 14:39:42 GMT
Content-Length: 3
PDF
Looking over the HTTP/1.1 spec., it's not clear to
me that this is illegal, but it sure does suck to
have it break the PDF plug in. I'm not sure I can
call this a bug. Any advice?
I've included my test program below.
--kyler
============================
#!/usr/bin/env python
import httplib
import time
import random
def http_get_range(host, path, range=None):
h = httplib.HTTP(host)
h.putrequest('GET', path)
if range:
h.putheader('Range', range)
h.endheaders()
(errcode, errmsg, headers) = h.getreply()
print errcode
print headers
f = h.getfile()
content = f.read()
f.close()
return content
if (1):
range = 'bytes=2546630-2547653, 2342854-2372853, 2372854-2402853'
range = 'bytes=2546630-2547653, 2342854-2372853'
range = 'bytes=1-2, 2-3'
print '===== Apache ====='
apache = http_get_range(host='lairds.com', path='/Kyler/tmp/WRRC.pdf', range=range)
print apache
print '===== Zope ====='
zope = http_get_range(host='maverick.ecn.purdue.edu:8080', path='/test/WRRC.pdf', range=range)
print zope