32 if (x->cursor >= x->end) {
33 x->token_type = afw_command_local_parse_token_type_end_of_input;
36 if (*x->cursor !=
' ') {
42 if (*x->cursor ==
'\r') {
43 x->token_type = afw_command_local_parse_token_type_end_of_line;
45 if (x->cursor >= x->end) {
48 if (*x->cursor ==
'\n') {
54 if (*x->cursor ==
'\n') {
55 x->token_type = afw_command_local_parse_token_type_end_of_line;
60 if (*x->cursor ==
':') {
61 x->token_type = afw_command_local_parse_token_type_colon;
66 if (*x->cursor ==
'"') {
70 for (;; x->cursor++) {
71 if (x->cursor >= x->end) {
72 x->token_type = afw_command_local_parse_token_type_invalid;
75 if (*x->cursor ==
'"') {
77 x->token_type = afw_command_local_parse_token_type_string;
88 for (start = x->cursor; ; x->cursor++) {
89 if (x->cursor >= x->end) {
90 x->token_type = afw_command_local_parse_token_type_invalid;
93 if (*x->cursor ==
' ' ||
98 x->token_type = afw_command_local_parse_token_type_string;
111 afw_command_local_parse_request(
124 x.cursor = x.input->ptr;
125 x.end = (*input)->ptr + (*input)->size;
130 if (x.token_type != afw_command_local_parse_token_type_string) {
136 &afw_s_REQUEST_METHOD, x.string, xctx);
140 if (x.token_type != afw_command_local_parse_token_type_string) {
146 &afw_s_REQUEST_URI, x.string, xctx);
150 if (x.token_type != afw_command_local_parse_token_type_string) {
156 &afw_command_s_SERVER_PROTOCOL, x.string, xctx);
160 if (x.token_type != afw_command_local_parse_token_type_end_of_line) {
165 if (x.cursor >= x.end) {
176 if (x.token_type == afw_command_local_parse_token_type_end_of_line) {
179 payload->size = x.end - x.cursor;
184 if (x.token_type == afw_command_local_parse_token_type_end_of_input) {
189 if (x.token_type != afw_command_local_parse_token_type_string) {
198 if (x.token_type != afw_command_local_parse_token_type_colon) {
206 if (x.token_type != afw_command_local_parse_token_type_string) {
214 name, x.string, xctx);
218 if (x.token_type != afw_command_local_parse_token_type_end_of_line) {
Adaptive Framework Core API.
#define AFW_COMMAND_DEFINE_INTERNAL(type)
Define an internal function for /src/afw_command/ source*.c files.
Adaptive Framework afw command internal header.
Parse function to support afw command local server.
afw_object_set_property_as_string(const afw_object_t *object, const afw_utf8_t *property_name, const afw_utf8_t *internal, afw_xctx_t *xctx)
Set property function for data type string values.
unsigned char afw_byte_t
A byte of memory (unsigned).
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
#define AFW_SIZE_T_FMT
Format string specifier used for afw_size_t.
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
#define afw_memory_clear(to)
Clear preallocated memory for sizeof(*(to)).
#define afw_utf8_create_copy(s, len, p, xctx)
Make a utf-8 sting from chars in pool specified.
#define afw_xctx_malloc_type(type, xctx)
Macro to allocate uncleared memory to hold type in xctx's pool.
Self typedef for afw_command_local implementation of afw_server.
Struct for memory pointer and size.
NFC normalized UTF-8 string.
Interface afw_xctx public struct.