NNG_HTTP_RES_ALLOC(3http)
π NAME π
nng_http_res_alloc β allocate HTTP response structure. Okay bestie, this is the NNG_HTTP_RES_ALLOC(3http) page from the NNG Reference Manual, and weβre about to make a whole HTTP response from scratch. π
β¨ SYNOPSIS β¨
#include <nng/nng.h>
#include <nng/supplemental/http/http.h>
int nng_http_res_alloc(nng_http_res **resp);
π DESCRIPTION π
Okay so nng_http_res_alloc() allocates a new HTTP response structure and stores a pointer to it in resp. The response comes out initialized with status code 200 (NNG_HTTP_STATUS_OK), a reason phrase of OK, and HTTP protocol version HTTP/1.1. Itβs giving βfresh response, ready to slayβ energy. β¨
π‘ Tip: when an error response is needed, consider using nng_http_res_alloc_error() instead. Thatβs the move, bestie. π«Ά
π RETURN VALUES π
This function returns 0 on success, and non-zero otherwise. Periodt.
π ERRORS π
NNG_ENOMEMβ Insufficient free memory exists to allocate a message. πNNG_ENOTSUPβ HTTP support not configured. π
π¦ SEE ALSO π¦
Go read these next, bestie β theyβre all part of the same lilβ HTTP/NNG universe:
nng_http_conn_read_res(3http)nng_http_conn_write_res(3http)nng_http_req_alloc(3http)nng_http_res_alloc_error(3http)nng_http_res_add_header(3http)nng_http_res_copy_data(3http)nng_http_res_del_header(3http)nng_http_res_free(3http)nng_http_res_get_header(3http)nng_http_res_get_reason(3http)nng_http_res_get_status(3http)nng_http_res_get_version(3http)nng_http_res_reset(3http)nng_http_res_set_data(3http)nng_http_res_set_reason(3http)nng_http_res_set_status(3http)nng_http_res_set_version(3http)nng_strerror(3)nng(7)
This page is from the NNG Reference Manual, dated 2026-01-13, and itβs the NNG_HTTP_RES_ALLOC(3http) page. Bye bestie β go allocate something cute ππ¦β¨
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms