[web-devel] Sending a Response before the Request has been entirely consumed?
Jeremy Bowers
jerf at jerf.org
Tue Sep 17 21:30:05 CEST 2013
On 09/17/2013 03:08 PM, Jeremy Shaw wrote:
> Hello,
>
> Is it valid for a server to start sending an HTTP Response before the
> Request has been entirely consumed? Or to put it differently, is there
> any case where it would be valid for the Response message-body to be
> streaming the value from the Request message-body?
>
I don't know about valid from a "standards" point of view, but a valid
use case, yes. For some reason or other, you are able to determine early
that you do not care to answer this request, and you want to drop it or
return an error as rapidly as possible. For instance, if a particular
page is getting DOS'ed, part of your mitigation strategy might be to
bail out of any request for that page as early as possible, or if it's
because a particular page is being over-accessed you might want to
return a static snapshot ASAP and get on with the next request. Or based
on IPs, or whoknows what.
I think you're right that returning a 200 before you've seen the entire
header is probably never a good idea, but there are many 4xx and 5xx
series responses you can make.
More information about the web-devel
mailing list