Mercurial > hg > nginx
diff src/http/modules/ngx_http_static_handler.c @ 8:708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 02 Sep 2002 14:48:24 +0000 |
parents | 34a521b1a148 |
children | 4f3879d9b6f6 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_static_handler.c Thu Aug 29 16:59:54 2002 +0000 +++ b/src/http/modules/ngx_http_static_handler.c Mon Sep 02 14:48:24 2002 +0000 @@ -26,7 +26,7 @@ { int rc; ngx_hunk_t *h; - ngx_chain_t *ch; + ngx_http_log_ctx_t *ctx; /* ngx_http_event_static_handler_loc_conf_t *cf; @@ -36,6 +36,10 @@ */ + ngx_http_discard_body(r); + ctx = r->connection->log->data; + ctx->action = "sending response"; + r->fd = ngx_open_file(r->filename, NGX_FILE_RDONLY); if (r->fd == -1) { ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, @@ -45,7 +49,7 @@ return -1; } - if (ngx_stat_fd(r->fd, &r->file_info) == -1) { + if (ngx_stat_fd(r->fd, &r->fileinfo) == -1) { ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, "ngx_http_static_handler: " ngx_stat_fd_n " %s failed", r->filename); @@ -54,9 +58,9 @@ } r->headers_out->status = NGX_HTTP_OK; - r->headers_out->content_length = ngx_file_size(r->file_info); + r->headers_out->content_length = ngx_file_size(r->fileinfo); /* - r->headers_out->last_modified = ngx_file_mtime(r->file_info); + r->headers_out->last_modified = ngx_file_mtime(r->fileinfo); */ /* STUB */ @@ -73,39 +77,22 @@ /* TODO: NGX_HTTP_INTERNAL_SERVER_ERROR is too late */ /* STUB */ - ngx_test_null(h, ngx_get_hunk(r->pool, 1024, 0, 64), - /* STUB */ - -1); -/* - ngx_test_null(h, ngx_create_hunk(r->pool), NGX_HTTP_INTERNAL_SERVER_ERROR); -*/ + ngx_test_null(h, ngx_pcalloc(r->pool, sizeof(ngx_hunk_t)), + NGX_HTTP_INTERNAL_SERVER_ERROR); + h->type = NGX_HUNK_FILE|NGX_HUNK_LAST; - h->fd = r->fd; h->pos.file = 0; - h->last.file = ngx_file_size(r->file_info); + h->last.file = ngx_file_size(r->fileinfo); /* STUB */ - ngx_test_null(ch, ngx_palloc(r->pool, sizeof(ngx_chain_t)), - /* STUB */ - -1); -/* - NGX_HTTP_FILTER_ERROR); -*/ - -/* - ngx_test_null(ch, ngx_create_chain(r->pool), + ngx_test_null(h->file, ngx_pcalloc(r->pool, sizeof(ngx_file_t)), NGX_HTTP_INTERNAL_SERVER_ERROR); -*/ - ch->hunk = h; - ch->next = NULL; + h->file->fd = r->fd; + h->file->log = r->connection->log; - /* STUB */ - rc = ngx_http_write_filter(r, ch); - ngx_log_debug(r->connection->log, "write_filter: %d" _ rc); + rc = ngx_http_output_filter(r, h); + ngx_log_debug(r->connection->log, "0 output_filter: %d" _ rc); return rc; -/* - return ngx_http_filter(r, ch); -*/ } #if 0