Ticket #76 (closed defect: fixed)

Opened 9 months ago

Last modified 7 days ago

_serve_default returns a response that can hang the browser

Reported by: Dave <https://www.google.com/accounts/o8/id?id=AItOawkWUz0-4-SA0KXnKlsndWkUCLWcg_m_8hc> Owned by: sheep
Priority: High Milestone:
Component: Hatta Wiki Version: 1.4.1
Keywords: Cc:

Description

_serve_default returns a werkzeug.Response instead of a WikiResponse. This means that WikiResponse.make_conditional isn't being called, which means that a content-length header is still being sent for 304 responses of static files. That causes at least one browser (safari 5.0.5) to hang waiting for content. It'll hang until the server's keep-alive timeout is reached, and then the page will load.

The fix is simple: just use WikiResponse instead of werkzeug.Response

Change History

comment:1 Changed 9 months ago by sheep

If look at the code at  http://hg.hatta-wiki.org/hatta/file/990f4ef34207/hatta.py#l2733, you will see that it calls make_conditional just fine.

comment:2 Changed 9 months ago by sheep

Can you tell me what version of werkzeug you are using?

comment:3 Changed 9 months ago by Dave <https://www.google.com/accounts/o8/id?id=AItOawkWUz0-4-SA0KXnKlsndWkUCLWcg_m_8hc>

I have the latest version of werkzeug. Even though line 2733 calls make_conditional, werkzeug's make_conditional doesn't do enough to make a valid response, which, I assume, is why you override it in WikiResponse:  http://hg.hatta-wiki.org/hatta/file/990f4ef34207/hatta.py#l1644

The important thing is setting self.response = [] because otherwise werkzeug will calculate the length of the response and set a content-length header, erroneously. (Arguably, this is a bug in werkzeug, but since you've already solved the problem in the case of WikiResponse, it makes sense to use it in the serve_default method)

comment:4 Changed 9 months ago by sheep

Actually, the self.response=[] makes it calculate the header and set it to 0...

I reported the bug and I made the change, but I'm wondering if it's important enough to make another release just for this bugfix.

comment:5 Changed 7 days ago by sheep

  • Status changed from new to closed
  • Resolution set to fixed

This bugfix was released in version 1.4.5

Note: See TracTickets for help on using tickets.