C Collections

chttpserver · Section 3

chttpsvr_req_body

chttpsvr_req_body - access the buffered request body

C Collections (libccollections, -lccollections)

#include <ccollections/chttpserver.h>
 
const void *chttpsvr_req_body(const chttpsvr_req *req,
                               size_t *len_out);

Returns a pointer to the buffered bytes of the request body.  When
len_out is not NULL, the length of the body in bytes goes into it.
 
The result is NULL, with 0 stored in len_out, when the request has no
body.  It is the same for a request of a streaming route that was
registered with chttpsvr_register_streaming_handler, because the
server never reads the body of such a route ahead of the handler.
Use chttpsvr_req_read there instead.
 
The buffer is valid until the handler call returns.

chttpsvr_req_read(3)