Mercurial > hg > nginx
comparison src/http/ngx_http_core.c @ 28:a117a7fdf042
nginx-0.0.1-2002-12-16-00:08:04 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 15 Dec 2002 21:08:04 +0000 |
parents | 53cb81681040 |
children | c2d9ef3ebb6d |
comparison
equal
deleted
inserted
replaced
27:a8d5abe713e6 | 28:a117a7fdf042 |
---|---|
103 last = ngx_cpystrn(loc, r->uri.data, r->uri.len + 1); | 103 last = ngx_cpystrn(loc, r->uri.data, r->uri.len + 1); |
104 | 104 |
105 ngx_log_debug(r->connection->log, "HTTP filename: '%s'" _ | 105 ngx_log_debug(r->connection->log, "HTTP filename: '%s'" _ |
106 r->file.name.data); | 106 r->file.name.data); |
107 | 107 |
108 #if (WIN32) | 108 #if (WIN9X) |
109 | 109 |
110 /* There is no way to open file or directory in Win32 with | 110 /* There is no way to open file or directory in Win9X with |
111 one syscall: CreateFile() returns ERROR_ACCESS_DENIED on directory, | 111 one syscall: Win9X has not FILE_FLAG_BACKUP_SEMANTICS flag. |
112 so we need to check its type before opening */ | 112 so we need to check its type before opening */ |
113 | 113 |
114 #if 0 /* OLD: ngx_file_type() is to be removed */ | 114 #if 0 /* OLD: ngx_file_type() is to be removed */ |
115 if (ngx_file_type(r->file.name.data, &r->file.info) == -1) { | 115 if (ngx_file_type(r->file.name.data, &r->file.info) == -1) { |
116 #endif | 116 #endif |
136 r->file.fd = ngx_open_file(r->file.name.data, NGX_FILE_RDONLY); | 136 r->file.fd = ngx_open_file(r->file.name.data, NGX_FILE_RDONLY); |
137 | 137 |
138 if (r->file.fd == NGX_INVALID_FILE) { | 138 if (r->file.fd == NGX_INVALID_FILE) { |
139 err = ngx_errno; | 139 err = ngx_errno; |
140 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, | 140 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, |
141 "ngx_http_static_handler: " | 141 "ngx_http_core_handler: " |
142 ngx_open_file_n " %s failed", r->file.name.data); | 142 ngx_open_file_n " %s failed", r->file.name.data); |
143 | 143 |
144 if (err == NGX_ENOENT) | 144 if (err == NGX_ENOENT) |
145 return NGX_HTTP_NOT_FOUND; | 145 return NGX_HTTP_NOT_FOUND; |
146 else | 146 else |
148 } | 148 } |
149 | 149 |
150 if (!r->file.info_valid) { | 150 if (!r->file.info_valid) { |
151 if (ngx_stat_fd(r->file.fd, &r->file.info) == NGX_FILE_ERROR) { | 151 if (ngx_stat_fd(r->file.fd, &r->file.info) == NGX_FILE_ERROR) { |
152 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, | 152 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, |
153 "ngx_http_static_handler: " | 153 "ngx_http_core_handler: " |
154 ngx_stat_fd_n " %s failed", r->file.name.data); | 154 ngx_stat_fd_n " %s failed", r->file.name.data); |
155 | 155 |
156 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) | 156 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) |
157 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, | 157 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, |
158 "ngx_http_static_handler: " | 158 "ngx_http_core_handler: " |
159 ngx_close_file_n " %s failed", r->file.name.data); | 159 ngx_close_file_n " %s failed", r->file.name.data); |
160 | 160 |
161 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 161 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
162 } | 162 } |
163 | 163 |
166 #endif | 166 #endif |
167 | 167 |
168 if (ngx_is_dir(r->file.info)) { | 168 if (ngx_is_dir(r->file.info)) { |
169 ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data); | 169 ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data); |
170 | 170 |
171 #if !(WIN32) | 171 #if !(WIN9X) |
172 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) | 172 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) |
173 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, | 173 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, |
174 "ngx_http_static_handler: " | 174 "ngx_http_core_handler: " |
175 ngx_close_file_n " %s failed", r->file.name.data); | 175 ngx_close_file_n " %s failed", r->file.name.data); |
176 #endif | 176 #endif |
177 | 177 |
178 /* BROKEN: need to include server name */ | 178 /* BROKEN: need to include server name */ |
179 | 179 |