Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 539:371c1cee100d release-0.1.44
nginx-0.1.44-RELEASE import
*) Feature: the IMAP/POP3 proxy supports SSL.
*) Feature: the "proxy_timeout" directive of the ngx_imap_proxy_module.
*) Feature: the "userid_mark" directive.
*) Feature: the $remote_user variable value is determined independently
of authorization use.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 06 Sep 2005 16:09:32 +0000 |
parents | c9ad0d9c7d59 |
children | 511a89da35ad |
comparison
equal
deleted
inserted
replaced
538:4f43cd2c4558 | 539:371c1cee100d |
---|---|
9 #include <ngx_event.h> | 9 #include <ngx_event.h> |
10 #include <ngx_http.h> | 10 #include <ngx_http.h> |
11 | 11 |
12 | 12 |
13 static void ngx_http_init_request(ngx_event_t *ev); | 13 static void ngx_http_init_request(ngx_event_t *ev); |
14 #if (NGX_HTTP_SSL) | |
15 static void ngx_http_ssl_handshake(ngx_event_t *rev); | |
16 #endif | |
17 static void ngx_http_process_request_line(ngx_event_t *rev); | 14 static void ngx_http_process_request_line(ngx_event_t *rev); |
18 static void ngx_http_process_request_headers(ngx_event_t *rev); | 15 static void ngx_http_process_request_headers(ngx_event_t *rev); |
19 static ssize_t ngx_http_read_request_header(ngx_http_request_t *r); | 16 static ssize_t ngx_http_read_request_header(ngx_http_request_t *r); |
20 static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r, | 17 static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r, |
21 ngx_uint_t request_line); | 18 ngx_uint_t request_line); |
47 static void ngx_http_close_connection(ngx_connection_t *c); | 44 static void ngx_http_close_connection(ngx_connection_t *c); |
48 | 45 |
49 static u_char *ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len); | 46 static u_char *ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len); |
50 static u_char *ngx_http_log_error_handler(ngx_http_request_t *r, u_char *buf, | 47 static u_char *ngx_http_log_error_handler(ngx_http_request_t *r, u_char *buf, |
51 size_t len); | 48 size_t len); |
49 | |
50 #if (NGX_HTTP_SSL) | |
51 static void ngx_http_ssl_handshake(ngx_event_t *rev); | |
52 static void ngx_http_ssl_close_handler(ngx_event_t *ev); | |
53 #endif | |
52 | 54 |
53 | 55 |
54 static char *ngx_http_client_errors[] = { | 56 static char *ngx_http_client_errors[] = { |
55 | 57 |
56 /* NGX_HTTP_PARSE_INVALID_METHOD */ | 58 /* NGX_HTTP_PARSE_INVALID_METHOD */ |
488 if (buf[0] == 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) { | 490 if (buf[0] == 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) { |
489 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, | 491 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, |
490 "https ssl handshake: 0x%02Xd", buf[0]); | 492 "https ssl handshake: 0x%02Xd", buf[0]); |
491 | 493 |
492 c->recv = ngx_ssl_recv; | 494 c->recv = ngx_ssl_recv; |
495 c->send = ngx_ssl_write; | |
493 c->send_chain = ngx_ssl_send_chain; | 496 c->send_chain = ngx_ssl_send_chain; |
494 | 497 |
495 rc = ngx_ssl_handshake(c); | 498 rc = ngx_ssl_handshake(c); |
496 | 499 |
497 if (rc == NGX_ERROR) { | 500 if (rc == NGX_ERROR) { |
2410 | 2413 |
2411 ngx_destroy_pool(r->pool); | 2414 ngx_destroy_pool(r->pool); |
2412 } | 2415 } |
2413 | 2416 |
2414 | 2417 |
2415 #if (NGX_HTTP_SSL) | |
2416 | |
2417 static void | |
2418 ngx_http_ssl_close_handler(ngx_event_t *ev) | |
2419 { | |
2420 ngx_connection_t *c; | |
2421 | |
2422 c = ev->data; | |
2423 | |
2424 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ev->log, 0, "http ssl close handler"); | |
2425 | |
2426 if (ngx_ssl_shutdown(c) == NGX_AGAIN) { | |
2427 return; | |
2428 } | |
2429 | |
2430 ngx_http_close_connection(c); | |
2431 } | |
2432 | |
2433 #endif | |
2434 | |
2435 | |
2436 static void | 2418 static void |
2437 ngx_http_close_connection(ngx_connection_t *c) | 2419 ngx_http_close_connection(ngx_connection_t *c) |
2438 { | 2420 { |
2439 ngx_pool_t *pool; | 2421 ngx_pool_t *pool; |
2440 | 2422 |
2441 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 2423 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
2442 "close http connection: %d", c->fd); | 2424 "close http connection: %d", c->fd); |
2443 | 2425 |
2444 #if (NGX_OPENSSL) | 2426 #if (NGX_HTTP_SSL) |
2445 | 2427 |
2446 if (c->ssl) { | 2428 if (c->ssl) { |
2447 if (ngx_ssl_shutdown(c) == NGX_AGAIN) { | 2429 if (ngx_ssl_shutdown(c) == NGX_AGAIN) { |
2448 c->read->handler = ngx_http_ssl_close_handler; | 2430 c->read->handler = ngx_http_ssl_close_handler; |
2449 c->write->handler = ngx_http_ssl_close_handler; | 2431 c->write->handler = ngx_http_ssl_close_handler; |
2461 | 2443 |
2462 ngx_close_connection(c); | 2444 ngx_close_connection(c); |
2463 | 2445 |
2464 ngx_destroy_pool(pool); | 2446 ngx_destroy_pool(pool); |
2465 } | 2447 } |
2448 | |
2449 | |
2450 #if (NGX_HTTP_SSL) | |
2451 | |
2452 static void | |
2453 ngx_http_ssl_close_handler(ngx_event_t *ev) | |
2454 { | |
2455 ngx_connection_t *c; | |
2456 | |
2457 c = ev->data; | |
2458 | |
2459 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ev->log, 0, "http ssl close handler"); | |
2460 | |
2461 if (ngx_ssl_shutdown(c) == NGX_AGAIN) { | |
2462 return; | |
2463 } | |
2464 | |
2465 ngx_http_close_connection(c); | |
2466 } | |
2467 | |
2468 #endif | |
2466 | 2469 |
2467 | 2470 |
2468 static u_char * | 2471 static u_char * |
2469 ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len) | 2472 ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len) |
2470 { | 2473 { |