Lines Matching refs:server

163 	struct php_cli_server *server;  member
616 …sapi_cli_server_register_variable(track_vars_array, "DOCUMENT_ROOT", client->server->document_root… in sapi_cli_server_register_variables()
643 sapi_cli_server_register_variable(track_vars_array, "SERVER_NAME", client->server->host TSRMLS_CC); in sapi_cli_server_register_variables()
646 spprintf(&tmp, 0, "%i", client->server->port); in sapi_cli_server_register_variables()
656 } else if (client->server->router) { in sapi_cli_server_register_variables()
658 spprintf(&temp, 0, "%s/%s", client->server->document_root, client->server->router); in sapi_cli_server_register_variables()
1603 …_server_request_translate_vpath(&client->request, client->server->document_root, client->server->d… in php_cli_server_client_read_request_on_message_complete()
1730 static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_server *server, int cl… in php_cli_server_client_ctor() argument
1732 client->server = server; in php_cli_server_client_ctor()
1772 static void php_cli_server_close_connection(php_cli_server *server, php_cli_server_client *client T… in php_cli_server_close_connection() argument
1777 zend_hash_index_del(&server->clients, client->sock); in php_cli_server_close_connection()
1780 static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server_client *client, in… in php_cli_server_send_error_page() argument
1861 php_cli_server_poller_add(&server->poller, POLLOUT, client->sock); in php_cli_server_send_error_page()
1876 static int php_cli_server_dispatch_script(php_cli_server *server, php_cli_server_client *client TSR… in php_cli_server_dispatch_script() argument
1880 return php_cli_server_send_error_page(server, client, 400 TSRMLS_CC); in php_cli_server_dispatch_script()
1898 static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_server_client *client T… in php_cli_server_begin_send_static() argument
1905 return php_cli_server_send_error_page(server, client, 400 TSRMLS_CC); in php_cli_server_begin_send_static()
1910 return php_cli_server_send_error_page(server, client, 404 TSRMLS_CC); in php_cli_server_begin_send_static()
1951 php_cli_server_poller_add(&server->poller, POLLOUT, client->sock); in php_cli_server_begin_send_static()
1956 static int php_cli_server_request_startup(php_cli_server *server, php_cli_server_client *client TSR… in php_cli_server_request_startup() argument
1974 static int php_cli_server_request_shutdown(php_cli_server *server, php_cli_server_client *client TS… in php_cli_server_request_shutdown() argument
1976 php_cli_server_close_connection(server, client TSRMLS_CC); in php_cli_server_request_shutdown()
1984 static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server_client *client TSR… in php_cli_server_dispatch_router() argument
1997 zfd.filename = server->router; in php_cli_server_dispatch_router()
2025 static int php_cli_server_dispatch(php_cli_server *server, php_cli_server_client *client TSRMLS_DC)… in php_cli_server_dispatch() argument
2034 if (server->router || !is_static_file) { in php_cli_server_dispatch()
2035 if (FAILURE == php_cli_server_request_startup(server, client TSRMLS_CC)) { in php_cli_server_dispatch()
2037 php_cli_server_close_connection(server, client TSRMLS_CC); in php_cli_server_dispatch()
2043 if (server->router) { in php_cli_server_dispatch()
2044 if (!php_cli_server_dispatch_router(server, client TSRMLS_CC)) { in php_cli_server_dispatch()
2045 php_cli_server_request_shutdown(server, client TSRMLS_CC); in php_cli_server_dispatch()
2051 if (SUCCESS == php_cli_server_dispatch_script(server, client TSRMLS_CC) in php_cli_server_dispatch()
2052 || SUCCESS != php_cli_server_send_error_page(server, client, 500 TSRMLS_CC)) { in php_cli_server_dispatch()
2053 php_cli_server_request_shutdown(server, client TSRMLS_CC); in php_cli_server_dispatch()
2057 if (server->router) { in php_cli_server_dispatch()
2069 if (SUCCESS != php_cli_server_begin_send_static(server, client TSRMLS_CC)) { in php_cli_server_dispatch()
2070 php_cli_server_close_connection(server, client TSRMLS_CC); in php_cli_server_dispatch()
2082 static void php_cli_server_dtor(php_cli_server *server TSRMLS_DC) /* {{{ */ in php_cli_server_dtor()
2084 zend_hash_destroy(&server->clients); in php_cli_server_dtor()
2085 if (server->server_sock >= 0) { in php_cli_server_dtor()
2086 closesocket(server->server_sock); in php_cli_server_dtor()
2088 if (server->host) { in php_cli_server_dtor()
2089 pefree(server->host, 1); in php_cli_server_dtor()
2091 if (server->document_root) { in php_cli_server_dtor()
2092 pefree(server->document_root, 1); in php_cli_server_dtor()
2094 if (server->router) { in php_cli_server_dtor()
2095 pefree(server->router, 1); in php_cli_server_dtor()
2102 php_cli_server_poller_remove(&(*p)->server->poller, POLLIN | POLLOUT, (*p)->sock); in php_cli_server_client_dtor_wrapper()
2107 static int php_cli_server_ctor(php_cli_server *server, const char *addr, const char *document_root,… in php_cli_server_ctor() argument
2156 …server_sock = php_network_listen_socket(host, &port, SOCK_STREAM, &server->address_family, &server in php_cli_server_ctor()
2163 server->server_sock = server_sock; in php_cli_server_ctor()
2165 err = php_cli_server_poller_ctor(&server->poller); in php_cli_server_ctor()
2170 php_cli_server_poller_add(&server->poller, POLLIN, server_sock); in php_cli_server_ctor()
2172 server->host = host; in php_cli_server_ctor()
2173 server->port = port; in php_cli_server_ctor()
2175 zend_hash_init(&server->clients, 0, NULL, (void(*)(void*))php_cli_server_client_dtor_wrapper, 1); in php_cli_server_ctor()
2184 server->document_root = _document_root; in php_cli_server_ctor()
2185 server->document_root_len = document_root_len; in php_cli_server_ctor()
2195 server->router = _router; in php_cli_server_ctor()
2196 server->router_len = router_len; in php_cli_server_ctor()
2198 server->router = NULL; in php_cli_server_ctor()
2199 server->router_len = 0; in php_cli_server_ctor()
2202 server->is_running = 1; in php_cli_server_ctor()
2221 static int php_cli_server_recv_event_read_request(php_cli_server *server, php_cli_server_client *cl… in php_cli_server_recv_event_read_request() argument
2228 php_cli_server_close_connection(server, client TSRMLS_CC); in php_cli_server_recv_event_read_request()
2231 return php_cli_server_send_error_page(server, client, 501 TSRMLS_CC); in php_cli_server_recv_event_read_request()
2233 php_cli_server_poller_remove(&server->poller, POLLIN, client->sock); in php_cli_server_recv_event_read_request()
2234 php_cli_server_dispatch(server, client TSRMLS_CC); in php_cli_server_recv_event_read_request()
2236 php_cli_server_poller_add(&server->poller, POLLIN, client->sock); in php_cli_server_recv_event_read_request()
2242 static int php_cli_server_send_event(php_cli_server *server, php_cli_server_client *client TSRMLS_D… in php_cli_server_send_event() argument
2248 php_cli_server_close_connection(server, client TSRMLS_CC); in php_cli_server_send_event()
2260 php_cli_server_close_connection(server, client TSRMLS_CC); in php_cli_server_send_event()
2265 php_cli_server_close_connection(server, client TSRMLS_CC); in php_cli_server_send_event()
2276 php_cli_server *server; member
2287 php_cli_server *server = params->server; in php_cli_server_do_event_for_each_fd_callback() local
2288 if (server->server_sock == fd) { in php_cli_server_do_event_for_each_fd_callback()
2291 socklen_t socklen = server->socklen; in php_cli_server_do_event_for_each_fd_callback()
2292 struct sockaddr *sa = pemalloc(server->socklen, 1); in php_cli_server_do_event_for_each_fd_callback()
2296 client_sock = accept(server->server_sock, sa, &socklen); in php_cli_server_do_event_for_each_fd_callback()
2310 …cli_server_client), 1)) || FAILURE == php_cli_server_client_ctor(client, server, client_sock, sa, … in php_cli_server_do_event_for_each_fd_callback()
2319 zend_hash_index_update(&server->clients, client_sock, &client, sizeof(client), NULL); in php_cli_server_do_event_for_each_fd_callback()
2320 php_cli_server_recv_event_read_request(server, client TSRMLS_CC); in php_cli_server_do_event_for_each_fd_callback()
2323 if (SUCCESS == zend_hash_index_find(&server->clients, fd, (void **)&client)) { in php_cli_server_do_event_for_each_fd_callback()
2325 params->rhandler(server, *client TSRMLS_CC); in php_cli_server_do_event_for_each_fd_callback()
2328 params->whandler(server, *client TSRMLS_CC); in php_cli_server_do_event_for_each_fd_callback()
2335 static void php_cli_server_do_event_for_each_fd(php_cli_server *server, int(*rhandler)(php_cli_serv… in php_cli_server_do_event_for_each_fd() argument
2341 server, in php_cli_server_do_event_for_each_fd()
2346 …php_cli_server_poller_iter_on_active(&server->poller, &params, php_cli_server_do_event_for_each_fd… in php_cli_server_do_event_for_each_fd()
2349 static int php_cli_server_do_event_loop(php_cli_server *server TSRMLS_DC) /* {{{ */ in php_cli_server_do_event_loop()
2352 while (server->is_running) { in php_cli_server_do_event_loop()
2354 int n = php_cli_server_poller_poll(&server->poller, &tv); in php_cli_server_do_event_loop()
2356 php_cli_server_do_event_for_each_fd(server, in php_cli_server_do_event_loop()
2376 static php_cli_server server; variable
2380 server.is_running = 0; in php_cli_server_sigint_handler()
2435 …if (FAILURE == php_cli_server_ctor(&server, server_bind_address, document_root, router TSRMLS_CC))… in do_cli_server()
2457 php_cli_server_do_event_loop(&server TSRMLS_CC); in do_cli_server()
2458 php_cli_server_dtor(&server TSRMLS_CC); in do_cli_server()