diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2020-01-12 21:51:12 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2020-07-08 19:54:29 -0400 |
commit | 7c7f8c467c8b6af678faf10078d7a59c3856045a (patch) | |
tree | 491b6c04ef37043a51e230825aab4deb0a347c47 /src/request.h | |
parent | cc2134c88badd541cfe1954c80e371db5f28ede3 (diff) | |
download | lighttpd-git-7c7f8c467c8b6af678faf10078d7a59c3856045a.tar.gz |
[multiple] split con, request (very large change)
NB: r->tmp_buf == srv->tmp_buf (pointer is copied for quicker access)
NB: request read and write chunkqueues currently point to connection
chunkqueues; per-request and per-connection chunkqueues are
not distinct from one another
con->read_queue == r->read_queue
con->write_queue == r->write_queue
NB: in the future, a separate connection config may be needed for
connection-level module hooks. Similarly, might need to have
per-request chunkqueues separate from per-connection chunkqueues.
Should probably also have a request_reset() which is distinct from
connection_reset().
Diffstat (limited to 'src/request.h')
-rw-r--r-- | src/request.h | 125 |
1 files changed, 80 insertions, 45 deletions
diff --git a/src/request.h b/src/request.h index da81eb71..66e05dbe 100644 --- a/src/request.h +++ b/src/request.h @@ -15,6 +15,8 @@ struct cond_cache_t; /* declaration */ struct cond_match_t; /* declaration */ typedef struct { + unsigned int http_parseopts; + uint32_t max_request_field_size; const array *mimetypes; /* virtual-servers */ @@ -23,7 +25,7 @@ typedef struct { const buffer *server_tag; struct log_error_st *errh; - uint32_t max_request_field_size; + unsigned int max_request_size; unsigned short max_keep_alive_requests; unsigned short max_keep_alive_idle; unsigned short max_read_idle; @@ -40,7 +42,6 @@ typedef struct { unsigned char error_intercept; /* debug */ - unsigned char log_file_not_found; unsigned char log_request_header; unsigned char log_request_handling; @@ -50,9 +51,6 @@ typedef struct { unsigned char log_state_handling; unsigned char log_request_header_on_error; - unsigned int http_parseopts; - unsigned int max_request_size; - unsigned int bytes_per_second; /* connection bytes/sec limit */ unsigned int global_bytes_per_second;/*total bytes/sec limit for scope*/ @@ -76,69 +74,106 @@ typedef struct { struct log_error_st *serrh; /* script errh */ } request_config; +typedef struct { + buffer scheme; /* scheme without colon or slashes ( "http" or "https" ) */ + + /* authority with optional portnumber ("site.name" or "site.name:8080" ) NOTE: without "username:password@" */ + buffer authority; + + /* path including leading slash ("/" or "/index.html") - urldecoded, and sanitized ( buffer_path_simplify() && buffer_urldecode_path() ) */ + buffer path; + buffer path_raw; /* raw path, as sent from client. no urldecoding or path simplifying */ + buffer query; /* querystring ( everything after "?", ie: in "/index.php?foo=1", query is "foo=1" ) */ +} request_uri; + +typedef struct { + buffer path; + buffer basedir; /* path = "(basedir)(.*)" */ + + buffer doc_root; /* path = doc_root + rel_path */ + buffer rel_path; + + buffer etag; +} physical; + /* the order of the items should be the same as they are processed * read before write as we use this later e.g. <= CON_STATE_REQUEST_END */ typedef enum { - CON_STATE_CONNECT, - CON_STATE_REQUEST_START, - CON_STATE_READ, - CON_STATE_REQUEST_END, - CON_STATE_READ_POST, - CON_STATE_HANDLE_REQUEST, - CON_STATE_RESPONSE_START, - CON_STATE_WRITE, - CON_STATE_RESPONSE_END, - CON_STATE_ERROR, - CON_STATE_CLOSE + CON_STATE_CONNECT, + CON_STATE_REQUEST_START, + CON_STATE_READ, + CON_STATE_REQUEST_END, + CON_STATE_READ_POST, + CON_STATE_HANDLE_REQUEST, + CON_STATE_RESPONSE_START, + CON_STATE_WRITE, + CON_STATE_RESPONSE_END, + CON_STATE_ERROR, + CON_STATE_CLOSE } request_state_t; struct request_st { - request_config *conf; request_state_t state; /*(modules should not modify request state)*/ - connection *con; - - /** HEADER */ - buffer *target; - buffer *target_orig; + int http_status; - http_method_t http_method; + http_method_t http_method; http_version_t http_version; + + const plugin *handler_module; void **plugin_ctx; /* plugin connection specific config */ + connection *con; - /* strings to the header */ - buffer *http_host; /* not alloced */ + /* config conditions (internal) */ + uint32_t conditional_is_valid; + struct cond_cache_t *cond_cache; + struct cond_match_t *cond_match; - unsigned int htags; /* bitfield of flagged headers present in request */ - array headers; + request_config conf; + + /* request */ + uint32_t rqst_htags;/* bitfield of flagged headers present in request */ + uint32_t rqst_header_len; + array rqst_headers; + + request_uri uri; + physical physical; + array env; /* used to pass lighttpd internal stuff */ - /* CONTENT */ off_t reqbody_length; /* request Content-Length */ off_t te_chunked; struct chunkqueue *reqbody_queue; /*(might use tempfiles)*/ - time_t start_ts; - struct timespec start_hp; + buffer *http_host; /* copy of array value buffer ptr; not alloc'ed */ + const buffer *server_name; - uint32_t rqst_header_len; - char keep_alive; /* only request.c can enable it, all other just disable */ - char loops_per_request; /* catch endless loops in a single request */ - char async_callback; + buffer target; + buffer target_orig; - const buffer *server_name; + buffer pathinfo; + buffer server_name_buf; - /* internal */ - uint32_t conditional_is_valid; - struct cond_cache_t *cond_cache; - struct cond_match_t *cond_match; + /* response */ + off_t content_length; + uint32_t resp_htags; /*bitfield of flagged headers present in response*/ + uint32_t resp_header_len; + array resp_headers; + char resp_body_finished; + char resp_body_started; + char resp_send_chunked; - array env; /* used to pass lighttpd internal stuff */ + char loops_per_request; /* catch endless loops in a single request */ + char keep_alive; /* only request.c can enable it, all other just disable */ + char async_callback; + + struct chunkqueue *write_queue; /* HTTP response queue [ file, mem ] */ + struct chunkqueue *read_queue; /* HTTP request queue [ mem ] */ + buffer *tmp_buf; /* shared; same as srv->tmp_buf */ - /* error-handler */ - int error_handler_saved_status; - http_method_t error_handler_saved_method; + struct timespec start_hp; + time_t start_ts; - buffer *pathinfo; - buffer *server_name_buf; + int error_handler_saved_status; /* error-handler */ + http_method_t error_handler_saved_method; /* error-handler */ }; |