nginx-0.0.1-2003-10-27-11:53:49 import
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c
index f4955ef..0eb789c 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -88,7 +88,7 @@
/*
* There is no way to open a file or a directory in Win9X with
* one syscall: Win9X has no FILE_FLAG_BACKUP_SEMANTICS flag.
- * so we need to check its type before the opening
+ * So we need to check its type before the opening
*/
r->file.info.dwFileAttributes = GetFileAttributes(r->file.name.data);
@@ -151,6 +151,21 @@
r->file.info_valid = 1;
}
+
+#if !(WIN32) /* the not regular files are probably Unix specific */
+
+ if (!ngx_is_file(r->file.info)) {
+ ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
+ "%s is not a regular file", r->file.name.data);
+
+ if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR)
+ ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
+ ngx_close_file_n " %s failed", r->file.name.data);
+
+ return NGX_HTTP_NOT_FOUND;
+ }
+
+#endif
#endif
if (ngx_is_dir(r->file.info)) {
@@ -163,6 +178,7 @@
}
r->file.fd = NGX_INVALID_FILE;
+ r->file.info_valid = 0;
#endif
ngx_test_null(h, ngx_push_table(r->headers_out.headers),
@@ -203,7 +219,7 @@
}
ctx = r->connection->log->data;
- ctx->action = "sending response";
+ ctx->action = "sending response to client";
if (r->file.fd == NGX_INVALID_FILE) {
r->file.fd = ngx_open_file(r->file.name.data,
@@ -242,21 +258,6 @@
r->file.info_valid = 1;
}
-#if !(WIN32) /* the not regular files are probably Unix specific */
-
- if (!ngx_is_file(r->file.info)) {
- ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
- "%s is not regular file", r->file.name.data);
-
- if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR)
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
- ngx_close_file_n " %s failed", r->file.name.data);
-
- return NGX_HTTP_NOT_FOUND;
- }
-
-#endif
-
r->headers_out.status = NGX_HTTP_OK;
r->headers_out.content_length_n = ngx_file_size(r->file.info);
r->headers_out.last_modified_time = ngx_file_mtime(r->file.info);