comparison src/http/modules/ngx_http_static_handler.c @ 142:cb77c084acdb

nginx-0.0.1-2003-10-09-11:00:45 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 09 Oct 2003 07:00:45 +0000
parents a059e1aa65d4
children 5526213be452
comparison
equal deleted inserted replaced
141:656d468f4ead 142:cb77c084acdb
116 r->headers_out.content_type->value.len = clcf->default_type.len; 116 r->headers_out.content_type->value.len = clcf->default_type.len;
117 r->headers_out.content_type->value.data = clcf->default_type.data; 117 r->headers_out.content_type->value.data = clcf->default_type.data;
118 } 118 }
119 119
120 /* we need to allocate all before the header would be sent */ 120 /* we need to allocate all before the header would be sent */
121
121 ngx_test_null(h, ngx_pcalloc(r->pool, sizeof(ngx_hunk_t)), 122 ngx_test_null(h, ngx_pcalloc(r->pool, sizeof(ngx_hunk_t)),
122 NGX_HTTP_INTERNAL_SERVER_ERROR); 123 NGX_HTTP_INTERNAL_SERVER_ERROR);
123 124
124 ngx_test_null(h->file, ngx_pcalloc(r->pool, sizeof(ngx_file_t)), 125 ngx_test_null(h->file, ngx_pcalloc(r->pool, sizeof(ngx_file_t)),
125 NGX_HTTP_INTERNAL_SERVER_ERROR); 126 NGX_HTTP_INTERNAL_SERVER_ERROR);
130 ngx_http_finalize_request(r, rc); 131 ngx_http_finalize_request(r, rc);
131 return NGX_OK; 132 return NGX_OK;
132 } 133 }
133 134
134 if (r->header_only) { 135 if (r->header_only) {
136 ngx_http_finalize_request(r, rc);
137
138 #if 0
135 if (rc == NGX_AGAIN) { 139 if (rc == NGX_AGAIN) {
136 ngx_http_set_write_handler(r); 140 ngx_http_set_write_handler(r);
137 141
138 } else { 142 } else {
139 ngx_http_finalize_request(r, 0); 143 ngx_http_finalize_request(r, 0);
140 } 144 }
145 #endif
141 146
142 return NGX_OK; 147 return NGX_OK;
143 } 148 }
144 149
145 150
146 h->type = NGX_HUNK_FILE|NGX_HUNK_LAST; 151 #if 0
152 h->type = r->main ? NGX_HUNK_FILE : NGX_HUNK_FILE|NGX_HUNK_LAST;
153 #else
154 h->type = NGX_HUNK_FILE;
155 #endif
156
157
147 h->file_pos = 0; 158 h->file_pos = 0;
148 h->file_last = ngx_file_size(r->file.info); 159 h->file_last = ngx_file_size(r->file.info);
149 160
150 h->file->fd = r->file.fd; 161 h->file->fd = r->file.fd;
151 h->file->log = r->connection->log; 162 h->file->log = r->connection->log;
152 163
153 rc = ngx_http_output_filter(r, h); 164 rc = ngx_http_output_filter(r, h);
154 165
166 ngx_http_finalize_request(r, rc);
167
168 #if 0
155 if (r->main == NULL) { 169 if (r->main == NULL) {
156 if (rc == NGX_AGAIN) { 170 if (rc == NGX_AGAIN) {
157 ngx_http_set_write_handler(r); 171 ngx_http_set_write_handler(r);
158 172
159 } else { 173 } else {
160 ngx_http_finalize_request(r, 0); 174 ngx_http_finalize_request(r, 0);
161 } 175 }
162 } 176 }
177 #endif
163 178
164 return NGX_OK; 179 return NGX_OK;
165 } 180 }