20 ngx_http_header_filter_init,
35 &ngx_http_header_filter_module_ctx,
49 static char ngx_http_server_string[] =
"Server: nginx" CRLF;
50 static char ngx_http_server_full_string[] =
"Server: " NGINX_VER CRLF;
53 static ngx_str_t ngx_http_status_lines[] = {
65 #define NGX_HTTP_LAST_2XX 207
66 #define NGX_HTTP_OFF_3XX (NGX_HTTP_LAST_2XX - 200)
78 #define NGX_HTTP_LAST_3XX 308
79 #define NGX_HTTP_OFF_4XX (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
100 ngx_string(
"416 Requested Range Not Satisfiable"),
111 #define NGX_HTTP_LAST_4XX 417
112 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
117 ngx_string(
"503 Service Temporarily Unavailable"),
127 #define NGX_HTTP_LAST_5XX 508
167 struct sockaddr_in *sin;
169 struct sockaddr_in6 *sin6;
201 len =
sizeof(
"HTTP/1.x ") - 1 +
sizeof(
CRLF) - 1
210 #if (NGX_SUPPRESS_WARN)
219 && status < NGX_HTTP_LAST_2XX)
233 status_line = &ngx_http_status_lines[status];
234 len += ngx_http_status_lines[status].
len;
237 && status < NGX_HTTP_LAST_3XX)
246 status_line = &ngx_http_status_lines[status];
247 len += ngx_http_status_lines[status].
len;
250 && status < NGX_HTTP_LAST_4XX)
256 status_line = &ngx_http_status_lines[status];
257 len += ngx_http_status_lines[status].
len;
260 && status < NGX_HTTP_LAST_5XX)
266 status_line = &ngx_http_status_lines[status];
267 len += ngx_http_status_lines[status].
len;
278 len += clcf->
server_tokens ?
sizeof(ngx_http_server_full_string) - 1:
279 sizeof(ngx_http_server_string) - 1;
283 len +=
sizeof(
"Date: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;
287 len +=
sizeof(
"Content-Type: ") - 1
306 len +=
sizeof(
"Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;
338 port = ntohs(sin6->sin6_port);
341 #if (NGX_HAVE_UNIX_DOMAIN)
348 port = ntohs(sin->sin_port);
352 len +=
sizeof(
"Location: https://") - 1
360 port = (port == 443) ? 0 : port;
363 port = (port == 80) ? 0 : port;
370 len +=
sizeof(
":65535") - 1;
379 len +=
sizeof(
"Transfer-Encoding: chunked" CRLF) - 1;
383 len +=
sizeof(
"Connection: upgrade" CRLF) - 1;
386 len +=
sizeof(
"Connection: keep-alive" CRLF) - 1;
401 len +=
sizeof(
"Connection: close" CRLF) - 1;
406 if (clcf->gzip_vary) {
407 len +=
sizeof(
"Vary: Accept-Encoding" CRLF) - 1;
420 if (i >= part->
nelts) {
421 if (part->
next == NULL) {
430 if (header[i].hash == 0) {
434 len += header[
i].
key.
len +
sizeof(
": ") - 1 + header[i].value.len
457 p = (u_char *) ngx_http_server_full_string;
458 len =
sizeof(ngx_http_server_full_string) - 1;
461 p = (u_char *) ngx_http_server_string;
462 len =
sizeof(ngx_http_server_string) - 1;
478 sizeof(
"Content-Type: ") - 1);
487 sizeof(
"; charset=") - 1);
511 sizeof(
"Last-Modified: ") - 1);
519 p = b->
last +
sizeof(
"Location: ") - 1;
522 sizeof(
"Location: http") - 1);
551 sizeof(
"Transfer-Encoding: chunked" CRLF) - 1);
556 sizeof(
"Connection: upgrade" CRLF) - 1);
560 sizeof(
"Connection: keep-alive" CRLF) - 1);
569 sizeof(
"Connection: close" CRLF) - 1);
575 sizeof(
"Vary: Accept-Encoding" CRLF) - 1);
584 if (i >= part->
nelts) {
585 if (part->
next == NULL) {
594 if (header[i].hash == 0) {