Aborting a HTTP/1.1 chunk encoded response
Asked Answered
F

1

13

Is there a standard way to handle response failure for chunked responses? I have poured through the RFCs and don't see a standard way of handling this.

My understanding of chunked responses is that they're useful when we cannot process the entire response at once on the server. Therefore, it seems possible that while part way though processing the response a fatal error occurs and the response needs to be terminated.

My initial thoughts are that closing the connection is the best solution, but I wanted to make sure there wasn't another way of handling this situation. Thanks.

Fizzy answered 14/11, 2010 at 21:23 Comment(0)
A
8

Yes, closing the connection is the only valid way, because in HTTP there must not be any further request data after the response has started. (More specifically: ... after the request has ended, marked by the two \ns.)

Asbestosis answered 14/11, 2010 at 21:43 Comment(2)
When I abort a chunked response Chrome displays a blank page and the dev console reports net::ERR_INCOMPLETE_CHUNKED_ENCODING. IE displays the incomplete page. Is there a way to send the user to an actual 500 error page? Can I output something that corrupts the document so the browser won't use it?Rocher
I am not aware of any "please start over decoding" chunk header, but it might be worth asking this in a new question.Asbestosis

© 2022 - 2024 — McMap. All rights reserved.