Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_http_response.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief Declares native HTTP response writing helpers.
4 */
5
6#ifndef PHAROS_NATIVE_HTTP_RESPONSE_H
7#define PHAROS_NATIVE_HTTP_RESPONSE_H
8
9#include "native_connection.h"
10
11/** @name HTTP response helpers
12 * @{
13 */
14/**
15 * @brief Writes formatted bytes to a native connection.
16 * @param connection Connection to write to.
17 * @param format printf-style format string.
18 * @param ... Format arguments.
19 * @return Result of the underlying connection write, or -1 on formatting or allocation failure.
20 */
21int native_connection_printf(NativeConnection *connection, const char *format, ...);
22/**
23 * @brief Sends a plain-text HTTP response with explicit content length.
24 * @param connection Connection to write to.
25 * @param status Numeric HTTP status code.
26 * @param status_text HTTP reason phrase.
27 * @param body Plain-text response body.
28 */
29void native_send_text_response(NativeConnection *connection, int status, const char *status_text, const char *body);
30
31/** @} */
32#endif
Declares the native connection abstraction and transport metadata helpers.
void native_send_text_response(NativeConnection *connection, int status, const char *status_text, const char *body)
Sends a plain-text HTTP response with explicit content length.
int native_connection_printf(NativeConnection *connection, const char *format,...)
Writes formatted bytes to a native connection.
Accepted client connection and its resolved transport metadata.