function uri_port_($http_host) { if (!str_contains_(':', $http_host)) { return ''; } else { $port = array_pop(explode(':', $http_host)); } return str_sanitize_($port); }
function webserver_($server_software) { $server_softwares = array('Apache' => 'apache', 'Microsoft-IIS' => 'iis', 'Microsoft-PWS' => 'pws', 'Xitami' => 'xitami', 'Zeus' => 'zeus', 'OmniHTTPd' => 'omnihttpd'); foreach ($server_softwares as $key => $value) { if (str_contains_($key, $server_software)) { return $value; } } return 'unknown'; }
function apache_request_path_helper_($request_uri, $path_to_index_dot_php) { $path = substr($request_uri, strlen($path_to_index_dot_php)); list($path, ) = str_contains_('?', $path) ? explode('?', $path, 2) : array($path, ''); return $path; }
function dispatch_request_($handler, $method, $path, $query, $headers, $body) { $params = get_defined_vars(); $wrapper = 'default'; if (str_contains_('://', $handler)) { list($wrapper, ) = explode('://', $handler); } $response = wrapper_request_($wrapper, $params); return valid_response_($response); }