Latest update - 7466
This commit is contained in:
+107
-19
@@ -11,6 +11,7 @@
|
||||
|
||||
|
||||
static void ngx_http_wait_request_handler(ngx_event_t *ev);
|
||||
static ngx_http_request_t *ngx_http_alloc_request(ngx_connection_t *c);
|
||||
static void ngx_http_process_request_line(ngx_event_t *rev);
|
||||
static void ngx_http_process_request_headers(ngx_event_t *rev);
|
||||
static ssize_t ngx_http_read_request_header(ngx_http_request_t *r);
|
||||
@@ -502,18 +503,46 @@ ngx_http_wait_request_handler(ngx_event_t *rev)
|
||||
|
||||
ngx_http_request_t *
|
||||
ngx_http_create_request(ngx_connection_t *c)
|
||||
{
|
||||
ngx_http_request_t *r;
|
||||
ngx_http_log_ctx_t *ctx;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
||||
r = ngx_http_alloc_request(c);
|
||||
if (r == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
c->requests++;
|
||||
|
||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||
|
||||
ngx_set_connection_log(c, clcf->error_log);
|
||||
|
||||
ctx = c->log->data;
|
||||
ctx->request = r;
|
||||
ctx->current_request = r;
|
||||
|
||||
#if (NGX_STAT_STUB)
|
||||
(void) ngx_atomic_fetch_add(ngx_stat_reading, 1);
|
||||
r->stat_reading = 1;
|
||||
(void) ngx_atomic_fetch_add(ngx_stat_requests, 1);
|
||||
#endif
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static ngx_http_request_t *
|
||||
ngx_http_alloc_request(ngx_connection_t *c)
|
||||
{
|
||||
ngx_pool_t *pool;
|
||||
ngx_time_t *tp;
|
||||
ngx_http_request_t *r;
|
||||
ngx_http_log_ctx_t *ctx;
|
||||
ngx_http_connection_t *hc;
|
||||
ngx_http_core_srv_conf_t *cscf;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
c->requests++;
|
||||
|
||||
hc = c->data;
|
||||
|
||||
cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module);
|
||||
@@ -541,10 +570,6 @@ ngx_http_create_request(ngx_connection_t *c)
|
||||
|
||||
r->read_event_handler = ngx_http_block_reading;
|
||||
|
||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||
|
||||
ngx_set_connection_log(r->connection, clcf->error_log);
|
||||
|
||||
r->header_in = hc->busy ? hc->busy->buf : c->buffer;
|
||||
|
||||
if (ngx_list_init(&r->headers_out.headers, r->pool, 20,
|
||||
@@ -604,17 +629,8 @@ ngx_http_create_request(ngx_connection_t *c)
|
||||
|
||||
r->http_state = NGX_HTTP_READING_REQUEST_STATE;
|
||||
|
||||
ctx = c->log->data;
|
||||
ctx->request = r;
|
||||
ctx->current_request = r;
|
||||
r->log_handler = ngx_http_log_error_handler;
|
||||
|
||||
#if (NGX_STAT_STUB)
|
||||
(void) ngx_atomic_fetch_add(ngx_stat_reading, 1);
|
||||
r->stat_reading = 1;
|
||||
(void) ngx_atomic_fetch_add(ngx_stat_requests, 1);
|
||||
#endif
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -833,6 +849,7 @@ ngx_http_ssl_handshake_handler(ngx_connection_t *c)
|
||||
ngx_http_close_connection(c);
|
||||
}
|
||||
|
||||
|
||||
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
||||
|
||||
int
|
||||
@@ -930,6 +947,75 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SSL_R_CERT_CB_ERROR
|
||||
|
||||
int
|
||||
ngx_http_ssl_certificate(ngx_ssl_conn_t *ssl_conn, void *arg)
|
||||
{
|
||||
ngx_str_t cert, key;
|
||||
ngx_uint_t i, nelts;
|
||||
ngx_connection_t *c;
|
||||
ngx_http_request_t *r;
|
||||
ngx_http_ssl_srv_conf_t *sscf;
|
||||
ngx_http_complex_value_t *certs, *keys;
|
||||
|
||||
c = ngx_ssl_get_connection(ssl_conn);
|
||||
|
||||
if (c->ssl->handshaked) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = ngx_http_alloc_request(c);
|
||||
if (r == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
r->logged = 1;
|
||||
|
||||
sscf = arg;
|
||||
|
||||
nelts = sscf->certificate_values->nelts;
|
||||
certs = sscf->certificate_values->elts;
|
||||
keys = sscf->certificate_key_values->elts;
|
||||
|
||||
for (i = 0; i < nelts; i++) {
|
||||
|
||||
if (ngx_http_complex_value(r, &certs[i], &cert) != NGX_OK) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"ssl cert: \"%s\"", cert.data);
|
||||
|
||||
if (ngx_http_complex_value(r, &keys[i], &key) != NGX_OK) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"ssl key: \"%s\"", key.data);
|
||||
|
||||
if (ngx_ssl_connection_certificate(c, r->pool, &cert, &key,
|
||||
sscf->passwords)
|
||||
!= NGX_OK)
|
||||
{
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
|
||||
ngx_http_free_request(r, 0);
|
||||
c->destroyed = 0;
|
||||
return 1;
|
||||
|
||||
failed:
|
||||
|
||||
ngx_http_free_request(r, 0);
|
||||
c->destroyed = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3523,9 +3609,11 @@ ngx_http_free_request(ngx_http_request_t *r, ngx_int_t rc)
|
||||
r->headers_out.status = rc;
|
||||
}
|
||||
|
||||
log->action = "logging request";
|
||||
if (!r->logged) {
|
||||
log->action = "logging request";
|
||||
|
||||
ngx_http_log_request(r);
|
||||
ngx_http_log_request(r);
|
||||
}
|
||||
|
||||
log->action = "closing request";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user