Mercurial > hg > nginx
annotate src/http/ngx_http_header_filter_module.c @ 2724:9fd2f12fee0a
fix Win32 ngx_gettimezone()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 19 Apr 2009 19:08:49 +0000 |
parents | 7dc6ebe26e99 |
children | e4a4c889694f |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
5 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
6 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
7 #include <ngx_config.h> |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
8 #include <ngx_core.h> |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
9 #include <ngx_http.h> |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
2
diff
changeset
|
10 #include <nginx.h> |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
2
diff
changeset
|
11 |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
681 | 13 static ngx_int_t ngx_http_header_filter_init(ngx_conf_t *cf); |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
14 static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r); |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
15 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
16 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
17 static ngx_http_module_t ngx_http_header_filter_module_ctx = { |
509 | 18 NULL, /* preconfiguration */ |
681 | 19 ngx_http_header_filter_init, /* postconfiguration */ |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
20 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
21 NULL, /* create main configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
22 NULL, /* init main configuration */ |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
23 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
24 NULL, /* create server configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
25 NULL, /* merge server configuration */ |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
26 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
27 NULL, /* create location configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
28 NULL, /* merge location configuration */ |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
29 }; |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
30 |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
32 ngx_module_t ngx_http_header_filter_module = { |
509 | 33 NGX_MODULE_V1, |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
34 &ngx_http_header_filter_module_ctx, /* module context */ |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
35 NULL, /* module directives */ |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
36 NGX_HTTP_MODULE, /* module type */ |
541 | 37 NULL, /* init master */ |
681 | 38 NULL, /* init module */ |
541 | 39 NULL, /* init process */ |
40 NULL, /* init thread */ | |
41 NULL, /* exit thread */ | |
42 NULL, /* exit process */ | |
43 NULL, /* exit master */ | |
44 NGX_MODULE_V1_PADDING | |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
45 }; |
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
46 |
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
47 |
1592 | 48 static char ngx_http_server_string[] = "Server: nginx" CRLF; |
49 static char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF; | |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
50 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
51 |
509 | 52 static ngx_str_t ngx_http_status_lines[] = { |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
53 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
54 ngx_string("200 OK"), |
633 | 55 ngx_string("201 Created"), |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
56 ngx_null_string, /* "202 Accepted" */ |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
57 ngx_null_string, /* "203 Non-Authoritative Information" */ |
511 | 58 ngx_string("204 No Content"), |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
59 ngx_null_string, /* "205 Reset Content" */ |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
60 ngx_string("206 Partial Content"), |
499 | 61 |
62 /* ngx_null_string, */ /* "207 Multi-Status" */ | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
63 |
2696 | 64 #define NGX_HTTP_LAST_LEVEL_200 207 |
65 #define NGX_HTTP_LEVEL_200 (NGX_HTTP_LAST_LEVEL_200 - 200) | |
499 | 66 |
67 /* ngx_null_string, */ /* "300 Multiple Choices" */ | |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
68 |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
69 ngx_string("301 Moved Permanently"), |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
70 ngx_string("302 Moved Temporarily"), |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
71 ngx_null_string, /* "303 See Other" */ |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
72 ngx_string("304 Not Modified"), |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
73 |
499 | 74 /* ngx_null_string, */ /* "305 Use Proxy" */ |
75 /* ngx_null_string, */ /* "306 unused" */ | |
76 /* ngx_null_string, */ /* "307 Temporary Redirect" */ | |
77 | |
2696 | 78 #define NGX_HTTP_LAST_LEVEL_300 305 |
79 #define NGX_HTTP_LEVEL_300 (NGX_HTTP_LAST_LEVEL_300 - 301) | |
499 | 80 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
81 ngx_string("400 Bad Request"), |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
82 ngx_string("401 Unauthorized"), |
499 | 83 ngx_string("402 Payment Required"), |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
84 ngx_string("403 Forbidden"), |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
85 ngx_string("404 Not Found"), |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
86 ngx_string("405 Not Allowed"), |
499 | 87 ngx_string("406 Not Acceptable"), |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
88 ngx_null_string, /* "407 Proxy Authentication Required" */ |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
89 ngx_string("408 Request Time-out"), |
663 | 90 ngx_string("409 Conflict"), |
499 | 91 ngx_string("410 Gone"), |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
92 ngx_string("411 Length Required"), |
1057 | 93 ngx_string("412 Precondition Failed"), |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
94 ngx_string("413 Request Entity Too Large"), |
499 | 95 ngx_null_string, /* "414 Request-URI Too Large", but we never send it |
238
674f85a4d00f
nginx-0.0.1-2004-01-23-12:26:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
96 * because we treat such requests as the HTTP/0.9 |
674f85a4d00f
nginx-0.0.1-2004-01-23-12:26:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
97 * requests and send only a body without a header |
674f85a4d00f
nginx-0.0.1-2004-01-23-12:26:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
98 */ |
637 | 99 ngx_string("415 Unsupported Media Type"), |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
100 ngx_string("416 Requested Range Not Satisfiable"), |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
101 |
499 | 102 /* ngx_null_string, */ /* "417 Expectation Failed" */ |
103 /* ngx_null_string, */ /* "418 unused" */ | |
104 /* ngx_null_string, */ /* "419 unused" */ | |
105 /* ngx_null_string, */ /* "420 unused" */ | |
106 /* ngx_null_string, */ /* "421 unused" */ | |
107 /* ngx_null_string, */ /* "422 Unprocessable Entity" */ | |
108 /* ngx_null_string, */ /* "423 Locked" */ | |
109 /* ngx_null_string, */ /* "424 Failed Dependency" */ | |
110 | |
2696 | 111 #define NGX_HTTP_LAST_LEVEL_400 417 |
112 #define NGX_HTTP_LEVEL_400 (NGX_HTTP_LAST_LEVEL_400 - 400) | |
499 | 113 |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
114 ngx_string("500 Internal Server Error"), |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
115 ngx_string("501 Method Not Implemented"), |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
116 ngx_string("502 Bad Gateway"), |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
117 ngx_string("503 Service Temporarily Unavailable"), |
637 | 118 ngx_string("504 Gateway Time-out"), |
499 | 119 |
637 | 120 ngx_null_string, /* "505 HTTP Version Not Supported" */ |
121 ngx_null_string, /* "506 Variant Also Negotiates" */ | |
122 ngx_string("507 Insufficient Storage"), | |
499 | 123 /* ngx_null_string, */ /* "508 unused" */ |
124 /* ngx_null_string, */ /* "509 unused" */ | |
125 /* ngx_null_string, */ /* "510 Not Extended" */ | |
2696 | 126 |
127 #define NGX_HTTP_LAST_LEVEL_500 508 | |
128 | |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
129 }; |
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
130 |
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
131 |
569 | 132 ngx_http_header_out_t ngx_http_headers_out[] = { |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
133 { ngx_string("Server"), offsetof(ngx_http_headers_out_t, server) }, |
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
134 { ngx_string("Date"), offsetof(ngx_http_headers_out_t, date) }, |
509 | 135 #if 0 |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
136 { ngx_string("Content-Type"), |
499 | 137 offsetof(ngx_http_headers_out_t, content_type) }, |
509 | 138 #endif |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
139 { ngx_string("Content-Length"), |
499 | 140 offsetof(ngx_http_headers_out_t, content_length) }, |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
141 { ngx_string("Content-Encoding"), |
499 | 142 offsetof(ngx_http_headers_out_t, content_encoding) }, |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
143 { ngx_string("Location"), offsetof(ngx_http_headers_out_t, location) }, |
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
144 { ngx_string("Last-Modified"), |
499 | 145 offsetof(ngx_http_headers_out_t, last_modified) }, |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
146 { ngx_string("Accept-Ranges"), |
499 | 147 offsetof(ngx_http_headers_out_t, accept_ranges) }, |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
148 { ngx_string("Expires"), offsetof(ngx_http_headers_out_t, expires) }, |
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
149 { ngx_string("Cache-Control"), |
499 | 150 offsetof(ngx_http_headers_out_t, cache_control) }, |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
151 { ngx_string("ETag"), offsetof(ngx_http_headers_out_t, etag) }, |
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
152 |
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
153 { ngx_null_string, 0 } |
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
154 }; |
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
155 |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
156 |
493 | 157 static ngx_int_t |
158 ngx_http_header_filter(ngx_http_request_t *r) | |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
159 { |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
160 u_char *p; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
161 size_t len; |
2696 | 162 ngx_str_t host, *status_line; |
681 | 163 ngx_buf_t *b; |
2529 | 164 ngx_uint_t status, i, port; |
501 | 165 ngx_chain_t out; |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
166 ngx_list_part_t *part; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
167 ngx_table_elt_t *header; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
168 ngx_http_core_loc_conf_t *clcf; |
1811 | 169 ngx_http_core_srv_conf_t *cscf; |
2529 | 170 struct sockaddr_in *sin; |
171 #if (NGX_HAVE_INET6) | |
172 struct sockaddr_in6 *sin6; | |
173 #endif | |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2197
diff
changeset
|
174 u_char addr[NGX_SOCKADDR_STRLEN]; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
175 |
667 | 176 r->header_sent = 1; |
177 | |
597 | 178 if (r != r->main) { |
509 | 179 return NGX_OK; |
180 } | |
181 | |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
182 if (r->http_version < NGX_HTTP_VERSION_10) { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
183 return NGX_OK; |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
184 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
185 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
186 if (r->method == NGX_HTTP_HEAD) { |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
187 r->header_only = 1; |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
188 } |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
189 |
432
11362a3e3911
nginx-0.0.11-2004-09-21-09:38:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
429
diff
changeset
|
190 if (r->headers_out.last_modified_time != -1) { |
11362a3e3911
nginx-0.0.11-2004-09-21-09:38:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
429
diff
changeset
|
191 if (r->headers_out.status != NGX_HTTP_OK |
511 | 192 && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT |
193 && r->headers_out.status != NGX_HTTP_NOT_MODIFIED) | |
432
11362a3e3911
nginx-0.0.11-2004-09-21-09:38:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
429
diff
changeset
|
194 { |
11362a3e3911
nginx-0.0.11-2004-09-21-09:38:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
429
diff
changeset
|
195 r->headers_out.last_modified_time = -1; |
11362a3e3911
nginx-0.0.11-2004-09-21-09:38:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
429
diff
changeset
|
196 r->headers_out.last_modified = NULL; |
11362a3e3911
nginx-0.0.11-2004-09-21-09:38:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
429
diff
changeset
|
197 } |
11362a3e3911
nginx-0.0.11-2004-09-21-09:38:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
429
diff
changeset
|
198 } |
11362a3e3911
nginx-0.0.11-2004-09-21-09:38:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
429
diff
changeset
|
199 |
493 | 200 len = sizeof("HTTP/1.x ") - 1 + sizeof(CRLF) - 1 |
201 /* the end of the header */ | |
202 + sizeof(CRLF) - 1; | |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
203 |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
204 /* status line */ |
452 | 205 |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
206 if (r->headers_out.status_line.len) { |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
207 len += r->headers_out.status_line.len; |
2696 | 208 status_line = &r->headers_out.status_line; |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
209 #if (NGX_SUPPRESS_WARN) |
2696 | 210 status = 0; |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
211 #endif |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
212 |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
213 } else { |
178
a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
214 |
2696 | 215 status = r->headers_out.status; |
216 | |
217 if (status >= NGX_HTTP_OK | |
218 && status < NGX_HTTP_LAST_LEVEL_200) | |
219 { | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
220 /* 2XX */ |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
221 |
2696 | 222 if (status == NGX_HTTP_NO_CONTENT) { |
511 | 223 r->header_only = 1; |
224 r->headers_out.content_type.len = 0; | |
225 r->headers_out.content_type.data = NULL; | |
226 r->headers_out.last_modified_time = -1; | |
227 r->headers_out.last_modified = NULL; | |
228 r->headers_out.content_length = NULL; | |
229 r->headers_out.content_length_n = -1; | |
230 } | |
231 | |
2696 | 232 status -= NGX_HTTP_OK; |
233 status_line = &ngx_http_status_lines[status]; | |
234 len += ngx_http_status_lines[status].len; | |
235 | |
236 } else if (status >= NGX_HTTP_MOVED_PERMANENTLY | |
237 && status < NGX_HTTP_LAST_LEVEL_300) | |
238 { | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
239 /* 3XX */ |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
240 |
2696 | 241 if (status == NGX_HTTP_NOT_MODIFIED) { |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
242 r->header_only = 1; |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
243 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
244 |
2696 | 245 status = status - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_LEVEL_200; |
246 status_line = &ngx_http_status_lines[status]; | |
247 len += ngx_http_status_lines[status].len; | |
248 | |
249 } else if (status >= NGX_HTTP_BAD_REQUEST | |
2700
aee784753144
style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
2696
diff
changeset
|
250 && status < NGX_HTTP_LAST_LEVEL_400) |
2696 | 251 { |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
252 /* 4XX */ |
2696 | 253 status = status - NGX_HTTP_BAD_REQUEST |
254 + NGX_HTTP_LEVEL_200 | |
255 + NGX_HTTP_LEVEL_300; | |
256 | |
257 status_line = &ngx_http_status_lines[status]; | |
258 len += ngx_http_status_lines[status].len; | |
259 | |
260 } else if (status >= NGX_HTTP_INTERNAL_SERVER_ERROR | |
261 && status < NGX_HTTP_LAST_LEVEL_500) | |
262 { | |
263 /* 5XX */ | |
264 status = status - NGX_HTTP_INTERNAL_SERVER_ERROR | |
265 + NGX_HTTP_LEVEL_200 | |
266 + NGX_HTTP_LEVEL_300 | |
267 + NGX_HTTP_LEVEL_400; | |
268 | |
269 status_line = &ngx_http_status_lines[status]; | |
270 len += ngx_http_status_lines[status].len; | |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
271 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
272 } else { |
2696 | 273 len += NGX_INT_T_LEN; |
274 status_line = NULL; | |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
275 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
276 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
277 |
1592 | 278 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
279 | |
509 | 280 if (r->headers_out.server == NULL) { |
1592 | 281 len += clcf->server_tokens ? sizeof(ngx_http_server_full_string) - 1: |
282 sizeof(ngx_http_server_string) - 1; | |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
283 } |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
284 |
509 | 285 if (r->headers_out.date == NULL) { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
286 len += sizeof("Date: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
287 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
288 |
509 | 289 if (r->headers_out.content_type.len) { |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
290 len += sizeof("Content-Type: ") - 1 |
509 | 291 + r->headers_out.content_type.len + 2; |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
292 |
657 | 293 if (r->headers_out.content_type_len == r->headers_out.content_type.len |
294 && r->headers_out.charset.len) | |
295 { | |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
296 len += sizeof("; charset=") - 1 + r->headers_out.charset.len; |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
297 } |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
298 } |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
299 |
509 | 300 if (r->headers_out.content_length == NULL |
301 && r->headers_out.content_length_n >= 0) | |
302 { | |
303 len += sizeof("Content-Length: ") - 1 + NGX_OFF_T_LEN + 2; | |
304 } | |
305 | |
306 if (r->headers_out.last_modified == NULL | |
307 && r->headers_out.last_modified_time != -1) | |
308 { | |
309 len += sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1; | |
310 } | |
311 | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
312 if (r->headers_out.location |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
313 && r->headers_out.location->value.len |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
314 && r->headers_out.location->value.data[0] == '/') |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
315 { |
509 | 316 r->headers_out.location->hash = 0; |
317 | |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
318 if (clcf->server_name_in_redirect) { |
1811 | 319 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
320 host = cscf->server_name; | |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
321 |
2007
b9de93d804ea
*) host in request line has priority
Igor Sysoev <igor@sysoev.ru>
parents:
1811
diff
changeset
|
322 } else if (r->headers_in.server.len) { |
b9de93d804ea
*) host in request line has priority
Igor Sysoev <igor@sysoev.ru>
parents:
1811
diff
changeset
|
323 host = r->headers_in.server; |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
324 |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
325 } else { |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2197
diff
changeset
|
326 host.len = NGX_SOCKADDR_STRLEN; |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
327 host.data = addr; |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
328 |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
329 if (ngx_http_server_addr(r, &host) != NGX_OK) { |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
330 return NGX_ERROR; |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
331 } |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
332 } |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
333 |
2532 | 334 switch (r->connection->local_sockaddr->sa_family) { |
2529 | 335 |
336 #if (NGX_HAVE_INET6) | |
337 case AF_INET6: | |
2532 | 338 sin6 = (struct sockaddr_in6 *) r->connection->local_sockaddr; |
2531 | 339 port = ntohs(sin6->sin6_port); |
2529 | 340 break; |
341 #endif | |
342 default: /* AF_INET */ | |
2532 | 343 sin = (struct sockaddr_in *) r->connection->local_sockaddr; |
2531 | 344 port = ntohs(sin->sin_port); |
2529 | 345 break; |
346 } | |
347 | |
2533 | 348 len += sizeof("Location: https://") - 1 |
349 + host.len | |
350 + r->headers_out.location->value.len + 2; | |
517 | 351 |
2533 | 352 if (clcf->port_in_redirect) { |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
353 |
2533 | 354 #if (NGX_HTTP_SSL) |
2551 | 355 if (r->connection->ssl) |
356 port = (port == 443) ? 0 : port; | |
357 else | |
517 | 358 #endif |
2551 | 359 port = (port == 80) ? 0 : port; |
360 } | |
517 | 361 |
2533 | 362 if (port) { |
363 len += sizeof(":65535") - 1; | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
364 } |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
365 |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
366 } else { |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
367 host.len = 0; |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
368 host.data = NULL; |
2529 | 369 port = 0; |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
370 } |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
10
diff
changeset
|
371 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
372 if (r->chunked) { |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
373 len += sizeof("Transfer-Encoding: chunked" CRLF) - 1; |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
374 } |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
375 |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
376 if (r->keepalive) { |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
377 len += sizeof("Connection: keep-alive" CRLF) - 1; |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
378 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
379 /* |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
380 * MSIE and Opera ignore the "Keep-Alive: timeout=<N>" header. |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
381 * MSIE keeps the connection alive for about 60-65 seconds. |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
382 * Opera keeps the connection alive very long. |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
383 * Mozilla keeps the connection alive for N plus about 1-10 seconds. |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
384 * Konqueror keeps the connection alive for about N seconds. |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
385 */ |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
386 |
473 | 387 if (clcf->keepalive_header) { |
477 | 388 len += sizeof("Keep-Alive: timeout=") - 1 + NGX_TIME_T_LEN + 2; |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
389 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
390 |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
391 } else { |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
392 len += sizeof("Connection: closed" CRLF) - 1; |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
393 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
394 |
2081
8488178092f2
nginx could not be build without gzip, introduced in r2052
Igor Sysoev <igor@sysoev.ru>
parents:
2051
diff
changeset
|
395 #if (NGX_HTTP_GZIP) |
2051
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
396 if (r->gzip && clcf->gzip_vary) { |
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
397 len += sizeof("Vary: Accept-Encoding" CRLF) - 1; |
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
398 } |
2081
8488178092f2
nginx could not be build without gzip, introduced in r2052
Igor Sysoev <igor@sysoev.ru>
parents:
2051
diff
changeset
|
399 #endif |
2051
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
400 |
415
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
401 part = &r->headers_out.headers.part; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
402 header = part->elts; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
403 |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
404 for (i = 0; /* void */; i++) { |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
405 |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
406 if (i >= part->nelts) { |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
407 if (part->next == NULL) { |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
408 break; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
409 } |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
410 |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
411 part = part->next; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
412 header = part->elts; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
413 i = 0; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
414 } |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
415 |
509 | 416 if (header[i].hash == 0) { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
417 continue; |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
418 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
419 |
493 | 420 len += header[i].key.len + sizeof(": ") - 1 + header[i].value.len |
421 + sizeof(CRLF) - 1; | |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
422 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
423 |
501 | 424 b = ngx_create_temp_buf(r->pool, len); |
425 if (b == NULL) { | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
426 return NGX_ERROR; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
427 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
428 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
429 /* "HTTP/1.x " */ |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
430 b->last = ngx_cpymem(b->last, "HTTP/1.1 ", sizeof("HTTP/1.x ") - 1); |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
431 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
432 /* status line */ |
2696 | 433 if (status_line) { |
434 b->last = ngx_copy(b->last, status_line->data, status_line->len); | |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
435 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
436 } else { |
2696 | 437 b->last = ngx_sprintf(b->last, "%ui", status); |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
438 } |
493 | 439 *b->last++ = CR; *b->last++ = LF; |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
440 |
509 | 441 if (r->headers_out.server == NULL) { |
1592 | 442 if (clcf->server_tokens) { |
1594 | 443 p = (u_char *) ngx_http_server_full_string; |
1592 | 444 len = sizeof(ngx_http_server_full_string) - 1; |
445 | |
446 } else { | |
1594 | 447 p = (u_char *) ngx_http_server_string; |
1592 | 448 len = sizeof(ngx_http_server_string) - 1; |
449 } | |
450 | |
451 b->last = ngx_cpymem(b->last, p, len); | |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
452 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
453 |
509 | 454 if (r->headers_out.date == NULL) { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
455 b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1); |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
456 b->last = ngx_cpymem(b->last, ngx_cached_http_time.data, |
178
a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
457 ngx_cached_http_time.len); |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
458 |
493 | 459 *b->last++ = CR; *b->last++ = LF; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
460 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
461 |
509 | 462 if (r->headers_out.content_type.len) { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
463 b->last = ngx_cpymem(b->last, "Content-Type: ", |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
464 sizeof("Content-Type: ") - 1); |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
465 p = b->last; |
573 | 466 b->last = ngx_copy(b->last, r->headers_out.content_type.data, |
467 r->headers_out.content_type.len); | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
468 |
657 | 469 if (r->headers_out.content_type_len == r->headers_out.content_type.len |
470 && r->headers_out.charset.len) | |
471 { | |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
472 b->last = ngx_cpymem(b->last, "; charset=", |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
473 sizeof("; charset=") - 1); |
573 | 474 b->last = ngx_copy(b->last, r->headers_out.charset.data, |
475 r->headers_out.charset.len); | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
476 |
509 | 477 /* update r->headers_out.content_type for possible logging */ |
478 | |
479 r->headers_out.content_type.len = b->last - p; | |
480 r->headers_out.content_type.data = p; | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
481 } |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
482 |
493 | 483 *b->last++ = CR; *b->last++ = LF; |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
484 } |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
485 |
509 | 486 if (r->headers_out.content_length == NULL |
487 && r->headers_out.content_length_n >= 0) | |
488 { | |
489 b->last = ngx_sprintf(b->last, "Content-Length: %O" CRLF, | |
490 r->headers_out.content_length_n); | |
491 } | |
492 | |
493 if (r->headers_out.last_modified == NULL | |
494 && r->headers_out.last_modified_time != -1) | |
495 { | |
496 b->last = ngx_cpymem(b->last, "Last-Modified: ", | |
497 sizeof("Last-Modified: ") - 1); | |
498 b->last = ngx_http_time(b->last, r->headers_out.last_modified_time); | |
499 | |
500 *b->last++ = CR; *b->last++ = LF; | |
501 } | |
502 | |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
503 if (host.data) { |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
504 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
505 p = b->last + sizeof("Location: ") - 1; |
517 | 506 |
507 b->last = ngx_cpymem(b->last, "Location: http", | |
508 sizeof("Location: http") - 1); | |
509 | |
510 #if (NGX_HTTP_SSL) | |
511 if (r->connection->ssl) { | |
512 *b->last++ ='s'; | |
513 } | |
514 #endif | |
515 | |
516 *b->last++ = ':'; *b->last++ = '/'; *b->last++ = '/'; | |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1774
diff
changeset
|
517 b->last = ngx_copy(b->last, host.data, host.len); |
517 | 518 |
2533 | 519 if (port) { |
520 b->last = ngx_sprintf(b->last, ":%ui", port); | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
521 } |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
522 |
573 | 523 b->last = ngx_copy(b->last, r->headers_out.location->value.data, |
524 r->headers_out.location->value.len); | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
525 |
509 | 526 /* update r->headers_out.location->value for possible logging */ |
527 | |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
528 r->headers_out.location->value.len = b->last - p; |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
529 r->headers_out.location->value.data = p; |
669 | 530 r->headers_out.location->key.len = sizeof("Location: ") - 1; |
531 r->headers_out.location->key.data = (u_char *) "Location: "; | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
532 |
493 | 533 *b->last++ = CR; *b->last++ = LF; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
534 } |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
10
diff
changeset
|
535 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
536 if (r->chunked) { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
537 b->last = ngx_cpymem(b->last, "Transfer-Encoding: chunked" CRLF, |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
538 sizeof("Transfer-Encoding: chunked" CRLF) - 1); |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
539 } |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
540 |
101
2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
541 if (r->keepalive) { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
542 b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF, |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
543 sizeof("Connection: keep-alive" CRLF) - 1); |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
63
diff
changeset
|
544 |
473 | 545 if (clcf->keepalive_header) { |
455 | 546 b->last = ngx_sprintf(b->last, "Keep-Alive: timeout=%T" CRLF, |
547 clcf->keepalive_header); | |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
548 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
549 |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
63
diff
changeset
|
550 } else { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
551 b->last = ngx_cpymem(b->last, "Connection: close" CRLF, |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
552 sizeof("Connection: close" CRLF) - 1); |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
553 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
554 |
2081
8488178092f2
nginx could not be build without gzip, introduced in r2052
Igor Sysoev <igor@sysoev.ru>
parents:
2051
diff
changeset
|
555 #if (NGX_HTTP_GZIP) |
2051
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
556 if (r->gzip && clcf->gzip_vary) { |
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
557 b->last = ngx_cpymem(b->last, "Vary: Accept-Encoding" CRLF, |
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
558 sizeof("Vary: Accept-Encoding" CRLF) - 1); |
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
559 } |
2081
8488178092f2
nginx could not be build without gzip, introduced in r2052
Igor Sysoev <igor@sysoev.ru>
parents:
2051
diff
changeset
|
560 #endif |
2051
115e6f029fcc
"gzip_vary on" always sends "Vary: Accept-Encoding" header
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
561 |
415
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
562 part = &r->headers_out.headers.part; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
563 header = part->elts; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
564 |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
565 for (i = 0; /* void */; i++) { |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
566 |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
567 if (i >= part->nelts) { |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
568 if (part->next == NULL) { |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
569 break; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
570 } |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
571 |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
572 part = part->next; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
573 header = part->elts; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
574 i = 0; |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
575 } |
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
576 |
509 | 577 if (header[i].hash == 0) { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
578 continue; |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
579 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
580 |
573 | 581 b->last = ngx_copy(b->last, header[i].key.data, header[i].key.len); |
2024 | 582 *b->last++ = ':'; *b->last++ = ' '; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
583 |
573 | 584 b->last = ngx_copy(b->last, header[i].value.data, header[i].value.len); |
493 | 585 *b->last++ = CR; *b->last++ = LF; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
586 } |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
2
diff
changeset
|
587 |
1774 | 588 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2709 | 589 "%*s", (size_t) (b->last - b->pos), b->pos); |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
590 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
591 /* the end of HTTP header */ |
493 | 592 *b->last++ = CR; *b->last++ = LF; |
2
ffffe1499bce
nginx-0.0.1-2002-08-16-19:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
593 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
594 r->header_size = b->last - b->pos; |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
595 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
596 if (r->header_only) { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
294
diff
changeset
|
597 b->last_buf = 1; |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
598 } |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
599 |
501 | 600 out.buf = b; |
601 out.next = NULL; | |
2
ffffe1499bce
nginx-0.0.1-2002-08-16-19:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
602 |
501 | 603 return ngx_http_write_filter(r, &out); |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
604 } |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
605 |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
606 |
493 | 607 static ngx_int_t |
681 | 608 ngx_http_header_filter_init(ngx_conf_t *cf) |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
609 { |
71
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
610 ngx_http_top_header_filter = ngx_http_header_filter; |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
153
diff
changeset
|
611 |
71
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
612 return NGX_OK; |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
613 } |