Pharos
0.7.23
Modern Web Framework & Web App Hosting Service.
Toggle main menu visibility
Loading...
Searching...
No Matches
native_dynamic_request_fields.h
Go to the documentation of this file.
1
/**
2
* @file
3
* @brief Request field extraction helpers for in-process dynamic handling.
4
*
5
* Provides URL decoding, query-string parsing, and form-value extraction
6
* so that the dynamic runtime can read request parameters without
7
* delegating to a child process.
8
*/
9
10
#ifndef PHAROS_NATIVE_DYNAMIC_REQUEST_FIELDS_H
11
#define PHAROS_NATIVE_DYNAMIC_REQUEST_FIELDS_H
12
13
#include <stddef.h>
14
15
/** @name URL decoding
16
* @{
17
*/
18
19
/**
20
* @brief Decodes a percent-encoded URL string.
21
*
22
* Allocates a new buffer containing the decoded result. The @c +
23
* character is decoded as a space.
24
*
25
* @param encoded Percent-encoded input string.
26
* @return Newly allocated decoded string, or NULL on allocation failure.
27
* Caller must free.
28
*/
29
char
*
native_dynamic_url_decode
(
const
char
*encoded);
30
31
/** @} */
32
33
/** @name Query-string helpers
34
* @{
35
*/
36
37
/**
38
* @brief Extracts a parameter value from a query string.
39
*
40
* Searches @p query for @c key=value pairs separated by @c & and
41
* returns the decoded value for the first match.
42
*
43
* @param query Raw query string (without the leading @c ? ).
44
* @param key Parameter name to look up.
45
* @return Newly allocated decoded value, or NULL if not found.
46
* Caller must free.
47
*/
48
char
*
native_dynamic_query_value
(
const
char
*query,
const
char
*key);
49
50
/** @} */
51
52
/** @name Form-value helpers
53
* @{
54
*/
55
56
/**
57
* @brief Extracts a value from a URL-encoded form body.
58
*
59
* Searches @p body for @c key=value pairs separated by @c & and
60
* returns the decoded value for the first match.
61
*
62
* @param body URL-encoded form body.
63
* @param key Form field name to look up.
64
* @return Newly allocated decoded value, or NULL if not found.
65
* Caller must free.
66
*/
67
char
*
native_dynamic_form_value
(
const
char
*body,
const
char
*key);
68
69
/** @} */
70
71
/** @name Cookie helpers
72
* @{
73
*/
74
75
/**
76
* @brief Extracts a cookie value from a Cookie header string.
77
*
78
* Searches @p cookie_header for @c name=value pairs separated by
79
* @c ; and returns the decoded value for the first match.
80
*
81
* @param cookie_header Raw Cookie header value.
82
* @param name Cookie name to look up.
83
* @return Newly allocated cookie value, or NULL if not found.
84
* Caller must free.
85
*/
86
char
*
native_dynamic_cookie_value
(
const
char
*cookie_header,
const
char
*name);
87
88
/** @} */
89
90
#endif
native_dynamic_url_decode
char * native_dynamic_url_decode(const char *encoded)
Decodes a percent-encoded URL string.
Definition
native_dynamic_request_fields.c:24
native_dynamic_form_value
char * native_dynamic_form_value(const char *body, const char *key)
Extracts a value from a URL-encoded form body.
Definition
native_dynamic_request_fields.c:144
native_dynamic_query_value
char * native_dynamic_query_value(const char *query, const char *key)
Extracts a parameter value from a query string.
Definition
native_dynamic_request_fields.c:140
native_dynamic_cookie_value
char * native_dynamic_cookie_value(const char *cookie_header, const char *name)
Extracts a cookie value from a Cookie header string.
Definition
native_dynamic_request_fields.c:148
src
native_runtime
c
native_dynamic_request_fields.h
Generated by
1.17.0