nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
diff --git a/src/http/modules/ngx_http_event_proxy_handler.c b/src/http/modules/ngx_http_event_proxy_handler.c
new file mode 100644
index 0000000..69adbe1
--- /dev/null
+++ b/src/http/modules/ngx_http_event_proxy_handler.c
@@ -0,0 +1,206 @@
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_string.h>
+#include <ngx_file.h>
+#include <ngx_hunk.h>
+#include <ngx_http.h>
+#include <ngx_http_event_proxy_handler.h>
+
+ngx_http_module_t ngx_http_proxy_module;
+
+
+static int ngx_http_proxy_connect(ngx_http_request_t *r,
+ struct sockaddr_in *addr,
+ char *addr_text);
+static int ngx_http_proxy_send_request(ngx_event_t *ev);
+
+
+int ngx_http_proxy_handler(ngx_http_request_t *r)
+{
+ struct sockaddr_in addr;
+ ngx_http_proxy_ctx_t *p;
+
+ p = (ngx_http_proxy_ctx_t *) ngx_get_module_ctx(r, ngx_http_proxy_module);
+
+ if (p == NULL)
+ ngx_http_create_ctx(r, p, ngx_http_proxy_module,
+ sizeof(ngx_http_proxy_ctx_t));
+
+ ngx_memzero(&addr, sizeof(struct sockaddr_in));
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = inet_addr("127.0.0.1");
+ addr.sin_port = htons(9000);
+
+ ngx_http_proxy_connect(r, &addr, "connecting to 127.0.0.1:9000");
+}
+
+static int ngx_http_proxy_connect(ngx_http_request_t *r,
+ struct sockaddr_in *addr,
+ char *addr_text)
+{
+ int rc;
+ ngx_err_t err;
+ ngx_socket_t s;
+ ngx_event_t *ev;
+ ngx_connection_t *c;
+ ngx_http_log_ctx_t *ctx;
+
+ c = r->connection;
+ ctx = c->log->data;
+ ctx->action = addr_text;
+
+ s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0);
+ if (s == -1) {
+ ngx_log_error(NGX_LOG_ERR, c->log, ngx_socket_errno,
+ ngx_socket_n " failed");
+ return NGX_ERROR;
+ }
+
+#if 0
+ if (rcvbuf) {
+ if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
+ (const void *) &rcvbuf, sizeof(int)) == -1) {
+ ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno,
+ "setsockopt(SO_RCVBUF) failed");
+
+ if (ngx_close_socket(s) == -1)
+ ngx_log_error(NGX_LOG_ERR, c->log, ngx_socket_errno,
+ ngx_close_socket_n " failed");
+
+ return NGX_ERROR;
+ }
+ }
+#endif
+
+ if (ngx_nonblocking(s) == -1) {
+ ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno,
+ ngx_nonblocking_n " failed");
+
+ if (ngx_close_socket(s) == -1)
+ ngx_log_error(NGX_LOG_ERR, c->log, ngx_socket_errno,
+ ngx_close_socket_n " failed");
+
+ return NGX_ERROR;
+ }
+
+ rc = connect(s, (struct sockaddr *) addr, sizeof(struct sockaddr_in));
+
+ if (rc == -1) {
+ err = ngx_socket_errno;
+ if (err != NGX_EINPROGRESS) {
+ ngx_log_error(NGX_LOG_ERR, c->log, err, "connect() failed");
+
+ if (ngx_close_socket(s) == -1)
+ ngx_log_error(NGX_LOG_ERR, c->log, ngx_socket_errno,
+ ngx_close_socket_n " failed");
+
+ return NGX_ERROR;
+ }
+ }
+
+ ngx_memzero(&ngx_read_events[s], sizeof(ngx_event_t));
+ ngx_memzero(&ngx_write_events[s], sizeof(ngx_event_t));
+ ngx_memzero(&ngx_connections[s], sizeof(ngx_connection_t));
+
+ ngx_read_events[s].data = ngx_write_events[s].data = &ngx_connections[s];
+ ngx_connections[s].read = &ngx_read_events[s];
+ ngx_connections[s].write = &ngx_write_events[s];
+
+ ngx_connections[s].fd = s;
+ ngx_connections[s].server = c->server;
+ ngx_connections[s].servers = c->servers;
+
+ ngx_connections[s].log =
+ ngx_read_events[s].log = ngx_write_events[s].log = c->log;
+
+ if (rc == -1) {
+ ngx_write_events[s].event_handler = ngx_http_proxy_send_request;
+
+ return ngx_add_event(&ngx_write_events[s],
+ NGX_WRITE_EVENT, NGX_ONESHOT_EVENT);
+ }
+
+ ngx_write_events[s].write = 1;
+ ngx_write_events[s].ready = 1;
+
+ return ngx_http_proxy_send_request(ev);
+}
+
+static int ngx_http_proxy_send_request(ngx_event_t *ev)
+{
+ return NGX_ERROR;
+}
+
+#if 0
+
+static int ngx_http_proxy_send_request(ngx_event_t *ev)
+{
+ ngx_connection_t *c;
+ ngx_http_request_t *r;
+ ngx_http_proxy_ctx_t *p;
+
+ c = (ngx_connection_t *) ev->data;
+ r = (ngx_http_request_t *) c->data;
+ p = (ngx_http_proxy_ctx_t *) ngx_get_module_ctx(r, ngx_http_proxy_module);
+
+ n = ngx_send(p->fd, p->header_out->pos.mem,
+ p->header_out->end.mem - p->header_out->pos.mem);
+
+ if (n == NGX_ERROR) {
+ ngx_log_error(NGX_LOG_ERR, r->log, ngx_socket_errno,
+ ngx_send_n " %s falied", p->addr_text);
+ return NGX_ERROR;
+ }
+
+ p->header_out->pos.mem += n;
+
+ if (p->header_out->end.mem - p->header_out->pos.mem > 0)
+ return NGX_AGAIN;
+
+ /* TODO: body */
+
+ return NGX_OK;
+}
+
+static int ngx_http_proxy_read_response_header(ngx_event_t *ev)
+{
+ ngx_connection_t *c;
+ ngx_http_request_t *r;
+ ngx_http_proxy_ctx_t *p;
+
+ if (ev->timedout)
+ return NGX_ERROR;
+
+ c = (ngx_connection_t *) ev->data;
+ r = (ngx_http_request_t *) c->data;
+ p = (ngx_http_proxy_ctx_t *) ngx_get_module_ctx(r, ngx_http_proxy_module);
+
+ n = ngx_event_recv(c, p->header_in->last.mem,
+ p->header_in->end - p->header_in->last.mem);
+
+}
+
+static int ngx_http_proxy_read_response_body(ngx_event_t *ev)
+{
+ ngx_connection_t *c;
+ ngx_http_request_t *r;
+ ngx_http_proxy_ctx_t *p;
+
+ if (ev->timedout)
+ return NGX_ERROR;
+
+ c = (ngx_connection_t *) ev->data;
+ r = (ngx_http_request_t *) c->data;
+ p = (ngx_http_proxy_ctx_t *) ngx_get_module_ctx(r, ngx_http_proxy_module);
+
+}
+
+static int ngx_http_proxy_write_to_client(ngx_event_t *ev)
+{
+ /* ÅÓÌÉ ÂÜËÅÎÄ ÂÙÓÔÒÅÅ, ÔÏ CLEAR, ÉÎÁÞÅ - ONESHOT */
+
+ rc = ngx_http_output_filter(r, h);
+}
+
+#endif
diff --git a/src/http/modules/ngx_http_event_proxy_handler.h b/src/http/modules/ngx_http_event_proxy_handler.h
new file mode 100644
index 0000000..85c2e79
--- /dev/null
+++ b/src/http/modules/ngx_http_event_proxy_handler.h
@@ -0,0 +1,18 @@
+#ifndef _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_
+#define _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_array.h>
+#include <ngx_http.h>
+
+
+typedef struct {
+ int dummy;
+} ngx_http_proxy_ctx_t;
+
+
+extern ngx_http_module_t ngx_http_proxy_module;
+
+
+#endif /* _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_ */
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c
index 898e577..6b20839 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -58,25 +58,25 @@
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- r->headers_out->status = NGX_HTTP_OK;
- r->headers_out->content_length = ngx_file_size(r->fileinfo);
+ r->headers_out.status = NGX_HTTP_OK;
+ r->headers_out.content_length = ngx_file_size(r->fileinfo);
/*
- r->headers_out->last_modified = ngx_file_mtime(r->fileinfo);
+ r->headers_out.last_modified = ngx_file_mtime(r->fileinfo);
*/
/* STUB */
if (r->exten) {
if (strcasecmp(r->exten, "html") == 0)
- r->headers_out->content_type = "text/html; charset=koi8-r";
+ r->headers_out.content_type = "text/html; charset=koi8-r";
else if (strcasecmp(r->exten, "gif") == 0)
- r->headers_out->content_type = "image/gif";
+ r->headers_out.content_type = "image/gif";
else if (strcasecmp(r->exten, "jpg") == 0)
- r->headers_out->content_type = "image/jpeg";
+ r->headers_out.content_type = "image/jpeg";
else if (strcasecmp(r->exten, "pdf") == 0)
- r->headers_out->content_type = "application/pdf";
+ r->headers_out.content_type = "application/pdf";
} else {
- r->headers_out->content_type = "text/html; charset=koi8-r";
+ r->headers_out.content_type = "text/html; charset=koi8-r";
}
/* STUB */
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 83ce8dd..7cecd5d 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -31,8 +31,8 @@
#if (WIN32)
ngx_http_server.doc_root = "html";
#else
- ngx_http_server.doc_root = "/home/is/work/xml/site-1.0.0/html";
ngx_http_server.doc_root = "/home/is/dox/";
+ ngx_http_server.doc_root = "/home/is/work/xml/site-1.0.0/html";
#endif
ngx_http_server.doc_root_len = strlen(ngx_http_server.doc_root) + 1;
diff --git a/src/http/ngx_http.h b/src/http/ngx_http.h
index 026c167..69dd20c 100644
--- a/src/http/ngx_http.h
+++ b/src/http/ngx_http.h
@@ -4,6 +4,8 @@
#include <ngx_config.h>
#include <ngx_types.h>
+#include <ngx_string.h>
+#include <ngx_table.h>
#include <ngx_hunk.h>
#include <ngx_files.h>
#include <ngx_connection.h>
@@ -56,6 +58,21 @@
} ngx_http_server_t;
typedef struct {
+ int len;
+ char *data;
+ int offset;
+} ngx_http_header_t;
+
+typedef struct {
+ ngx_table_elt_t *host;
+ ngx_table_elt_t *connection;
+ ngx_table_elt_t *user_agent;
+ ngx_table_elt_t *accept_encoding;
+
+ ngx_table_t *headers;
+} ngx_http_headers_in_t;
+
+typedef struct {
int status;
int connection;
off_t content_length;
@@ -82,10 +99,8 @@
ngx_pool_t *pool;
ngx_hunk_t *header_in;
-/*
- ngx_http_headers_in_t *headers_in;
-*/
- ngx_http_headers_out_t *headers_out;
+ ngx_http_headers_in_t headers_in;
+ ngx_http_headers_out_t headers_out;
int filename_len;
int (*handler)(ngx_http_request_t *r);
@@ -162,10 +177,10 @@
#define ngx_get_module_loc_conf(r, module) r->loc_conf[module.index]
#define ngx_get_module_ctx(r, module) r->ctx[module.index]
-#define ngx_http_create_ctx(r, ctx, module, size) \
+#define ngx_http_create_ctx(r, cx, module, size) \
do { \
- ngx_test_null(ctx, ngx_pcalloc(r->pool, size), NGX_ERROR); \
- r->ctx[module.index] = ctx; \
+ ngx_test_null(cx, ngx_pcalloc(r->pool, size), NGX_ERROR); \
+ r->ctx[module.index] = cx; \
} while (0)
diff --git a/src/http/ngx_http_core.c b/src/http/ngx_http_core.c
index a42e7cc..d8f8294 100644
--- a/src/http/ngx_http_core.c
+++ b/src/http/ngx_http_core.c
@@ -6,7 +6,8 @@
#include <ngx_http_config.h>
-static void *ngx_http_core_create_conf(ngx_pool_t *pool);
+static void *ngx_http_core_create_srv_conf(ngx_pool_t *pool);
+static void *ngx_http_core_create_loc_conf(ngx_pool_t *pool);
static ngx_command_t ngx_http_core_commands[];
@@ -14,8 +15,8 @@
ngx_http_module_t ngx_http_core_module = {
NGX_HTTP_MODULE,
- NULL, /* create server config */
- ngx_http_core_create_conf, /* create location config */
+ ngx_http_core_create_srv_conf, /* create server config */
+ ngx_http_core_create_loc_conf, /* create location config */
ngx_http_core_commands, /* module directives */
NULL, /* init module */
NULL /* init output body filter */
@@ -25,7 +26,7 @@
static ngx_command_t ngx_http_core_commands[] = {
{"send_timeout", ngx_conf_set_time_slot,
- offsetof(ngx_http_core_conf_t, send_timeout),
+ offsetof(ngx_http_core_loc_conf_t, send_timeout),
NGX_HTTP_LOC_CONF, NGX_CONF_TAKE1,
"set timeout for sending response"},
@@ -34,12 +35,23 @@
};
-static void *ngx_http_core_create_conf(ngx_pool_t *pool)
+static void *ngx_http_core_create_srv_conf(ngx_pool_t *pool)
{
- ngx_http_core_conf_t *conf;
+ ngx_http_core_srv_conf_t *conf;
ngx_test_null(conf,
- ngx_pcalloc(pool, sizeof(ngx_http_core_conf_t)),
+ ngx_pcalloc(pool, sizeof(ngx_http_core_srv_conf_t)),
+ NULL);
+
+ return conf;
+}
+
+static void *ngx_http_core_create_loc_conf(ngx_pool_t *pool)
+{
+ ngx_http_core_loc_conf_t *conf;
+
+ ngx_test_null(conf,
+ ngx_pcalloc(pool, sizeof(ngx_http_core_loc_conf_t)),
NULL);
conf->send_timeout = NGX_CONF_UNSET;
@@ -47,3 +59,15 @@
return conf;
}
+#if 0
+static void *ngx_http_core_create_conf(ngx_pool_t *pool)
+{
+
+ ngx_test_null(conf, ngx_palloc(pool, sizeof(ngx_http_core_conf_t)), NULL);
+
+ ngx_test_null(conf->srv, ngx_http_core_create_srv_conf_t(pool), NULL);
+ ngx_test_null(conf->loc, ngx_http_core_create_loc_conf_t(pool), NULL);
+ conf->parent =
+ conf->next = NULL;
+}
+#endif
diff --git a/src/http/ngx_http_core.h b/src/http/ngx_http_core.h
index 976ae54..e9846f8 100644
--- a/src/http/ngx_http_core.h
+++ b/src/http/ngx_http_core.h
@@ -6,9 +6,17 @@
typedef struct {
- time_t send_timeout;
+ int dummy;
} ngx_http_core_conf_t;
+typedef struct {
+ int dummy;
+} ngx_http_core_srv_conf_t;
+
+typedef struct {
+ time_t send_timeout;
+} ngx_http_core_loc_conf_t;
+
extern ngx_http_module_t ngx_http_core_module;
diff --git a/src/http/ngx_http_event.c b/src/http/ngx_http_event.c
index 258a6c7..8c27f37 100644
--- a/src/http/ngx_http_event.c
+++ b/src/http/ngx_http_event.c
@@ -9,6 +9,8 @@
#include <ngx_files.h>
#include <ngx_log.h>
#include <ngx_alloc.h>
+#include <ngx_array.h>
+#include <ngx_table.h>
#include <ngx_hunk.h>
#include <ngx_connection.h>
#include <ngx_http.h>
@@ -19,6 +21,7 @@
#include <ngx_http_output_filter.h>
int ngx_http_static_handler(ngx_http_request_t *r);
int ngx_http_index_handler(ngx_http_request_t *r);
+int ngx_http_proxy_handler(ngx_http_request_t *r);
/* */
int ngx_http_init_connection(ngx_connection_t *c);
@@ -60,6 +63,15 @@
};
+static ngx_http_header_t headers_in[] = {
+ { 4, "Host", offsetof(ngx_http_headers_in_t, host) },
+ { 10, "Connection", offsetof(ngx_http_headers_in_t, connection) },
+
+ { 10, "User-Agent", offsetof(ngx_http_headers_in_t, user_agent) },
+
+ { 0, NULL, 0 }
+};
+
int ngx_http_init_connection(ngx_connection_t *c)
{
@@ -292,6 +304,8 @@
/* TODO: check too long URI - no space for header, compact buffer */
+ r->headers_in.headers = ngx_create_table(r->pool, 10);
+
r->state_handler = ngx_http_process_request_header;
ctx = r->connection->log->data;
ctx->action = "reading client request headers";
@@ -355,11 +369,31 @@
static int ngx_http_process_request_header_line(ngx_http_request_t *r)
{
- /* STUB */
- *r->header_name_end = '\0';
- *r->header_end = '\0';
+ int i;
+ ngx_table_elt_t *h;
+
+ ngx_test_null(h, ngx_push_array(r->headers_in.headers), NGX_ERROR);
+
+ h->key.len = r->header_name_end - r->header_name_start;
+ ngx_test_null(h->key.data, ngx_palloc(r->pool, h->key.len + 1), NGX_ERROR);
+ ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
+
+ h->value.len = r->header_end - r->header_start;
+ ngx_test_null(h->value.data, ngx_palloc(r->pool, h->value.len + 1),
+ NGX_ERROR);
+ ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
+
+ for (i = 0; headers_in[i].len != 0; i++) {
+ if (headers_in[i].len == h->key.len) {
+ if (strcasecmp(headers_in[i].data, h->key.data) == 0) {
+ *((ngx_table_elt_t **)
+ ((char *) &r->headers_in + headers_in[i].offset)) = h;
+ }
+ }
+ }
+
ngx_log_debug(r->connection->log, "HTTP header: '%s: %s'" _
- r->header_name_start _ r->header_start);
+ h->key.data _ h->value.data);
return NGX_OK;
}
@@ -446,6 +480,10 @@
int rc;
ngx_msec_t timeout;
+ ngx_log_debug(r->connection->log, "UA: '%s: %s'" _
+ r->headers_in.user_agent->key.data _
+ r->headers_in.user_agent->value.data);
+
rc = ngx_http_handler(r);
/* transfer not completed */
@@ -545,9 +583,17 @@
int err, rc;
char *name, *loc, *file;
+#if 0
+ /* STUB */
+ r->handler = ngx_http_proxy_handler;
+ return NGX_OK;
+#endif
+
+/* NO NEEDED
ngx_test_null(r->headers_out,
ngx_pcalloc(r->pool, sizeof(ngx_http_headers_out_t)),
NGX_HTTP_INTERNAL_SERVER_ERROR);
+*/
if (*(r->uri_end - 1) == '/') {
r->handler = ngx_http_index_handler;
@@ -583,7 +629,7 @@
ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->filename);
*file++ = '/';
*file = '\0';
- r->headers_out->location = r->location;
+ r->headers_out.location = r->location;
return NGX_HTTP_MOVED_PERMANENTLY;
}
@@ -605,10 +651,10 @@
static int ngx_http_writer(ngx_event_t *ev)
{
int rc;
- ngx_msec_t timeout;
- ngx_connection_t *c;
- ngx_http_request_t *r;
- ngx_http_core_conf_t *conf;
+ ngx_msec_t timeout;
+ ngx_connection_t *c;
+ ngx_http_request_t *r;
+ ngx_http_core_loc_conf_t *conf;
c = (ngx_connection_t *) ev->data;
r = (ngx_http_request_t *) c->data;
@@ -622,7 +668,7 @@
if (rc == NGX_AGAIN) {
if (c->sent > 0) {
- conf = (ngx_http_core_conf_t *)
+ conf = (ngx_http_core_loc_conf_t *)
ngx_get_module_loc_conf(r->main ? r->main : r,
ngx_http_core_module);
diff --git a/src/http/ngx_http_get_time.c b/src/http/ngx_http_get_time.c
new file mode 100644
index 0000000..5885df0
--- /dev/null
+++ b/src/http/ngx_http_get_time.c
@@ -0,0 +1,13 @@
+
+#include <nginx.h>
+
+#include <ngx_config.h>
+
+
+ngx_http_get_time(char *buf, time_t t)
+{
+ struct tm *tp;
+
+ tp = gmtime(&t);
+ return strftime(buf, 31, "%a, %d %b %Y %H:%M:%S GMT", tp);
+}
diff --git a/src/http/ngx_http_header_filter.c b/src/http/ngx_http_header_filter.c
index 2c76aac..3c3ab91 100644
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -29,7 +29,7 @@
ngx_test_null(h, ngx_create_temp_hunk(r->pool, 1024, 0, 64),
NGX_ERROR);
- status = r->headers_out->status - NGX_HTTP_OK;
+ status = r->headers_out.status - NGX_HTTP_OK;
ngx_memcpy(h->last.mem, "HTTP/1.1 ", 9);
h->last.mem += 9;
@@ -43,28 +43,26 @@
h->last.mem += 24;
#endif
-/*
ngx_memcpy(h->last.mem, "Date: ", 6);
h->last.mem += 6;
h->last.mem += ngx_http_get_time(h->last.mem, time(NULL));
*(h->last.mem++) = CR; *(h->last.mem++) = LF;
-*/
/* 2^64 is 20 characters */
- if (r->headers_out->content_length)
+ if (r->headers_out.content_length)
h->last.mem += ngx_snprintf(h->last.mem, 49, "Content-Length: %d" CRLF,
- r->headers_out->content_length);
+ r->headers_out.content_length);
/* check */
- if (r->headers_out->content_type)
+ if (r->headers_out.content_type)
h->last.mem += ngx_snprintf(h->last.mem, 100, "Content-Type: %s" CRLF,
- r->headers_out->content_type);
+ r->headers_out.content_type);
ngx_memcpy(h->last.mem, "Server: ", 8);
h->last.mem += 8;
- if (r->headers_out->server) {
- h->last.mem = ngx_cpystrn(h->last.mem, r->headers_out->server,
+ if (r->headers_out.server) {
+ h->last.mem = ngx_cpystrn(h->last.mem, r->headers_out.server,
h->end - h->last.mem);
/* check space */
diff --git a/src/http/ngx_http_output_filter.c b/src/http/ngx_http_output_filter.c
index 462b2f5..e86c6c1 100644
--- a/src/http/ngx_http_output_filter.c
+++ b/src/http/ngx_http_output_filter.c
@@ -90,7 +90,7 @@
ctx->out.hunk = ctx->hunk;
rc = ngx_http_output_filter_copy_hunk(ctx->hunk, ctx->in->hunk);
-#if (NGX_FILE_AIO)
+#if (NGX_FILE_AIO_READ)
if (rc == NGX_AGAIN)
return rc;
#endif
@@ -178,7 +178,7 @@
rc = ngx_http_output_filter_copy_hunk(ctx->hunk,
hunk);
-#if (NGX_FILE_AIO)
+#if (NGX_FILE_AIO_READ)
if (rc == NGX_AGAIN) {
/* add hunk to input chain */
ngx_add_hunk_to_chain(ctx->in, hunk, r->pool,
@@ -243,7 +243,7 @@
if (n == NGX_ERROR) {
return n;
-#if (NGX_FILE_AIO)
+#if (NGX_FILE_AIO_READ)
} else if (n == NGX_AGAIN) {
return n;
#endif