Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_http_request.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief Declares the parsed HTTP request record and request parsing helpers.
4 */
5
6#ifndef PHAROS_NATIVE_HTTP_REQUEST_H
7#define PHAROS_NATIVE_HTTP_REQUEST_H
8
9#include <stddef.h>
10
11#include "native_connection.h"
12
13/**
14 * @brief Parsed HTTP request fields extracted from a native connection.
15 */
16typedef struct {
17 char *method; /**< Request method token such as GET or POST. */
18 char *target; /**< Raw request target path from the request line. */
19 char *cookie; /**< Cookie header value, if supplied. */
20 char *content_type; /**< Content-Type header value or the default form type. */
21 char *headers; /**< Normalized request headers joined with newlines. */
22 char *body; /**< Owned request body buffer when the request stays in memory. */
23 char *body_file_path; /**< Temporary body file path when the request body is streamed to disk. */
24 size_t body_len; /**< Number of bytes stored in body or referenced by body_file_path. */
25 int is_multipart; /**< Non-zero when the request uses multipart form data. */
27
28/** @name HTTP request helpers
29 * @{
30 */
31/**
32 * @brief Parses an HTTP request from a native connection into a request record.
33 * @param connection Connection supplying request bytes.
34 * @param request Destination request record to populate.
35 * @return 0 on success, or a non-zero native status code on parse or IO failure.
36 */
38/**
39 * @brief Releases heap-owned fields in a parsed HTTP request record.
40 * @param request Request record to clear.
41 */
43
44
45/** @} */
46#endif
Declares the native connection abstraction and transport metadata helpers.
void free_http_request_native(HttpRequest *request)
Releases heap-owned fields in a parsed HTTP request record.
int parse_http_request_native(NativeConnection *connection, HttpRequest *request)
Parses an HTTP request from a native connection into a request record.
Parsed HTTP request fields extracted from a native connection.
Accepted client connection and its resolved transport metadata.