Mercurial > hg > nginx-mail
diff src/http/ngx_http_header_filter_module.c @ 665:0b460e61bdcd default tip
Merge with nginx 1.0.0.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 25 Apr 2011 04:22:17 +0400 |
parents | c456a023113c |
children |
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter_module.c +++ b/src/http/ngx_http_header_filter_module.c @@ -53,7 +53,7 @@ static ngx_str_t ngx_http_status_lines[] ngx_string("200 OK"), ngx_string("201 Created"), - ngx_null_string, /* "202 Accepted" */ + ngx_string("202 Accepted"), ngx_null_string, /* "203 Non-Authoritative Information" */ ngx_string("204 No Content"), ngx_null_string, /* "205 Reset Content" */ @@ -68,7 +68,7 @@ static ngx_str_t ngx_http_status_lines[] ngx_string("301 Moved Permanently"), ngx_string("302 Moved Temporarily"), - ngx_null_string, /* "303 See Other" */ + ngx_string("303 See Other"), ngx_string("304 Not Modified"), /* ngx_null_string, */ /* "305 Use Proxy" */ @@ -132,10 +132,6 @@ static ngx_str_t ngx_http_status_lines[] ngx_http_header_out_t ngx_http_headers_out[] = { { ngx_string("Server"), offsetof(ngx_http_headers_out_t, server) }, { ngx_string("Date"), offsetof(ngx_http_headers_out_t, date) }, -#if 0 - { ngx_string("Content-Type"), - offsetof(ngx_http_headers_out_t, content_type) }, -#endif { ngx_string("Content-Length"), offsetof(ngx_http_headers_out_t, content_length) }, { ngx_string("Content-Encoding"), @@ -174,6 +170,10 @@ ngx_http_header_filter(ngx_http_request_ #endif u_char addr[NGX_SOCKADDR_STRLEN]; + if (r->header_sent) { + return NGX_OK; + } + r->header_sent = 1; if (r != r->main) { @@ -222,8 +222,7 @@ ngx_http_header_filter(ngx_http_request_ if (status == NGX_HTTP_NO_CONTENT) { r->header_only = 1; - r->headers_out.content_type.len = 0; - r->headers_out.content_type.data = NULL; + ngx_str_null(&r->headers_out.content_type); r->headers_out.last_modified_time = -1; r->headers_out.last_modified = NULL; r->headers_out.content_length = NULL; @@ -342,6 +341,11 @@ ngx_http_header_filter(ngx_http_request_ port = ntohs(sin6->sin6_port); break; #endif +#if (NGX_HAVE_UNIX_DOMAIN) + case AF_UNIX: + port = 0; + break; +#endif default: /* AF_INET */ sin = (struct sockaddr_in *) c->local_sockaddr; port = ntohs(sin->sin_port); @@ -370,8 +374,7 @@ ngx_http_header_filter(ngx_http_request_ } } else { - host.len = 0; - host.data = NULL; + ngx_str_null(&host); port = 0; } @@ -399,8 +402,13 @@ ngx_http_header_filter(ngx_http_request_ } #if (NGX_HTTP_GZIP) - if (r->gzip && clcf->gzip_vary) { - len += sizeof("Vary: Accept-Encoding" CRLF) - 1; + if (r->gzip_vary) { + if (clcf->gzip_vary) { + len += sizeof("Vary: Accept-Encoding" CRLF) - 1; + + } else { + r->gzip_vary = 0; + } } #endif @@ -533,8 +541,7 @@ ngx_http_header_filter(ngx_http_request_ r->headers_out.location->value.len = b->last - p; r->headers_out.location->value.data = p; - r->headers_out.location->key.len = sizeof("Location: ") - 1; - r->headers_out.location->key.data = (u_char *) "Location: "; + ngx_str_set(&r->headers_out.location->key, "Location"); *b->last++ = CR; *b->last++ = LF; } @@ -559,7 +566,7 @@ ngx_http_header_filter(ngx_http_request_ } #if (NGX_HTTP_GZIP) - if (r->gzip && clcf->gzip_vary) { + if (r->gzip_vary) { b->last = ngx_cpymem(b->last, "Vary: Accept-Encoding" CRLF, sizeof("Vary: Accept-Encoding" CRLF) - 1); }