14 #define AFW_IMPLEMENTATION_ID "afw_command_local"
36 impl_afw_request_release(
49 impl_afw_request_set_error_info(
57 self->pub.error_info = error_info;
66 impl_afw_request_read_raw_request_body(
78 if (self->state > afw_request_state_content_read) {
80 "read_request_body() called out of order", xctx);
82 self->state = afw_request_state_content_read;
85 if (*size > self->remaining_body) {
86 *size =
self->remaining_body;
91 self->body->ptr + self->body->size - self->remaining_body,
93 self->remaining_body -= *size;
96 *more_to_read =
self->remaining_body > 0;
105 impl_afw_request_set_response_status_code(
115 if (self->state >= afw_request_state_status_set) {
118 self->state = afw_request_state_status_set;
121 self->status_code = code;
122 self->status_reason = reason;
131 impl_afw_request_write_response_header(
141 if (self->state > afw_request_state_header_written) {
143 "write_response_header() called out of order", xctx);
145 self->state = afw_request_state_header_written;
148 if (!self->response_headers) {
149 self->response_headers = apr_array_make(
152 APR_ARRAY_PUSH(self->response_headers,
const afw_utf8_t *) = name;
153 APR_ARRAY_PUSH(self->response_headers,
const afw_utf8_t *) = value;
162 impl_afw_request_write_raw_response_body(
172 if (self->state > afw_request_state_response_written) {
174 "write_response_body() called out of order", xctx);
176 self->state = afw_request_state_response_written;
179 afw_command_local_server_write_result(
182 (
int)size, (
const char *)buffer);
191 impl_afw_request_flush_response(
204 impl_afw_request_finish_response(
212 if (self->state >= afw_request_state_response_finished) {
214 "finish_response() called out of order", xctx);
216 self->state = afw_request_state_response_finished;
219 afw_command_local_server_write_end(self->server_self);
225 impl_read_content_cb(
235 impl_afw_request_read_raw_request_body(
237 size, (
void *)buffer, &size_read, more_to_read, xctx);
245 impl_write_content_cb(
252 impl_afw_request_write_raw_response_body(
261 afw_command_local_request_create(
277 self->pub.inf = &impl_afw_request_inf;
278 self->pub.xctx = xctx;
279 self->server_self = server_self;
280 self->pub.read_content_cb = impl_read_content_cb;
281 self->pub.write_content_cb = impl_write_content_cb;
282 self->pub.properties = properties;
285 self->pub.content_length = body->size;
287 self->remaining_body = body->size;
291 properties, &afw_s_REQUEST_METHOD, xctx);
292 if (!self->pub.method) {
293 self->pub.method = &afw_s_POST;
295 properties, &afw_s_REQUEST_METHOD, self->pub.method, xctx);
300 properties, &afw_s_REQUEST_URI, xctx);
301 if (!self->pub.uri) {
302 self->pub.uri = &afw_s_a_slash_afw;
304 properties, &afw_s_REQUEST_URI, self->pub.uri, xctx);
309 properties, &afw_s_CONTENT_TYPE, xctx);
310 if (!self->pub.content_type) {
312 properties, &afw_s_CONTENT_TYPE, xctx);
313 if (!self->pub.content_type) {
314 self->pub.content_type = &afw_s_a_application_json;
317 properties, &afw_s_CONTENT_TYPE, self->pub.content_type, xctx);
322 properties, &afw_s_QUERY_STRING, xctx);
329 properties, &afw_s_CONTENT_LENGTH, s, xctx);
335 properties, &afw_s_HTTP_ACCEPT, xctx);
337 s = &afw_s_a_application_json;
340 properties, &afw_s_ACCEPT, s, xctx);
Adaptive Framework Core API.
#define AFW_COMMAND_DECLARE_INTERNAL(type)
Declare an internal function for /src/afw_command/ source*.h files.
Implementation for interface afw_command_local.
Interface afw_interface implementation declares.
afw_value_create_integer(afw_integer_t internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type integer value.
#define afw_object_old_get_property_as_string(object, property_name, xctx)
Get property function for data type string value.
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.
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
apr_size_t afw_size_t
size_t.
apr_int64_t afw_integer_t
typedef for big signed int.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
#define afw_pool_get_apr_pool(instance)
Call method get_apr_pool of interface afw_pool.
afw_utf8_parse_csv(const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx)
Check to see if a string equals a utf8_z string.
afw_value_as_utf8(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
#define afw_xctx_calloc_type(type, xctx)
Macro to allocate cleared memory to hold type in xctx's pool.
Self typedef for afw_command_local implementation of afw_request.
Self typedef for afw_command_local implementation of afw_server.
Struct for memory pointer and size.
Interface afw_object public struct.
Interface afw_pool public struct.
Interface afw_request public struct.
NFC normalized UTF-8 string.
Interface afw_value public struct.
Interface afw_xctx public struct.