comparison src/http/ngx_http_request.c @ 416:b9bd635011de

nginx-0.0.10-2004-09-06-22:45:00 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 06 Sep 2004 18:45:00 +0000
parents 3c56e834be46
children 0526206251f6
comparison
equal deleted inserted replaced
415:3c56e834be46 416:b9bd635011de
44 "client %s sent HTTP/1.1 request without \"Host\" header, URL: %s", 44 "client %s sent HTTP/1.1 request without \"Host\" header, URL: %s",
45 "client %s sent invalid \"Content-Length\" header, URL: %s", 45 "client %s sent invalid \"Content-Length\" header, URL: %s",
46 "client %s sent POST method without \"Content-Length\" header, URL: %s", 46 "client %s sent POST method without \"Content-Length\" header, URL: %s",
47 "client %s sent plain HTTP request to HTTPS port, URL: %s", 47 "client %s sent plain HTTP request to HTTPS port, URL: %s",
48 "client %s sent invalid \"Host\" header \"%s\", URL: %s" 48 "client %s sent invalid \"Host\" header \"%s\", URL: %s"
49 };
50
51
52 ngx_http_header_t ngx_http_headers_in[] = {
53 { ngx_string("Host"), offsetof(ngx_http_headers_in_t, host) },
54 { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection) },
55 { ngx_string("If-Modified-Since"),
56 offsetof(ngx_http_headers_in_t, if_modified_since) },
57 { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent) },
58 { ngx_string("Referer"), offsetof(ngx_http_headers_in_t, referer) },
59 { ngx_string("Content-Length"),
60 offsetof(ngx_http_headers_in_t, content_length) },
61
62 { ngx_string("Range"), offsetof(ngx_http_headers_in_t, range) },
63 #if 0
64 { ngx_string("If-Range"), offsetof(ngx_http_headers_in_t, if_range) },
65 #endif
66
67 #if (NGX_HTTP_GZIP)
68 { ngx_string("Accept-Encoding"),
69 offsetof(ngx_http_headers_in_t, accept_encoding) },
70 { ngx_string("Via"), offsetof(ngx_http_headers_in_t, via) },
71 #endif
72
73 { ngx_string("Authorization"),
74 offsetof(ngx_http_headers_in_t, authorization) },
75
76 { ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive) },
77
78 #if (NGX_HTTP_PROXY)
79 { ngx_string("X-Forwarded-For"),
80 offsetof(ngx_http_headers_in_t, x_forwarded_for) },
81 #endif
82
83 { ngx_null_string, 0 }
49 }; 84 };
50 85
51 86
52 #if 0 87 #if 0
53 static void ngx_http_dummy(ngx_event_t *wev) 88 static void ngx_http_dummy(ngx_event_t *wev)
308 r->cleanup.nalloc = 5; 343 r->cleanup.nalloc = 5;
309 r->cleanup.size = sizeof(ngx_http_cleanup_t); 344 r->cleanup.size = sizeof(ngx_http_cleanup_t);
310 r->cleanup.pool = r->pool; 345 r->cleanup.pool = r->pool;
311 346
312 347
313 if (ngx_init_list(&r->headers_out.headers, r->pool, 2, 348 if (ngx_list_init(&r->headers_out.headers, r->pool, 20,
314 sizeof(ngx_table_elt_t)) == NGX_ERROR) 349 sizeof(ngx_table_elt_t)) == NGX_ERROR)
315 { 350 {
316 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 351 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
317 ngx_http_close_connection(c); 352 ngx_http_close_connection(c);
318 return; 353 return;
319 } 354 }
320
321
322 #if 0
323 /* init the r->headers_out.headers table */
324
325 r->headers_out.headers.elts = ngx_pcalloc(r->pool,
326 20 * sizeof(ngx_table_elt_t));
327 if (r->headers_out.headers.elts == NULL) {
328 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
329 ngx_http_close_connection(c);
330 return;
331 }
332 /* r->headers_out.headers.nelts = 0; */
333 r->headers_out.headers.nalloc = 20;
334 r->headers_out.headers.size = sizeof(ngx_table_elt_t);
335 r->headers_out.headers.pool = r->pool;
336 #endif
337 355
338 356
339 r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module); 357 r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
340 if (r->ctx == NULL) { 358 if (r->ctx == NULL) {
341 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 359 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
617 ngx_http_handler(r); 635 ngx_http_handler(r);
618 return; 636 return;
619 } 637 }
620 638
621 639
622 if (ngx_init_list(&r->headers_in.headers, r->pool, 2, 640 if (ngx_list_init(&r->headers_in.headers, r->pool, 20,
623 sizeof(ngx_table_elt_t)) == NGX_ERROR) 641 sizeof(ngx_table_elt_t)) == NGX_ERROR)
624 { 642 {
625 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 643 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
626 ngx_http_close_connection(c); 644 ngx_http_close_connection(c);
627 return; 645 return;
628 } 646 }
629 647
630 648
631 if (ngx_init_array0(&r->headers_in.cookies, r->pool, 5, 649 if (ngx_array_init(&r->headers_in.cookies, r->pool, 5,
632 sizeof(ngx_table_elt_t *)) == NGX_ERROR) 650 sizeof(ngx_table_elt_t *)) == NGX_ERROR)
633 { 651 {
634 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 652 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
635 ngx_http_close_connection(c); 653 ngx_http_close_connection(c);
636 return; 654 return;
770 788
771 /* a header line has been parsed successfully */ 789 /* a header line has been parsed successfully */
772 790
773 r->headers_n++; 791 r->headers_n++;
774 792
775 if (!(h = ngx_push_list(&r->headers_in.headers))) { 793 if (!(h = ngx_list_push(&r->headers_in.headers))) {
776 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 794 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
777 ngx_http_close_connection(c); 795 ngx_http_close_connection(c);
778 return; 796 return;
779 } 797 }
780 798