aboutsummaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-11-16 21:49:42 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-11-16 21:49:42 +0000
commitf2e676aa1585de170b39cf3e9d71b88db47e4b1b (patch)
tree3553b3481de51b2321b201ae34024f178af894c1 /src/http
parent297c0487518d4b974a548dfd3d5d2f10c250177c (diff)
downloadnginx-f2e676aa1585de170b39cf3e9d71b88db47e4b1b.tar.gz
nginx-f2e676aa1585de170b39cf3e9d71b88db47e4b1b.zip
nginx-0.0.1-2003-11-17-00:49:42 import
Diffstat (limited to 'src/http')
-rw-r--r--src/http/modules/ngx_http_index_handler.c6
-rw-r--r--src/http/modules/ngx_http_static_handler.c24
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_cache.c6
-rw-r--r--src/http/ngx_http.c6
-rw-r--r--src/http/ngx_http_cache.c21
5 files changed, 39 insertions, 24 deletions
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index 989de0051..e31bf3d09 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -202,7 +202,7 @@ static int ngx_http_index_test_dir(ngx_http_request_t *r,
ngx_log_debug(r->connection->log, "IS_DIR: %s" _ r->path.data);
- if (ngx_file_type(r->path.data, &r->file.info) == -1) {
+ if (ngx_file_info(r->path.data, &r->file.info) == -1) {
err = ngx_errno;
@@ -212,14 +212,14 @@ ngx_log_debug(r->connection->log, "IS_DIR: %s" _ r->path.data);
}
ngx_log_error(NGX_LOG_CRIT, r->connection->log, err,
- ngx_file_type_n " %s failed", r->path.data);
+ ngx_file_info_n " %s failed", r->path.data);
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
r->path.data[r->path.len - 1] = '/';
- if (ngx_is_dir((&r->file.info))) {
+ if (ngx_is_dir(&r->file.info)) {
return NGX_OK;
}
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c
index 8b622a0f3..c92287082 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -95,10 +95,10 @@ ngx_log_debug(r->connection->log, "HTTP filename: '%s'" _ r->file.name.data);
* so we need to check its type before the opening
*/
- if (ngx_file_type(r->file.name.data, &r->file.info) == NGX_FILE_ERROR) {
+ if (ngx_file_info(r->file.name.data, &r->file.info) == NGX_FILE_ERROR) {
err = ngx_errno;
ngx_log_error(NGX_LOG_ERR, r->connection->log, err,
- ngx_file_type_n " \"%s\" failed", r->file.name.data);
+ ngx_file_info_n " \"%s\" failed", r->file.name.data);
if (err == NGX_ENOENT || err == NGX_ENOTDIR) {
return NGX_HTTP_NOT_FOUND;
@@ -111,7 +111,7 @@ ngx_log_debug(r->connection->log, "HTTP filename: '%s'" _ r->file.name.data);
}
}
- if (ngx_is_dir(r->file.info)) {
+ if (ngx_is_dir(&r->file.info)) {
ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data);
if (!(r->headers_out.location =
@@ -163,9 +163,9 @@ ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data);
ngx_log_debug(r->connection->log, "FILE: %d" _ r->file.fd);
if (!r->file.info_valid) {
- if (ngx_stat_fd(r->file.fd, &r->file.info) == NGX_FILE_ERROR) {
+ if (ngx_fd_info(r->file.fd, &r->file.info) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
- ngx_stat_fd_n " \"%s\" failed", r->file.name.data);
+ ngx_fd_info_n " \"%s\" failed", 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,
@@ -181,7 +181,7 @@ ngx_log_debug(r->connection->log, "FILE: %d" _ r->file.fd);
r->file.info_valid = 1;
}
- if (ngx_is_dir((&r->file.info))) {
+ if (ngx_is_dir(&r->file.info)) {
ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data);
if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) {
@@ -210,7 +210,7 @@ ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data);
#if !(WIN32) /* the not regular files are probably Unix specific */
- if (!ngx_is_file((&r->file.info))) {
+ 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);
@@ -272,9 +272,9 @@ static int ngx_http_static_handler(ngx_http_request_t *r)
}
if (!r->file.info_valid) {
- if (ngx_stat_fd(r->file.fd, &r->file.info) == NGX_FILE_ERROR) {
+ if (ngx_fd_info(r->file.fd, &r->file.info) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
- ngx_stat_fd_n " %s failed", r->file.name.data);
+ ngx_fd_info_n " %s failed", 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,
@@ -287,8 +287,8 @@ static int ngx_http_static_handler(ngx_http_request_t *r)
}
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));
+ r->headers_out.content_length_n = ngx_file_size(&r->file.info);
+ r->headers_out.last_modified_time = ngx_file_mtime(&r->file.info);
if (!(r->headers_out.content_type =
ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
@@ -344,7 +344,7 @@ static int ngx_http_static_handler(ngx_http_request_t *r)
h->type = r->main ? NGX_HUNK_FILE : NGX_HUNK_FILE|NGX_HUNK_LAST;
h->file_pos = 0;
- h->file_last = ngx_file_size((&r->file.info));
+ h->file_last = ngx_file_size(&r->file.info);
h->file->fd = r->file.fd;
h->file->log = r->connection->log;
diff --git a/src/http/modules/proxy/ngx_http_proxy_cache.c b/src/http/modules/proxy/ngx_http_proxy_cache.c
index e56c2e522..7c5ec595d 100644
--- a/src/http/modules/proxy/ngx_http_proxy_cache.c
+++ b/src/http/modules/proxy/ngx_http_proxy_cache.c
@@ -270,11 +270,11 @@ void ngx_http_proxy_cache_busy_lock(ngx_http_proxy_ctx_t *p)
if (p->cache->ctx.file.fd != NGX_INVALID_FILE
&& !p->cache->ctx.file.info_valid)
{
- if (ngx_stat_fd(p->cache->ctx.file.fd, &p->cache->ctx.file.info)
+ if (ngx_fd_info(p->cache->ctx.file.fd, &p->cache->ctx.file.info)
== NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_CRIT, p->request->connection->log, ngx_errno,
- ngx_stat_fd_n " \"%s\" failed",
+ ngx_fd_info_n " \"%s\" failed",
p->cache->ctx.file.name.data);
ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
@@ -322,7 +322,7 @@ static void ngx_http_proxy_cache_look_complete_request(ngx_http_proxy_ctx_t *p)
*ctx = p->cache->ctx;
rc = ngx_http_cache_open_file(p->request, ctx,
- ngx_file_uniq((&p->cache->ctx.file.info)));
+ ngx_file_uniq(&p->cache->ctx.file.info));
if (rc == NGX_HTTP_CACHE_THE_SAME) {
p->try_busy_lock = 1;
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 9fa8f6213..14ee3eab2 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -480,7 +480,13 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ls->addr = offsetof(struct sockaddr_in, sin_addr);
ls->addr_text_max_len = INET_ADDRSTRLEN;
ls->backlog = -1;
+#if 0
+#if 0
ls->nonblocking = 1;
+#else
+ ls->nonblocking = 0;
+#endif
+#endif
ls->handler = ngx_http_init_connection;
diff --git a/src/http/ngx_http_cache.c b/src/http/ngx_http_cache.c
index 4f599ee67..b11558c90 100644
--- a/src/http/ngx_http_cache.c
+++ b/src/http/ngx_http_cache.c
@@ -5,8 +5,7 @@
#include <md5.h>
-/* STUB */
-#if (WIN32)
+#if (HAVE_OPENSSL_MD5)
#define MD5Init MD5_Init
#define MD5Update MD5_Update
#define MD5Final MD5_Final
@@ -71,14 +70,14 @@ int ngx_http_cache_open_file(ngx_http_request_t *r, ngx_http_cache_ctx_t *ctx,
}
if (uniq) {
- if (ngx_stat_fd(ctx->file.fd, &ctx->file.info) == NGX_FILE_ERROR) {
+ if (ngx_fd_info(ctx->file.fd, &ctx->file.info) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
- ngx_stat_fd_n " \"%s\" failed", ctx->file.name.data);
+ ngx_fd_info_n " \"%s\" failed", ctx->file.name.data);
return NGX_ERROR;
}
- if (ngx_file_uniq((&ctx->file.info)) == uniq) {
+ if (ngx_file_uniq(&ctx->file.info) == uniq) {
if (ngx_close_file(ctx->file.fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
ngx_close_file_n " \"%s\" failed",
@@ -140,12 +139,22 @@ int ngx_http_cache_update_file(ngx_http_request_t *r, ngx_http_cache_ctx_t *ctx,
retry = 0;
for ( ;; ) {
- if (ngx_rename_file(temp_file, (&ctx->file.name), r->pool) == NGX_OK) {
+ if (ngx_rename_file(temp_file->data, ctx->file.name.data) == NGX_OK) {
return NGX_OK;
}
err = ngx_errno;
+#if (WIN32)
+ if (err == NGX_EEXIST) {
+ if (ngx_win32_rename_file(temp_file, &ctx->file.name, r->pool)
+ == NGX_ERROR)
+ {
+ return NGX_ERROR;
+ }
+ }
+#endif
+
if (retry || (err != NGX_ENOENT && err != NGX_ENOTDIR)) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
ngx_rename_file_n "(\"%s\", \"%s\") failed",