nginx-0.0.1-2002-09-02-18:48:24 import
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 748b443..b2f3f5f 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -36,8 +36,6 @@
int main(int argc, char *const *argv)
{
- int i;
-
/* STUB */
ngx_log.log_level = NGX_LOG_DEBUG;
@@ -68,6 +66,8 @@
/* STUB */
ngx_worker(&ngx_log);
+
+ return 0;
}
static void ngx_open_listening_sockets(ngx_log_t *log)
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 88f374a..f7223fa 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -18,6 +18,7 @@
#include <winsock2.h>
#include <mswsock.h>
+#include <stddef.h> /* offsetof */
#include <stdio.h>
#include <stdarg.h>
@@ -88,6 +89,10 @@
#endif
+#ifndef HAVE_SELECT
+#define HAVE_SELECT 1
+#endif
+
#ifdef __FreeBSD__
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index cdd72bb..f275f91 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -21,6 +21,8 @@
ngx_event_t *write;
#endif
+ off_t sent;
+
ngx_log_t *log;
int (*handler)(ngx_connection_t *c);
ngx_server_t *server;
@@ -35,6 +37,8 @@
size_t addr_textlen;
unsigned int post_accept_timeout;
+
+ unsigned unexpected_eof:1;
};
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
new file mode 100644
index 0000000..0d68386
--- /dev/null
+++ b/src/core/ngx_file.h
@@ -0,0 +1,16 @@
+#ifndef _NGX_FILE_H_INCLUDED_
+#define _NGX_FILE_H_INCLUDED_
+
+
+#include <ngx_files.h>
+#include <ngx_log.h>
+
+typedef struct ngx_file_s ngx_file_t;
+
+struct ngx_file_s {
+ ngx_fd_t fd;
+ ngx_log_t *log;
+};
+
+
+#endif _NGX_FILE_H_INCLUDED_
diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c
index f829b7e..79a8ad7 100644
--- a/src/core/ngx_hunk.c
+++ b/src/core/ngx_hunk.c
@@ -1,13 +1,13 @@
-#include <ngx_file.h>
#include <ngx_hunk.h>
-ngx_hunk_t *ngx_get_hunk(ngx_pool_t *pool, int size, int before, int after)
+ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size,
+ int before, int after)
{
ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t));
-#ifndef OFF_EQUAL_PTR
+#if !(HAVE_OFFSET_EQUAL_PTR)
h->pos.file = h->last.file = 0;
#endif
@@ -18,16 +18,16 @@
h->type = NGX_HUNK_TEMP;
h->tag = 0;
- h->fd = (ngx_fd_t) -1;
+ h->file = NULL;
return h;
}
-ngx_hunk_t *ngx_get_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
+ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
{
ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t));
-#ifndef OFF_EQUAL_PTR
+#if !(HAVE_OFFSET_EQUAL_PTR)
h->pos.file = h->last.file = 0;
#endif
@@ -39,7 +39,7 @@
h->type = NGX_HUNK_TEMP;
h->tag = 0;
- h->fd = (ngx_fd_t) -1;
+ h->file = NULL;
} else {
h->pre_start = h->start = h->pos.mem = h->last.mem
@@ -48,17 +48,17 @@
h->type = NGX_HUNK_TEMP;
h->tag = 0;
- h->fd = (ngx_fd_t) -1;
+ h->file = NULL;
}
return h;
}
-ngx_hunk_t *ngx_get_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
+ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
{
ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t));
-#ifndef OFF_EQUAL_PTR
+#if !(HAVE_OFFSET_EQUAL_PTR)
h->pos.file = h->last.file = 0;
#endif
@@ -71,7 +71,7 @@
hunk->last.mem;
h->type = NGX_HUNK_TEMP;
h->tag = 0;
- h->fd = (ngx_fd_t) -1;
+ h->file = NULL;
} else {
h->pre_start = h->start = h->pos.mem = h->last.mem =
@@ -80,7 +80,7 @@
h->type = NGX_HUNK_TEMP;
h->tag = 0;
- h->fd = (ngx_fd_t) -1;
+ h->file = NULL;
}
return h;
diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h
index 3703db4..75aaef1 100644
--- a/src/core/ngx_hunk.h
+++ b/src/core/ngx_hunk.h
@@ -27,6 +27,8 @@
/* can be used with NGX_HUNK_LAST only */
#define NGX_HUNK_SHUTDOWN 0x0400
+#define NGX_HUNK_RECYCLED 0x0800
+
#define NGX_HUNK_IN_MEMORY (NGX_HUNK_TEMP|NGX_HUNK_MEMORY|NGX_HUNK_MMAP)
@@ -48,7 +50,7 @@
char *pre_start; /* start of pre-allocated hunk */
char *post_end; /* end of post-allocated hunk */
int tag;
- ngx_fd_t fd;
+ ngx_file_t *file;
};
typedef struct ngx_chain_s ngx_chain_t;
@@ -57,8 +59,11 @@
ngx_chain_t *next;
};
-#define ngx_create_temp_hunk(pool, size, before, after) \
- ngx_get_hunk(pool, size, before, after)
+
+ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size,
+ int before, int after);
+
+#define ngx_create_chain_entry(pool) ngx_palloc(pool, sizeof(ngx_chain_t))
#define ngx_add_hunk_to_chain(chain, h, pool, error) \
do { \
@@ -70,7 +75,6 @@
-ngx_hunk_t *ngx_get_hunk(ngx_pool_t *pool, int size, int before, int after);
#endif /* _NGX_CHUNK_H_INCLUDED_ */
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index bed628a..6a68358 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -45,7 +45,11 @@
" [%s] ", err_levels[level]);
len += ngx_snprintf(errstr + len, sizeof(errstr) - len - 1,
+#if (WIN32)
+ "%d#%d: ", 0, 0);
+#else
"%d#%d: ", getpid(), 0);
+#endif
#if (HAVE_VARIADIC_MACROS)
va_start(args, fmt);
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index f1e49eb..d79237e 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -3,7 +3,7 @@
#include <ngx_errno.h>
-#include <ngx_file.h>
+#include <ngx_files.h>
typedef enum {
NGX_LOG_EMERG = 0,