About Download Docs Changes

Errors running in mathopd

I am using the CGI script from Install with Mathopd. This mostly works but I get errors in the server log:

convert_cgi_headers: script should not send content-length with status 304 convert_cgi_headers: disallowing header "Date: Sun, 02 Aug 2009 18:08:17 GMT"

and opening the pages I get a 500 error what appears to be exactly every other request.


Hmm… no other web server complained, but the HTTP specification does say:

If the conditional GET used a strong cache validator (see section 13.3.3), the response SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response MUST NOT include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers.

It seems that Werkzeug doesn't remove the headers (I wasn't aware of that), so I added a condition that checks for 304 response and doesn't add the headers to it. Can you try the version with the fix and tell me if it helped? Thanks a lot for reporting that. – Radomir Dopieralski


I tried a similar change and that did not work.

Updating to 817d4cc30dff does not make the messages go away from the server logs, and the errors loading pages remains. I'm running Firefox but tried two others:

(later…)

I think this is due to client side caching in Firefox, and possibly a bug or two in its implementation, see this blog post.

The problem may be exposed by not sending an expiry date (or a cache control header) for the file, and Firefox agressively caching.


This is not a bug in the client that it does caching. This is a bug in Hatta (or a library it's using) that only manifests itself when caching is used. The fact that a client uses cache is not a bug, it's a desirable feature. The fact that Hatta's behavior is broken when cache is being used is a bug. I will investigate further. Can you say if you are still getting both messages, or only the one about date? – Radomir Dopieralski


Bug reported upstream (although it's not certain if it's a Werkzeug bug).


Still get two warnings as before.


The latest version now explicitly removes the content-length header from response if it's a 304. If the header is still there, it must be added by another layer.

About the Date header, the HTTP specification requires it, so I have no idea why mathopd complains about it – I'd file a bug against mathopd about that. – Radomir Dopieralski


Thanks, I now have just the Date warning and will file a bug on mathopd.


Under that bug report, Mitsuhiko mentioned that this may help: http://werkzeug.pocoo.org/documentation/dev/contrib/fixers.html