comparison src/http/ngx_http_event.c @ 99:a059e1aa65d4

nginx-0.0.1-2003-06-02-19:24:30 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 02 Jun 2003 15:24:30 +0000
parents a23d010f356d
children 7ebc8b7fb816
comparison
equal deleted inserted replaced
98:c9b243802a17 99:a059e1aa65d4
1 1
2 #include <ngx_config.h> 2 #include <ngx_config.h>
3 #include <ngx_core.h> 3 #include <ngx_core.h>
4 #include <ngx_string.h>
5 #include <ngx_files.h>
6 #include <ngx_log.h>
7 #include <ngx_alloc.h>
8 #include <ngx_array.h>
9 #include <ngx_table.h>
10 #include <ngx_hunk.h>
11 #include <ngx_connection.h>
12 #include <ngx_event.h> 4 #include <ngx_event.h>
13 #include <ngx_event_timer.h>
14 #include <ngx_inet.h>
15 #include <ngx_http.h> 5 #include <ngx_http.h>
16 #include <ngx_http_config.h>
17 #include <ngx_http_core_module.h>
18 #include <ngx_http_output_filter.h>
19 6
20 7
21 static void ngx_http_init_request(ngx_event_t *ev); 8 static void ngx_http_init_request(ngx_event_t *ev);
22 static void ngx_http_process_request_line(ngx_event_t *rev); 9 static void ngx_http_process_request_line(ngx_event_t *rev);
23 static void ngx_http_process_request_headers(ngx_event_t *rev); 10 static void ngx_http_process_request_headers(ngx_event_t *rev);
61 { ngx_string("If-Modified-Since"), 48 { ngx_string("If-Modified-Since"),
62 offsetof(ngx_http_headers_in_t, if_modified_since) }, 49 offsetof(ngx_http_headers_in_t, if_modified_since) },
63 { ngx_string("Content-Length"), 50 { ngx_string("Content-Length"),
64 offsetof(ngx_http_headers_in_t, content_length) }, 51 offsetof(ngx_http_headers_in_t, content_length) },
65 52
53 { ngx_string("Range"), offsetof(ngx_http_headers_in_t, range) },
66 #if 0 54 #if 0
55 { ngx_string("If-Range"), offsetof(ngx_http_headers_in_t, if_range) },
56 #endif
67 57
68 { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent) }, 58 { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent) },
69
70 #endif
71 59
72 { ngx_null_string, 0 } 60 { ngx_null_string, 0 }
73 }; 61 };
74 62
75 63
287 275
288 if (rc == NGX_OK) { 276 if (rc == NGX_OK) {
289 277
290 /* the request line has been parsed successfully */ 278 /* the request line has been parsed successfully */
291 279
280 /* STUB: we need to handle such URIs */
281 if (r->complex_uri || r->unusual_uri) {
282 ngx_http_header_parse_error(r, NGX_HTTP_PARSE_INVALID_REQUEST);
283 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
284 return;
285 }
286
292 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 287 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
293 288
294 if (r->http_version >= NGX_HTTP_VERSION_10 289 if (r->http_version >= NGX_HTTP_VERSION_10
295 && cscf->large_client_header == 0 290 && cscf->large_client_header == 0
296 && r->header_in->pos == r->header_in->end) 291 && r->header_in->pos == r->header_in->end)
400 r->uri.data _ r->exten.data _ r->args.data); 395 r->uri.data _ r->exten.data _ r->args.data);
401 if (r->exten.data[0] == '\0') { r->exten.data = NULL; } 396 if (r->exten.data[0] == '\0') { r->exten.data = NULL; }
402 if (r->args.data[0] == '\0') { r->args.data = NULL; } 397 if (r->args.data[0] == '\0') { r->args.data = NULL; }
403 #endif 398 #endif
404 399
405 if (r->http_version == NGX_HTTP_VERSION_9) { 400 if (r->http_version < NGX_HTTP_VERSION_10) {
406 rev->event_handler = ngx_http_block_read; 401 rev->event_handler = ngx_http_block_read;
407 ngx_http_handler(r); 402 ngx_http_handler(r);
408 return; 403 return;
409 } 404 }
410 405
1434 1429
1435 static size_t ngx_http_log_error(void *data, char *buf, size_t len) 1430 static size_t ngx_http_log_error(void *data, char *buf, size_t len)
1436 { 1431 {
1437 ngx_http_log_ctx_t *ctx = (ngx_http_log_ctx_t *) data; 1432 ngx_http_log_ctx_t *ctx = (ngx_http_log_ctx_t *) data;
1438 1433
1439 if (ctx->url) { 1434 if (ctx->action && ctx->url) {
1440 return ngx_snprintf(buf, len, " while %s, client: %s, URL: %s", 1435 return ngx_snprintf(buf, len, " while %s, client: %s, URL: %s",
1441 ctx->action, ctx->client, ctx->url); 1436 ctx->action, ctx->client, ctx->url);
1437
1438 } else if (ctx->action == NULL && ctx->url) {
1439 return ngx_snprintf(buf, len, ", client: %s, URL: %s",
1440 ctx->client, ctx->url);
1441
1442 } else { 1442 } else {
1443 return ngx_snprintf(buf, len, " while %s, client: %s", 1443 return ngx_snprintf(buf, len, " while %s, client: %s",
1444 ctx->action, ctx->client); 1444 ctx->action, ctx->client);
1445 } 1445 }
1446 } 1446 }