comparison src/http/modules/ngx_http_static_handler.c @ 61:4f3e2abcc2c4

nginx-0.0.1-2003-02-11-19:42:23 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 11 Feb 2003 16:42:23 +0000
parents e8cdc2989cee
children 36d2c25cc9bb
comparison
equal deleted inserted replaced
60:50186b49f2ad 61:4f3e2abcc2c4
139 139
140 rc = ngx_http_send_header(r); 140 rc = ngx_http_send_header(r);
141 if (r->header_only) 141 if (r->header_only)
142 return rc; 142 return rc;
143 143
144 #if 0
145
144 h->type = NGX_HUNK_FILE|NGX_HUNK_LAST; 146 h->type = NGX_HUNK_FILE|NGX_HUNK_LAST;
145 h->pos.file = 0; 147 h->pos.file = 0;
146 h->last.file = ngx_file_size(r->file.info); 148 h->last.file = ngx_file_size(r->file.info);
147 149
148 h->file->fd = r->file.fd; 150 h->file->fd = r->file.fd;
150 152
151 rc = ngx_http_output_filter(r, h); 153 rc = ngx_http_output_filter(r, h);
152 154
153 ngx_log_debug(r->connection->log, "0 output_filter: %d" _ rc); 155 ngx_log_debug(r->connection->log, "0 output_filter: %d" _ rc);
154 156
157 #else
158
159 #define BLK 10000
160
161 {
162 int i, s;
163 s = ngx_file_size(r->file.info);
164
165 for (i = 0; i < s; i += BLK) {
166 ngx_test_null(h, ngx_pcalloc(r->pool, sizeof(ngx_hunk_t)),
167 NGX_HTTP_INTERNAL_SERVER_ERROR);
168
169 ngx_test_null(h->file, ngx_pcalloc(r->pool, sizeof(ngx_file_t)),
170 NGX_HTTP_INTERNAL_SERVER_ERROR);
171
172 h->type = NGX_HUNK_FILE;
173 if (s - i <= BLK) {
174 h->type |= NGX_HUNK_LAST;
175 }
176
177 h->pos.file = i;
178 h->last.file = i + BLK;
179 if (h->last.file > s) {
180 h->last.file = s;
181 }
182
183 h->file->fd = r->file.fd;
184 h->file->log = r->connection->log;
185
186 rc = ngx_http_output_filter(r, h);
187
188 ngx_log_debug(r->connection->log, "0 output_filter: %d" _ rc);
189 }
190 }
191
192 #endif
193
155 return rc; 194 return rc;
156 } 195 }