AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch_rest_response_writer_t Struct Reference

#include <anch_rest_nginx.h>

Collaboration diagram for anch_rest_response_writer_t:

Public Attributes

void * ctx
size_t buffer_size
int(*) start (void *ctx, unsigned int status, const anch_rest_header_t *headers, size_t headers_count, long long content_length)
size_t(*) write (void *ctx, const char *data, size_t len)

Detailed Description

Response writer: valid during handle call

Member Data Documentation

◆ buffer_size

size_t anch_rest_response_writer_t::buffer_size

Preferred size of written blocks (size of module buffers)

◆ ctx

void* anch_rest_response_writer_t::ctx

Writer context

◆ start

int(*) anch_rest_response_writer_t::start(void *ctx, unsigned int status, const anch_rest_header_t *headers, size_t headers_count, long long content_length)

Start response: send status and headers. It has to be called once, before write . Memory is copied by the module: it can be released after the call.

Parameters
ctxthe writer context
statusthe status code
headersthe headers (Content-Length is ignored)
headers_countthe number of headers
content_lengththe body length, ANCH_REST_UNKNOWN_LENGTH when unknown
Returns
0 on success, -1 when response has been cancelled (client closed connection, ...)

◆ write

size_t(*) anch_rest_response_writer_t::write(void *ctx, const char *data, size_t len)

Write body data: blocks while module buffers are full (client is slower than application)

Parameters
ctxthe writer context
datathe data
lenthe data length
Returns
the number of written bytes (at least 1 ), 0 when response has been cancelled

The documentation for this struct was generated from the following file: