comparison src/http/ngx_http_header_filter.c @ 19:d7908993fdeb

nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
author Igor Sysoev <igor@sysoev.ru>
date Mon, 02 Dec 2002 16:09:40 +0000
parents 2aba961a1d34
children 77c7629a2627
comparison
equal deleted inserted replaced
18:72ad26c77d2d 19:d7908993fdeb
27 ngx_chain_t *ch; 27 ngx_chain_t *ch;
28 28
29 ngx_test_null(h, ngx_create_temp_hunk(r->pool, 1024, 0, 64), 29 ngx_test_null(h, ngx_create_temp_hunk(r->pool, 1024, 0, 64),
30 NGX_ERROR); 30 NGX_ERROR);
31 31
32 status = r->headers_out->status - NGX_HTTP_OK; 32 status = r->headers_out.status - NGX_HTTP_OK;
33 33
34 ngx_memcpy(h->last.mem, "HTTP/1.1 ", 9); 34 ngx_memcpy(h->last.mem, "HTTP/1.1 ", 9);
35 h->last.mem += 9; 35 h->last.mem += 9;
36 ngx_memcpy(h->last.mem, http_codes[status].line, http_codes[status].len); 36 ngx_memcpy(h->last.mem, http_codes[status].line, http_codes[status].len);
37 h->last.mem += http_codes[status].len; 37 h->last.mem += http_codes[status].len;
41 r->keepalive = 1; 41 r->keepalive = 1;
42 ngx_memcpy(h->last.mem, "Connection: keep-alive" CRLF, 24); 42 ngx_memcpy(h->last.mem, "Connection: keep-alive" CRLF, 24);
43 h->last.mem += 24; 43 h->last.mem += 24;
44 #endif 44 #endif
45 45
46 /*
47 ngx_memcpy(h->last.mem, "Date: ", 6); 46 ngx_memcpy(h->last.mem, "Date: ", 6);
48 h->last.mem += 6; 47 h->last.mem += 6;
49 h->last.mem += ngx_http_get_time(h->last.mem, time(NULL)); 48 h->last.mem += ngx_http_get_time(h->last.mem, time(NULL));
50 *(h->last.mem++) = CR; *(h->last.mem++) = LF; 49 *(h->last.mem++) = CR; *(h->last.mem++) = LF;
51 */
52 50
53 /* 2^64 is 20 characters */ 51 /* 2^64 is 20 characters */
54 if (r->headers_out->content_length) 52 if (r->headers_out.content_length)
55 h->last.mem += ngx_snprintf(h->last.mem, 49, "Content-Length: %d" CRLF, 53 h->last.mem += ngx_snprintf(h->last.mem, 49, "Content-Length: %d" CRLF,
56 r->headers_out->content_length); 54 r->headers_out.content_length);
57 55
58 /* check */ 56 /* check */
59 57
60 if (r->headers_out->content_type) 58 if (r->headers_out.content_type)
61 h->last.mem += ngx_snprintf(h->last.mem, 100, "Content-Type: %s" CRLF, 59 h->last.mem += ngx_snprintf(h->last.mem, 100, "Content-Type: %s" CRLF,
62 r->headers_out->content_type); 60 r->headers_out.content_type);
63 61
64 ngx_memcpy(h->last.mem, "Server: ", 8); 62 ngx_memcpy(h->last.mem, "Server: ", 8);
65 h->last.mem += 8; 63 h->last.mem += 8;
66 if (r->headers_out->server) { 64 if (r->headers_out.server) {
67 h->last.mem = ngx_cpystrn(h->last.mem, r->headers_out->server, 65 h->last.mem = ngx_cpystrn(h->last.mem, r->headers_out.server,
68 h->end - h->last.mem); 66 h->end - h->last.mem);
69 /* check space */ 67 /* check space */
70 68
71 } else { 69 } else {
72 ngx_memcpy(h->last.mem, NGINX_VER, sizeof(NGINX_VER) - 1); 70 ngx_memcpy(h->last.mem, NGINX_VER, sizeof(NGINX_VER) - 1);