Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_dynamic_runtime.h File Reference

In-process dynamic-app request handler for the Pharos native runtime. More...

Go to the source code of this file.

Functions

Dynamic runtime entry points
int native_dynamic_runtime_handle_request (const AppRuntime *app, const HttpRequest *request, NativeConnection *connection)
 Serves one dynamic-app request entirely in-process.
const char * native_dynamic_runtime_host_profile (void)
 Returns the canonical host profile string that this module handles.

Detailed Description

In-process dynamic-app request handler for the Pharos native runtime.

This module owns the primary entry point for serving dynamic-app requests directly inside the Pharos binary process. It replaces the earlier architecture where every dynamic-app request spawned a child process via spawn_app_request().

The handler is responsible for:

  • loading the route fixture for the target app,
  • matching the incoming request path against declared routes,
  • serving static assets from the artifact directory,
  • delegating page and action routes to the dispatch layer, and
  • writing the final HTTP response back through the connection.
See also
native_dynamic_dispatch.h for the route-matching layer.
native_dynamic_request_fields.h for request field extraction helpers.

Definition in file native_dynamic_runtime.h.

Function Documentation

◆ native_dynamic_runtime_handle_request()

int native_dynamic_runtime_handle_request ( const AppRuntime * app,
const HttpRequest * request,
NativeConnection * connection )

Serves one dynamic-app request entirely in-process.

This is the canonical entry point that replaces the former spawn_app_request() path for apps whose host_profile is "dynamic-app". The function reads the app's route fixture, resolves the appropriate handler, and writes the HTTP response directly to connection.

Static-only and non-dynamic host profiles continue to use their existing code paths; this function is called only for dynamic-app requests.

Parameters
appFinalized app runtime metadata (artifact dir, state, etc.).
requestParsed HTTP request record.
connectionConnection to write the response to.
Returns
0 on success, or a non-zero native status code on failure.

Definition at line 6494 of file native_dynamic_runtime.c.

References AppRuntime::app_id, AppRuntime::artifact_dir, HttpRequest::cookie, csrf_token_for_response(), extract_query(), handle_action_route(), handle_page_route(), is_business_availability_api_list_path_runtime(), is_business_availability_api_schema_path_runtime(), is_business_services_api_list_path_runtime(), is_business_services_api_schema_path_runtime(), NativeDynamicRouteMatch::kind, load_root_from_text_runtime(), MAX_QUERY_LEN, HttpRequest::method, native_connection_printf(), native_dynamic_dispatch_extract_param(), native_dynamic_dispatch_free_match(), native_dynamic_dispatch_match(), native_dynamic_dispatch_resolve_route_fixture(), native_dynamic_dispatch_response_file(), native_dynamic_media_is_static_path(), native_dynamic_media_serve_asset(), native_dynamic_relational_prepare_request_state(), native_dynamic_relational_request_sync_free(), native_dynamic_relational_sync_back_if_changed(), native_json_doc_free(), native_json_doc_load_file(), native_json_obj_get(), native_send_text_response(), path_exists(), read_file_text(), request_body_text_dup_runtime(), route_request_path_dup_runtime(), AppRuntime::state_path, streq(), HttpRequest::target, time_text_to_minutes_runtime(), valid_day_of_week_runtime(), write_business_availability_api_response(), write_business_services_api_response(), write_generated_surface_schema_response(), write_json_error(), write_proof_state_api_response(), yyjson_get_str(), yyjson_is_str(), yyjson_write(), and YYJSON_WRITE_NOFLAG.

Referenced by handle_app_or_runtime_request().

◆ native_dynamic_runtime_host_profile()

const char * native_dynamic_runtime_host_profile ( void )

Returns the canonical host profile string that this module handles.

Useful for callers that need to decide which request path to use without duplicating the profile name string.

Returns
Pointer to a string literal; never NULL.

Definition at line 6490 of file native_dynamic_runtime.c.

References DYNAMIC_HOST_PROFILE.