Aborting a HTTP/1.1 chunk encoded response

北城余情 提交于 2019-12-08 15:47:06

问题


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.


回答1:


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.)



来源:https://stackoverflow.com/questions/4179750/aborting-a-http-1-1-chunk-encoded-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!