>
> On Apr 13, 2005, at 8:36 PM, Neil Schemenauer wrote:
>> I have a theory on why StaticDirectory is causing a problem. It
>> probably sets more response headers than other pages. You could
>> test this theory by adding code like this to one of the dynamic
>> pages:
>>
>> r = get_response()
>> r.set_header('X-Test-1', 'a'*40)
>> r.set_header('X-Test-2', 'a'*40)
>> r.set_header('X-Test-3', 'a'*40)
>>
>
> Another interesting test would be to comment out lines in
> StaticFile that set headers.
I tried the reverse of that just to see what would happen...
Take 3 (the third tcpdump I sent Neil) calls page_with_image and
dynamic_image.gif . This is an image pushed out dynamically, with the
same headers as StaticFile would use. The image gives an internal server
error, and the HTML page has a broken image.
Take 4 calls both these and page_with_image2 and dynamic_image2.gif . The
latter does not set headers except content-type. I could not get it to
break, but when I switched back to dynamic_image.gif it broke.
I probably should have htmltext'd the image.... :)
_q_exports = ["", "simple", "plain", "error", "publish_error", "css",
"dumpreq", "extras", ("favicon.ico", "favicon_ico"),
"apache", "foo", "bar", "baz",
"page_with_image", ("dynamic_image.gif", "dynamic_image"),
"page_with_image2", ("dynamic_image2.gif",
"dynamic_image2")]
from quixote.html import htmltext
page_with_image = htmltext(
'
')
import os, rfc822
_image_path = '/var/www/localhost/htdocs/apache_pb.gif'
_image = open(_image_path, 'rb').read()
_image_stat = os.stat(_image_path).st_mtime
_image_last_modified = rfc822.formatdate(_image_stat)
def dynamic_image(self):
response = get_response()
response.set_content_type("image/gif")
# What should Content-Encoding be set to?
response.set_header("Last-Modified", self._image_last_modified)
response.set_expires(None)
return self._image
page_with_image2 = htmltext(
'
')
def dynamic_image2(self):
response = get_response()
response.set_content_type("image/gif")
return self._image