Name

ap_setup_client_block — prepare to receive data from the client

Synopsis

int ap_setup_client_block(request_rec *r, int read_policy)

Prepares to receive (or not receive, depending on read_policy) data from the client, typically because the client made a PUT or POST request. Checks that all is well to do the receive. Returns OK if all is well or a status code if not. Note that this routine still returns OK if the request does not include data from the client. This should be called before ap_should_client_block( ).

read_policy is one of the following:

REQUEST_NO_BODY

Return HTTP_REQUEST_ENTITY_TOO_LARGE if the request has any body.

REQUEST_CHUNKED_ERROR

If the Transfer-Encoding is chunked, return HTTP_BAD_REQUEST if there is a Content-Length header or HTTP_LENGTH_REQUIRED if not.[4]

REQUEST_CHUNKED_DECHUNK

Handle chunked encoding in ap_ get_client_block( ), returning just the data.

REQUEST_CHUNKED_PASS

Handle chunked encoding in ap_ get_client_block( ), returning the data and the chunk headers.

[4] This may seem perverse, but the idea is that by asking for a Content-Length, we are implicitly requesting that there is no Transfer-Encoding (at least, not a chunked one). Getting both is an error.

Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.