Response

Types

struct ymo_http_response

HTTP response structure.

Todo

Should it just be one buffer for the whole status line?

Definition
struct ymo_http_response {
    ymo_http_session_t*       session;
    ymo_http_exchange_t*      exchange;
    struct ymo_http_response* next;
    ymo_http_hdr_table_t      headers;
    size_t                    content_len;
    char                      content_len_str[21];
    size_t                    status_len;
    char                      status_str[STATUS_STR_BUFF_SIZE];
    ymo_bucket_t*             body_head;
    ymo_bucket_t*             body_tail;
    ymo_proto_t*              proto_new;
    ymo_http_status_t         status;
    ymo_http_flags_t          flags;

};

Functions

ymo_http_response_t *ymo_http_response_create(ymo_http_session_t *session)

Create a new http response object.

Returns

pointer to new instance on success; NULL on failure

ymo_bucket_t *ymo_http_response_start(ymo_conn_t *conn, ymo_http_response_t *response)

Serialize an http response headers into a send-able string.

ymo_bucket_t *ymo_http_response_body_get(ymo_conn_t *conn, ymo_http_response_t *response)

Retrieve whatever body data we have, adding chunk headers, if need be.

void ymo_http_response_free(ymo_http_response_t *response)

Free an http response object.

Parameters
  • response – HTTP response to free.