mirror of
https://github.com/apache/httpd.git
synced 2025-08-13 14:40:20 +00:00
*) core/mod_http/mod_http2:
- adds new meta bucket types REQUEST, RESPONSE and HEADERS to the API. - adds a new method for setting standard response headers Date and Server - adds helper methods for formatting parts of HTTP/1.x, like headers and end chunks for use in non-core parts of the server, e.g. mod_proxy - splits the HTTP_IN filter into a "generic HTTP" and "specific HTTP/1.x" filter. The latter one named HTTP1_BODY_IN. - Uses HTTP1_BODY_IN only for requests with HTTP version <= 1.1 - Removes the chunked input simulation from mod_http2 - adds body_indeterminate flag to request_rec that indicates that a request body may be present and needs to be read/discarded. This replaces logic that thinks without Content-Length and Transfer-Encoding, no request body can exist. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -47,6 +47,7 @@
|
||||
#include "mod_core.h"
|
||||
#include "util_charset.h"
|
||||
#include "util_ebcdic.h"
|
||||
#include "util_time.h"
|
||||
#include "scoreboard.h"
|
||||
|
||||
#if APR_HAVE_STDARG_H
|
||||
@ -1465,6 +1466,18 @@ static void apply_server_config(request_rec *r)
|
||||
r->per_dir_config = r->server->lookup_defaults;
|
||||
}
|
||||
|
||||
AP_DECLARE(int) ap_assign_request(request_rec *r,
|
||||
const char *method, const char *uri,
|
||||
const char *protocol)
|
||||
{
|
||||
/* dummy, for now */
|
||||
(void)r;
|
||||
(void)method;
|
||||
(void)uri;
|
||||
(void)protocol;
|
||||
return 0;
|
||||
}
|
||||
|
||||
request_rec *ap_read_request(conn_rec *conn)
|
||||
{
|
||||
int access_status;
|
||||
@ -1583,6 +1596,14 @@ request_rec *ap_read_request(conn_rec *conn)
|
||||
*/
|
||||
ap_add_input_filter_handle(ap_http_input_filter_handle,
|
||||
NULL, r, r->connection);
|
||||
if (r->proto_num <= HTTP_VERSION(1,1)) {
|
||||
ap_add_input_filter_handle(ap_h1_body_in_filter_handle,
|
||||
NULL, r, r->connection);
|
||||
if (r->proto_num >= HTTP_VERSION(1,0)
|
||||
&& apr_table_get(r->headers_in, "Transfer-Encoding")) {
|
||||
r->body_indeterminate = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Validate Host/Expect headers and select vhost. */
|
||||
if (!ap_check_request_header(r)) {
|
||||
@ -2385,6 +2406,38 @@ static int send_header(void *data, const char *key, const char *val)
|
||||
}
|
||||
#endif
|
||||
|
||||
AP_DECLARE(void) ap_set_std_response_headers(request_rec *r)
|
||||
{
|
||||
const char *server = NULL, *date;
|
||||
char *s;
|
||||
|
||||
/* Before generating a response, we make sure that `Date` and `Server`
|
||||
* headers are present. When proxying requests, we preserver existing
|
||||
* values and replace them otherwise.
|
||||
*/
|
||||
if (r->proxyreq != PROXYREQ_NONE) {
|
||||
date = apr_table_get(r->headers_out, "Date");
|
||||
if (!date) {
|
||||
s = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
|
||||
ap_recent_rfc822_date(s, r->request_time);
|
||||
date = s;
|
||||
}
|
||||
server = apr_table_get(r->headers_out, "Server");
|
||||
}
|
||||
else {
|
||||
s = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
|
||||
ap_recent_rfc822_date(s, r->request_time);
|
||||
date = s;
|
||||
}
|
||||
|
||||
apr_table_setn(r->headers_out, "Date", date);
|
||||
|
||||
if (!server)
|
||||
server = ap_get_server_banner();
|
||||
if (server && *server)
|
||||
apr_table_setn(r->headers_out, "Server", server);
|
||||
}
|
||||
|
||||
AP_DECLARE(void) ap_send_interim_response(request_rec *r, int send_headers)
|
||||
{
|
||||
hdr_ptr x;
|
||||
|
Reference in New Issue
Block a user