Pharos
0.7.23
Modern Web Framework & Web App Hosting Service.
Toggle main menu visibility
Loading...
Searching...
No Matches
native_http_log.h
Go to the documentation of this file.
1
/**
2
* @file
3
* @brief Declares HTTP logging and response formatting helpers.
4
*/
5
6
#ifndef PHAROS_NATIVE_HTTP_LOG_H
7
#define PHAROS_NATIVE_HTTP_LOG_H
8
9
/** @name HTTP logging helpers
10
* @{
11
*/
12
/**
13
* @brief Resolves the MIME type that should be used for a file path.
14
* @param path File path whose extension should be inspected.
15
* @return Newly allocated MIME type string, or NULL on failure.
16
*/
17
char
*
mime_type_for_path
(
const
char
*path);
18
/**
19
* @brief Compacts free-form text into a single-line log-safe representation.
20
* @param value Source text to compact.
21
* @return Newly allocated compacted text, or NULL on failure.
22
*/
23
char
*
compact_log_text_native
(
const
char
*value);
24
/**
25
* @brief Extracts the best client IP address from request headers.
26
* @param headers Normalized request headers.
27
* @return Newly allocated client IP string, or NULL when no address can be derived.
28
*/
29
char
*
request_real_ip_native
(
const
char
*headers);
30
/**
31
* @brief Returns request headers with an explicit client IP header applied.
32
* @param headers Original normalized request headers.
33
* @param client_ip Client IP value to ensure is represented.
34
* @return Newly allocated header block, or NULL on failure.
35
*/
36
char
*
request_headers_with_client_ip_native
(
const
char
*headers,
const
char
*client_ip);
37
/**
38
* @brief Returns the canonical reason phrase for one HTTP status code.
39
* @param status_code HTTP status code to translate.
40
* @return Pointer to a static reason phrase string.
41
*/
42
const
char
*
http_status_text_native
(
int
status_code);
43
/**
44
* @brief Extracts the HTTP status line from a raw HTTP response payload.
45
* @param response Raw HTTP response text.
46
* @return Newly allocated status line string, or NULL when it cannot be parsed.
47
*/
48
char
*
http_status_line_from_response_native
(
const
char
*response);
49
/**
50
* @brief Extracts the numeric HTTP status code from a raw HTTP response payload.
51
* @param response Raw HTTP response text.
52
* @return Parsed status code, or 0 when it cannot be determined.
53
*/
54
int
http_status_code_from_response_native
(
const
char
*response);
55
56
57
/** @} */
58
#endif
compact_log_text_native
char * compact_log_text_native(const char *value)
Compacts free-form text into a single-line log-safe representation.
Definition
native_http_log.c:40
request_real_ip_native
char * request_real_ip_native(const char *headers)
Extracts the best client IP address from request headers.
Definition
native_http_log.c:75
request_headers_with_client_ip_native
char * request_headers_with_client_ip_native(const char *headers, const char *client_ip)
Returns request headers with an explicit client IP header applied.
Definition
native_http_log.c:147
http_status_line_from_response_native
char * http_status_line_from_response_native(const char *response)
Extracts the HTTP status line from a raw HTTP response payload.
Definition
native_http_log.c:221
mime_type_for_path
char * mime_type_for_path(const char *path)
Resolves the MIME type that should be used for a file path.
Definition
native_http_log.c:25
http_status_text_native
const char * http_status_text_native(int status_code)
Returns the canonical reason phrase for one HTTP status code.
Definition
native_http_log.c:209
http_status_code_from_response_native
int http_status_code_from_response_native(const char *response)
Extracts the numeric HTTP status code from a raw HTTP response payload.
Definition
native_http_log.c:242
src
native_runtime
c
native_http_log.h
Generated by
1.17.0