Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ if test "$PHP_HTTP_SERVER" != "no"; then
deps/llhttp/api.c
deps/llhttp/http.c
src/http_server.c
src/http_server_exceptions.c
src/http_server_config.c
src/http_server_class.c
src/core/http_connection.c
Expand Down Expand Up @@ -538,9 +537,7 @@ if test "$PHP_HTTP_SERVER" != "no"; then
src/http_mime.c
src/http_date.c
src/http_etag.c
src/http_conditional.c
src/http_range.c
src/fs_util.c
src/http_rfc5987.c
src/http_precompressed.c
src/http_param_parse.c
Expand Down
3 changes: 0 additions & 3 deletions config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ if (PHP_TRUE_ASYNC_SERVER == "yes") {
// it under build-dir\src\, producing LNK1181.
var http_server_sources =
"src\\http_server.c " +
"src\\http_server_exceptions.c " +
"src\\http_server_config.c " +
"src\\http_server_class.c " +
"src\\http_request.c " +
Expand All @@ -29,9 +28,7 @@ if (PHP_TRUE_ASYNC_SERVER == "yes") {
"src\\http_mime.c " +
"src\\http_date.c " +
"src\\http_etag.c " +
"src\\http_conditional.c " +
"src\\http_range.c " +
"src\\fs_util.c " +
"src\\http_rfc5987.c " +
"src\\http_precompressed.c " +
"src\\http_param_parse.c " +
Expand Down
23 changes: 0 additions & 23 deletions include/fs_util.h

This file was deleted.

28 changes: 0 additions & 28 deletions include/http_conditional.h

This file was deleted.

14 changes: 14 additions & 0 deletions include/send_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>

#include "static/http_static_cache.h" /* http_static_cache_view_t */

Expand Down Expand Up @@ -148,6 +149,19 @@ send_file_result_t send_file(struct http_request_t *request, zend_object *respon
const send_file_config_t *config, const send_file_cbs_t *cbs,
void *user);

/* Read exactly `expected_size` bytes from `fd` into a freshly-allocated
* zend_string. Retries EINTR. Returns NULL on any IO error or on
* premature EOF. Used by the small-file slurp fast-paths. */
zend_string *fs_slurp_fd(int fd, size_t expected_size);

/* Returns true when the request's conditional-GET headers match the
* resource state and the server SHOULD answer 304. The etag value,
* when supplied, must be the canonical W/"..." form produced by
* http_etag_format_strong. last_modified is in seconds. */
bool http_conditional_check(const char *if_none_match, size_t if_none_match_len,
const char *if_modified_since, size_t if_modified_since_len,
const char *etag, size_t etag_len, time_t last_modified);

/* File-size threshold below which the static-handler's slurp fast-path
* is strictly cheaper than the async engine. See http_static_try_serve
* routing and the matching slurp branch inside the send_file engine. */
Expand Down
64 changes: 0 additions & 64 deletions src/fs_util.c

This file was deleted.

40 changes: 0 additions & 40 deletions src/http_conditional.c

This file was deleted.

28 changes: 28 additions & 0 deletions src/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "php.h"
#include "php_ini.h"
#include "zend_exceptions.h"
#include "ext/standard/info.h"
#include "zend_smart_str.h"
#include "php_http_server.h"
Expand Down Expand Up @@ -43,10 +44,37 @@

/* Include generated arginfo */
#include "../stubs/functions.php_arginfo.h"
#include "../stubs/HttpServerExceptions.php_arginfo.h"

/* Declare module globals */
ZEND_DECLARE_MODULE_GLOBALS(http_server)

/* Exception class entries */
zend_class_entry *http_server_exception_ce;
zend_class_entry *http_server_runtime_exception_ce;
zend_class_entry *http_server_invalid_argument_exception_ce;
zend_class_entry *http_server_connection_exception_ce;
zend_class_entry *http_server_protocol_exception_ce;
zend_class_entry *http_server_timeout_exception_ce;
zend_class_entry *http_exception_ce;

void http_server_exceptions_register(void)
{
http_server_exception_ce = register_class_TrueAsync_HttpServerException();

http_server_runtime_exception_ce = register_class_TrueAsync_HttpServerRuntimeException(http_server_exception_ce);
http_server_invalid_argument_exception_ce = register_class_TrueAsync_HttpServerInvalidArgumentException(http_server_exception_ce);
http_server_connection_exception_ce = register_class_TrueAsync_HttpServerConnectionException(http_server_exception_ce);
http_server_protocol_exception_ce = register_class_TrueAsync_HttpServerProtocolException(http_server_exception_ce);
http_server_timeout_exception_ce = register_class_TrueAsync_HttpServerTimeoutException(http_server_exception_ce);

/* HttpException — separate hierarchy. Extends Async\AsyncCancellation
* (resolved at registration time inside the arginfo helper). User
* handlers throw it to set a precise HTTP error response; we also
* use it internally for cancelling in-flight handlers on parser errors. */
http_exception_ce = register_class_TrueAsync_HttpException();
}

extern zval* http_request_create_from_parsed(http_request_t *req);

/* PHP Functions */
Expand Down
50 changes: 0 additions & 50 deletions src/http_server_exceptions.c

This file was deleted.

Loading
Loading