Mercurial > hg > nginx
comparison src/http/modules/ngx_http_static_handler.c @ 99:a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 02 Jun 2003 15:24:30 +0000 |
parents | a23d010f356d |
children | cb77c084acdb |
comparison
equal
deleted
inserted
replaced
98:c9b243802a17 | 99:a059e1aa65d4 |
---|---|
1 | 1 |
2 #include <ngx_config.h> | 2 #include <ngx_config.h> |
3 #include <ngx_core.h> | 3 #include <ngx_core.h> |
4 #include <ngx_http.h> | 4 #include <ngx_http.h> |
5 #include <ngx_http_config.h> | |
6 #include <ngx_http_core_module.h> | |
7 #include <ngx_http_output_filter.h> | |
8 | |
9 | 5 |
10 | 6 |
11 int ngx_http_static_handler(ngx_http_request_t *r) | 7 int ngx_http_static_handler(ngx_http_request_t *r) |
12 { | 8 { |
13 int rc, key, i; | 9 int rc, key, i; |
30 | 26 |
31 ctx = r->connection->log->data; | 27 ctx = r->connection->log->data; |
32 ctx->action = "sending response"; | 28 ctx->action = "sending response"; |
33 | 29 |
34 if (r->file.fd == NGX_INVALID_FILE) { | 30 if (r->file.fd == NGX_INVALID_FILE) { |
35 r->file.fd = ngx_open_file(r->file.name.data, NGX_FILE_RDONLY); | 31 r->file.fd = ngx_open_file(r->file.name.data, |
32 NGX_FILE_RDONLY, NGX_FILE_OPEN); | |
36 | 33 |
37 if (r->file.fd == NGX_INVALID_FILE) { | 34 if (r->file.fd == NGX_INVALID_FILE) { |
38 err = ngx_errno; | 35 err = ngx_errno; |
39 | 36 |
40 if (err == NGX_ENOENT || err == NGX_ENOTDIR) { | 37 if (err == NGX_ENOENT || err == NGX_ENOTDIR) { |
127 ngx_test_null(h->file, ngx_pcalloc(r->pool, sizeof(ngx_file_t)), | 124 ngx_test_null(h->file, ngx_pcalloc(r->pool, sizeof(ngx_file_t)), |
128 NGX_HTTP_INTERNAL_SERVER_ERROR); | 125 NGX_HTTP_INTERNAL_SERVER_ERROR); |
129 | 126 |
130 | 127 |
131 rc = ngx_http_send_header(r); | 128 rc = ngx_http_send_header(r); |
129 if (rc == NGX_ERROR || rc > NGX_OK) { | |
130 ngx_http_finalize_request(r, rc); | |
131 return NGX_OK; | |
132 } | |
132 | 133 |
133 if (r->header_only) { | 134 if (r->header_only) { |
134 if (rc == NGX_AGAIN) { | 135 if (rc == NGX_AGAIN) { |
135 ngx_http_set_write_handler(r); | 136 ngx_http_set_write_handler(r); |
136 | 137 |