comparison src/http/ngx_http_header_filter_module.c @ 635:e67b227c8dbb default tip

Merge with current.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 25 Apr 2011 04:07:55 +0400
parents c456a023113c
children
comparison
equal deleted inserted replaced
578:f3a9e57d2e17 635:e67b227c8dbb
51 51
52 static ngx_str_t ngx_http_status_lines[] = { 52 static ngx_str_t ngx_http_status_lines[] = {
53 53
54 ngx_string("200 OK"), 54 ngx_string("200 OK"),
55 ngx_string("201 Created"), 55 ngx_string("201 Created"),
56 ngx_null_string, /* "202 Accepted" */ 56 ngx_string("202 Accepted"),
57 ngx_null_string, /* "203 Non-Authoritative Information" */ 57 ngx_null_string, /* "203 Non-Authoritative Information" */
58 ngx_string("204 No Content"), 58 ngx_string("204 No Content"),
59 ngx_null_string, /* "205 Reset Content" */ 59 ngx_null_string, /* "205 Reset Content" */
60 ngx_string("206 Partial Content"), 60 ngx_string("206 Partial Content"),
61 61
66 66
67 /* ngx_null_string, */ /* "300 Multiple Choices" */ 67 /* ngx_null_string, */ /* "300 Multiple Choices" */
68 68
69 ngx_string("301 Moved Permanently"), 69 ngx_string("301 Moved Permanently"),
70 ngx_string("302 Moved Temporarily"), 70 ngx_string("302 Moved Temporarily"),
71 ngx_null_string, /* "303 See Other" */ 71 ngx_string("303 See Other"),
72 ngx_string("304 Not Modified"), 72 ngx_string("304 Not Modified"),
73 73
74 /* ngx_null_string, */ /* "305 Use Proxy" */ 74 /* ngx_null_string, */ /* "305 Use Proxy" */
75 /* ngx_null_string, */ /* "306 unused" */ 75 /* ngx_null_string, */ /* "306 unused" */
76 /* ngx_null_string, */ /* "307 Temporary Redirect" */ 76 /* ngx_null_string, */ /* "307 Temporary Redirect" */
168 #if (NGX_HAVE_INET6) 168 #if (NGX_HAVE_INET6)
169 struct sockaddr_in6 *sin6; 169 struct sockaddr_in6 *sin6;
170 #endif 170 #endif
171 u_char addr[NGX_SOCKADDR_STRLEN]; 171 u_char addr[NGX_SOCKADDR_STRLEN];
172 172
173 if (r->header_sent) {
174 return NGX_OK;
175 }
176
173 r->header_sent = 1; 177 r->header_sent = 1;
174 178
175 if (r != r->main) { 179 if (r != r->main) {
176 return NGX_OK; 180 return NGX_OK;
177 } 181 }
216 { 220 {
217 /* 2XX */ 221 /* 2XX */
218 222
219 if (status == NGX_HTTP_NO_CONTENT) { 223 if (status == NGX_HTTP_NO_CONTENT) {
220 r->header_only = 1; 224 r->header_only = 1;
221 r->headers_out.content_type.len = 0; 225 ngx_str_null(&r->headers_out.content_type);
222 r->headers_out.content_type.data = NULL;
223 r->headers_out.last_modified_time = -1; 226 r->headers_out.last_modified_time = -1;
224 r->headers_out.last_modified = NULL; 227 r->headers_out.last_modified = NULL;
225 r->headers_out.content_length = NULL; 228 r->headers_out.content_length = NULL;
226 r->headers_out.content_length_n = -1; 229 r->headers_out.content_length_n = -1;
227 } 230 }
336 case AF_INET6: 339 case AF_INET6:
337 sin6 = (struct sockaddr_in6 *) c->local_sockaddr; 340 sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
338 port = ntohs(sin6->sin6_port); 341 port = ntohs(sin6->sin6_port);
339 break; 342 break;
340 #endif 343 #endif
344 #if (NGX_HAVE_UNIX_DOMAIN)
345 case AF_UNIX:
346 port = 0;
347 break;
348 #endif
341 default: /* AF_INET */ 349 default: /* AF_INET */
342 sin = (struct sockaddr_in *) c->local_sockaddr; 350 sin = (struct sockaddr_in *) c->local_sockaddr;
343 port = ntohs(sin->sin_port); 351 port = ntohs(sin->sin_port);
344 break; 352 break;
345 } 353 }
364 if (port) { 372 if (port) {
365 len += sizeof(":65535") - 1; 373 len += sizeof(":65535") - 1;
366 } 374 }
367 375
368 } else { 376 } else {
369 host.len = 0; 377 ngx_str_null(&host);
370 host.data = NULL;
371 port = 0; 378 port = 0;
372 } 379 }
373 380
374 if (r->chunked) { 381 if (r->chunked) {
375 len += sizeof("Transfer-Encoding: chunked" CRLF) - 1; 382 len += sizeof("Transfer-Encoding: chunked" CRLF) - 1;
532 539
533 /* update r->headers_out.location->value for possible logging */ 540 /* update r->headers_out.location->value for possible logging */
534 541
535 r->headers_out.location->value.len = b->last - p; 542 r->headers_out.location->value.len = b->last - p;
536 r->headers_out.location->value.data = p; 543 r->headers_out.location->value.data = p;
537 r->headers_out.location->key.len = sizeof("Location") - 1; 544 ngx_str_set(&r->headers_out.location->key, "Location");
538 r->headers_out.location->key.data = (u_char *) "Location";
539 545
540 *b->last++ = CR; *b->last++ = LF; 546 *b->last++ = CR; *b->last++ = LF;
541 } 547 }
542 548
543 if (r->chunked) { 549 if (r->chunked) {