cwist
Modern C web framework with libttak runtime
Loading...
Searching...
No Matches
cwist_http_response Struct Reference

HTTP Response Object. Supports standard string body or Zero-Copy pointer body. More...

#include <http.h>

Collaboration diagram for cwist_http_response:

Public Attributes

cwist_sstring * version
 e.g., "HTTP/1.1"
 
cwist_http_status_t status_code
 
cwist_sstring * status_text
 e.g., "OK"
 
cwist_http_header_node * headers
 
cwist_sstring * body
 
bool keep_alive
 
cwist_endpoint_opt_t endpoint_opts
 Mirrors req->endpoint_opts.
 
bool is_ptr_body
 Zero-Copy Pointer Body.
 
const void * ptr_body
 Pointer to external data (e.g., mmap region)
 
size_t ptr_body_len
 Length of external data.
 
cwist_http_body_cleanup_fn ptr_body_cleanup
 Optional release hook.
 
void * ptr_body_cleanup_ctx
 User data for release hook.
 
bool use_file_stream
 Fast File Streaming.
 
int file_stream_fd
 Open descriptor for sendfile.
 
size_t file_stream_len
 Total bytes to stream.
 
off_t file_stream_offset
 Current offset for sendfile loop.
 
bool file_stream_auto_close
 Close fd after streaming.
 
bool stream_mode
 cwist_http_response_stream_begin() ran.
 
bool stream_ended
 cwist_http_response_stream_end() ran.
 
bool stream_failed
 A live sink rejected a chunk/head.
 
cwist_sstring * stream_buf
 Framed chunk payload (hex\r\ndata\r
...).
 
size_t stream_flushed
 stream_buf prefix already pushed to stream_sink.
 
int(* stream_sink )(void *ctx, const char *data, size_t len)
 Live sink (streaming dispatch only).
 
void * stream_sink_ctx
 
bool stream_head_sent
 Head serialized and pushed to the sink.
 
char * alt_svc
 Alt-Svc header for HTTP/3 upgrade advertisement.
 
void * arena
 Per-response arena for bump-allocated structs (internal).
 
bool arena_borrowed
 
bool deferred
 Deferred-response handoff (internal; see net/http/async.h)
 
void * async
 Owning cwist_async while deferred (read-only).
 

Detailed Description

HTTP Response Object. Supports standard string body or Zero-Copy pointer body.

Definition at line 82 of file http.h.

Member Data Documentation

◆ alt_svc

char* cwist_http_response::alt_svc

Alt-Svc header for HTTP/3 upgrade advertisement.

Definition at line 237 of file http.h.

Referenced by cwist_http_response_destroy(), and cwist_http_response_set_alt_svc().

◆ arena

void* cwist_http_response::arena

◆ arena_borrowed

bool cwist_http_response::arena_borrowed

True when arena is shared (e.g. the request's) and must not be destroyed here.

Definition at line 240 of file http.h.

Referenced by cwist_http_response_destroy().

◆ async

void* cwist_http_response::async

Owning cwist_async while deferred (read-only).

Definition at line 245 of file http.h.

Referenced by cwist_async_defer(), and cwist_async_dispatch_take().

◆ body

◆ deferred

bool cwist_http_response::deferred

Deferred-response handoff (internal; see net/http/async.h)

Handler deferred the response via cwist_async_defer (read-only).

Definition at line 244 of file http.h.

Referenced by cwist_async_defer(), cwist_async_dispatch_take(), and cwist_async_res_deferred().

◆ endpoint_opts

cwist_endpoint_opt_t cwist_http_response::endpoint_opts

Mirrors req->endpoint_opts.

Definition at line 206 of file http.h.

Referenced by cwist_http_response_send_file().

◆ file_stream_auto_close

bool cwist_http_response::file_stream_auto_close

Close fd after streaming.

Definition at line 220 of file http.h.

Referenced by cwist_http_response_send_file().

◆ file_stream_fd

int cwist_http_response::file_stream_fd

Open descriptor for sendfile.

Definition at line 217 of file http.h.

Referenced by cwist_http_response_send_file(), and cwist_https_send_response().

◆ file_stream_len

size_t cwist_http_response::file_stream_len

Total bytes to stream.

Definition at line 218 of file http.h.

Referenced by cwist_http_response_send_file(), and cwist_https_send_response().

◆ file_stream_offset

off_t cwist_http_response::file_stream_offset

Current offset for sendfile loop.

Definition at line 219 of file http.h.

Referenced by cwist_http_response_send_file(), and cwist_https_send_response().

◆ headers

◆ is_ptr_body

◆ keep_alive

bool cwist_http_response::keep_alive

◆ ptr_body

◆ ptr_body_cleanup

cwist_http_body_cleanup_fn cwist_http_response::ptr_body_cleanup

Optional release hook.

Definition at line 212 of file http.h.

Referenced by cwist_http_response_set_body_ptr_managed().

◆ ptr_body_cleanup_ctx

void* cwist_http_response::ptr_body_cleanup_ctx

User data for release hook.

Definition at line 213 of file http.h.

Referenced by cwist_http_response_set_body_ptr_managed().

◆ ptr_body_len

◆ status_code

◆ status_text

cwist_sstring * cwist_http_response::status_text

◆ stream_buf

cwist_sstring* cwist_http_response::stream_buf

Framed chunk payload (hex\r\ndata\r
...).

Definition at line 228 of file http.h.

Referenced by cwist_http_response_destroy(), cwist_http_response_serialize(), cwist_http_response_stream_end(), and cwist_http_response_stream_write().

◆ stream_ended

◆ stream_failed

bool cwist_http_response::stream_failed

A live sink rejected a chunk/head.

Definition at line 227 of file http.h.

Referenced by cwist_app_dispatch_stream(), cwist_http_response_stream_end(), and cwist_http_response_stream_write().

◆ stream_flushed

size_t cwist_http_response::stream_flushed

stream_buf prefix already pushed to stream_sink.

Definition at line 229 of file http.h.

◆ stream_head_sent

bool cwist_http_response::stream_head_sent

Head serialized and pushed to the sink.

Definition at line 232 of file http.h.

◆ stream_mode

bool cwist_http_response::stream_mode

cwist_http_response_stream_begin() ran.

Streaming producer (handlers generate the body chunk-by-chunk; issue #201 Phase 1). Chunked framing is appended to stream_buf at write time, so the memory and streaming boundaries emit identical bytes.

Definition at line 225 of file http.h.

Referenced by cwist_app_dispatch_memory(), cwist_app_dispatch_stream(), cwist_http_response_serialize(), cwist_http_response_stream_begin(), cwist_http_response_stream_end(), and cwist_http_response_stream_write().

◆ stream_sink

int(* cwist_http_response::stream_sink) (void *ctx, const char *data, size_t len)

Live sink (streaming dispatch only).

Definition at line 230 of file http.h.

Referenced by cwist_app_dispatch_stream().

◆ stream_sink_ctx

void* cwist_http_response::stream_sink_ctx

Definition at line 231 of file http.h.

Referenced by cwist_app_dispatch_stream().

◆ use_file_stream

◆ version

cwist_sstring * cwist_http_response::version

e.g., "HTTP/1.1"

Definition at line 83 of file http.h.

Referenced by cwist_http_response_destroy().


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