Graham Dumpleton
graham.dumpleton at gmail.com
Wed Jan 2 18:13:18 EST 2008
On 03/01/2008, Matthew Dennis <mdennis at merfer.net> wrote: > I have a handler that streams large amounts of data. Using chunked encoding > in necessary as the total size is not known upfront. If there is an error > during the generation, I raise a apache.SERVER_RETURN (with > HTTP_PARTIAL_RESPONSE I believe). The problem is that it looks like > mod_python and/or apache just appends some error html to the output stream > and continues with the chunked encoding like there was no error. In other > words, some data chunks come from the server, then a chunk with the error > html in it, then the last chunk. Thus, the client has no way of knowing > that the data is incomplete (not all of it was generated) and corrupt > (random html appended onto the end). Am I just missing something, or is > this a bug? A HTTP status code can only be returned/raised before any data has been sent as that information is at the beginning of the response. If you are trying to raise the HTTP response status after data has been sent then your code is wrong. What do you think HTTP_PARTIAL_RESPONSE is meant to be used for? Maybe you understanding is not complete, or you don't understand how HTTP responses are put together. Graham
|