rday/web — pull request #3 by hraban (2012-09-25 22:30:07+00:00)
Title: No postmodules after using ctx.Write()

Handlers can use Context.Write() to send data to the client before the
function returns. This is not caught by post modules, who only use the
return value of a handler. This leads to corrupt responses.

This patch disables post modules completely when Context.Write() has
been called by a handler. If a handler returns data purely through its
return value, post modules are still executed.

To be very honest: I do not really know how these post modules work, nor what their point is. I understand the deflate/gzip ones, but the JSON/XML modules make no real sense to me. This patch assumes that all functions that use ctx.Write() return a string, web.go will crash oterhwise. It works for me, but maybe I missed something in the broader context of these post modules.