nginx-0.0.7-2004-06-16-19:32:11 import
diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c
index 90973a6..9c5266a 100644
--- a/src/core/ngx_buf.c
+++ b/src/core/ngx_buf.c
@@ -84,7 +84,8 @@
}
-int ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in)
+ngx_int_t ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
+ ngx_chain_t *in)
{
ngx_chain_t *cl, **ll;
diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h
index bfae4ac..301d8f7 100644
--- a/src/core/ngx_buf.h
+++ b/src/core/ngx_buf.h
@@ -170,10 +170,11 @@
last = &cl->next
-int ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in);
-int ngx_chain_writer(void *data, ngx_chain_t *in);
+ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in);
+ngx_int_t ngx_chain_writer(void *data, ngx_chain_t *in);
-int ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in);
+ngx_int_t ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
+ ngx_chain_t *in);
void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
ngx_chain_t **out, ngx_buf_tag_t tag);
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 4b9fd90..ec61e94 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -90,15 +90,15 @@
struct ngx_module_s {
- int ctx_index;
- int index;
+ ngx_uint_t ctx_index;
+ ngx_uint_t index;
void *ctx;
ngx_command_t *commands;
- int type;
- int (*init_module)(ngx_cycle_t *cycle);
- int (*init_process)(ngx_cycle_t *cycle);
+ ngx_uint_t type;
+ ngx_int_t (*init_module)(ngx_cycle_t *cycle);
+ ngx_int_t (*init_process)(ngx_cycle_t *cycle);
#if 0
- int (*init_thread)(ngx_cycle_t *cycle);
+ ngx_int_t (*init_thread)(ngx_cycle_t *cycle);
#endif
};
@@ -113,7 +113,7 @@
typedef struct {
ngx_file_t file;
ngx_buf_t *buffer;
- int line;
+ ngx_uint_t line;
} ngx_conf_file_t;
@@ -131,8 +131,8 @@
ngx_log_t *log;
void *ctx;
- int module_type;
- int cmd_type;
+ ngx_uint_t module_type;
+ ngx_uint_t cmd_type;
ngx_conf_handler_pt handler;
char *handler_conf;
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 57039b9..465e1bf 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -31,12 +31,6 @@
#endif
-/* STUB: autoconf */
-typedef int ngx_int_t;
-typedef u_int ngx_uint_t;
-typedef int ngx_flag_t;
-
-
#if !(WIN32)
#define ngx_signal_helper(n) SIG##n
@@ -58,6 +52,26 @@
#define NGX_INVALID_ARRAY_INDEX 0x80000000
+#if 1
+/* STUB: autoconf */
+typedef int ngx_int_t;
+typedef u_int ngx_uint_t;
+typedef int ngx_flag_t;
+#define NGX_INT_T_LEN sizeof("-2147483648") - 1
+#define NGX_INT_T_FMT "d"
+#define NGX_UINT_T_FMT "u"
+
+#else
+
+typedef long ngx_int_t;
+typedef u_long ngx_uint_t;
+typedef long ngx_flag_t;
+#define NGX_INT_T_LEN sizeof("-9223372036854775808") - 1
+#define NGX_INT_T_FMT "lld"
+#define NGX_UINT_T_FMT "llu"
+
+#endif
+
/* TODO: auto */
#define NGX_INT32_LEN sizeof("-2147483648") - 1
#define NGX_INT64_LEN sizeof("-9223372036854775808") - 1
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index 8dbc4e4..67275bd 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -97,7 +97,7 @@
ngx_buf_t *buffer;
- ngx_int_t number;
+ ngx_uint_t number;
unsigned log_error:2; /* ngx_connection_log_error_e */
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index 5ea4fd9..7ab202c 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -7,13 +7,13 @@
#define NGX_NONE 1
-ngx_inline static int ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx,
- ngx_buf_t *buf);
+ngx_inline static ngx_int_t
+ ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf);
static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src,
ngx_uint_t sendfile);
-int ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
+ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
{
int rc, last;
size_t size, bsize;
@@ -168,8 +168,8 @@
}
-ngx_inline static int ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx,
- ngx_buf_t *buf)
+ngx_inline static ngx_int_t
+ ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
{
if (ngx_buf_special(buf)) {
return 0;
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 71e6918..4a844e9 100644
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -16,12 +16,12 @@
} ngx_kqueue_conf_t;
-static int ngx_kqueue_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_kqueue_init(ngx_cycle_t *cycle);
static void ngx_kqueue_done(ngx_cycle_t *cycle);
-static int ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags);
-static int ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags);
-static int ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags);
-static int ngx_kqueue_process_events(ngx_cycle_t *cycle);
+static ngx_int_t ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags);
+static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags);
+static ngx_int_t ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags);
+static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle);
static ngx_inline void ngx_kqueue_dump_event(ngx_log_t *log,
struct kevent *kev);
@@ -87,7 +87,7 @@
-static int ngx_kqueue_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_kqueue_init(ngx_cycle_t *cycle)
{
struct timespec ts;
ngx_kqueue_conf_t *kcf;
@@ -184,7 +184,7 @@
}
-static int ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags)
+static ngx_int_t ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags)
{
ngx_event_t *e;
ngx_connection_t *c;
@@ -229,7 +229,7 @@
}
-static int ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags)
+static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags)
{
ngx_event_t *e;
@@ -276,7 +276,7 @@
}
-static int ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags)
+static ngx_int_t ngx_kqueue_set_event(ngx_event_t *ev, int filter, u_int flags)
{
struct timespec ts;
ngx_connection_t *c;
diff --git a/src/event/modules/ngx_poll_module.c b/src/event/modules/ngx_poll_module.c
index b40499d..64f7cec 100644
--- a/src/event/modules/ngx_poll_module.c
+++ b/src/event/modules/ngx_poll_module.c
@@ -9,11 +9,11 @@
#include <ngx_event.h>
-static int ngx_poll_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_poll_init(ngx_cycle_t *cycle);
static void ngx_poll_done(ngx_cycle_t *cycle);
-static int ngx_poll_add_event(ngx_event_t *ev, int event, u_int flags);
-static int ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags);
-int ngx_poll_process_events(ngx_cycle_t *cycle);
+static ngx_int_t ngx_poll_add_event(ngx_event_t *ev, int event, u_int flags);
+static ngx_int_t ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags);
+static ngx_int_t ngx_poll_process_events(ngx_cycle_t *cycle);
static struct pollfd *event_list;
@@ -58,7 +58,7 @@
-static int ngx_poll_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_poll_init(ngx_cycle_t *cycle)
{
struct pollfd *list;
@@ -118,7 +118,7 @@
}
-static int ngx_poll_add_event(ngx_event_t *ev, int event, u_int flags)
+static ngx_int_t ngx_poll_add_event(ngx_event_t *ev, int event, u_int flags)
{
ngx_event_t *e;
ngx_connection_t *c;
@@ -171,7 +171,7 @@
}
-static int ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags)
+static ngx_int_t ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags)
{
ngx_uint_t i;
ngx_cycle_t **cycle;
@@ -259,7 +259,7 @@
}
-int ngx_poll_process_events(ngx_cycle_t *cycle)
+static ngx_int_t ngx_poll_process_events(ngx_cycle_t *cycle)
{
int ready;
ngx_int_t i, nready;
@@ -272,33 +272,27 @@
ngx_connection_t *c;
struct timeval tv;
- if (ngx_event_flags & NGX_OVERFLOW_EVENT) {
- timer = 0;
+ for ( ;; ) {
+ timer = ngx_event_find_timer();
+
+ if (timer != 0) {
+ break;
+ }
+
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
+ "poll expired timer");
+
+ ngx_event_expire_timers((ngx_msec_t)
+ (ngx_elapsed_msec - ngx_old_elapsed_msec));
+ }
+
+ /* NGX_TIMER_INFINITE == INFTIM */
+
+ if (timer == NGX_TIMER_INFINITE) {
expire = 0;
} else {
- for ( ;; ) {
- timer = ngx_event_find_timer();
-
- if (timer != 0) {
- break;
- }
-
- ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
- "poll expired timer");
-
- ngx_event_expire_timers((ngx_msec_t)
- (ngx_elapsed_msec - ngx_old_elapsed_msec));
- }
-
- /* NGX_TIMER_INFINITE == INFTIM */
-
- if (timer == NGX_TIMER_INFINITE) {
- expire = 0;
-
- } else {
- expire = 1;
- }
+ expire = 1;
}
ngx_old_elapsed_msec = ngx_elapsed_msec;
@@ -372,14 +366,6 @@
}
}
- if ((ngx_event_flags & NGX_OVERFLOW_EVENT) && timer == 0 && ready == 0) {
-
- /* the overflowed rt signals queue has been drained */
-
- ngx_accept_mutex_unlock();
- return NGX_OK;
- }
-
if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) {
ngx_accept_mutex_unlock();
return NGX_ERROR;
diff --git a/src/event/modules/ngx_select_module.c b/src/event/modules/ngx_select_module.c
index 93b3cf3..4d50427 100644
--- a/src/event/modules/ngx_select_module.c
+++ b/src/event/modules/ngx_select_module.c
@@ -10,11 +10,11 @@
-static int ngx_select_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_select_init(ngx_cycle_t *cycle);
static void ngx_select_done(ngx_cycle_t *cycle);
-static int ngx_select_add_event(ngx_event_t *ev, int event, u_int flags);
-static int ngx_select_del_event(ngx_event_t *ev, int event, u_int flags);
-static int ngx_select_process_events(ngx_cycle_t *cycle);
+static ngx_int_t ngx_select_add_event(ngx_event_t *ev, int event, u_int flags);
+static ngx_int_t ngx_select_del_event(ngx_event_t *ev, int event, u_int flags);
+static ngx_int_t ngx_select_process_events(ngx_cycle_t *cycle);
static char *ngx_select_init_conf(ngx_cycle_t *cycle, void *conf);
@@ -72,7 +72,7 @@
};
-static int ngx_select_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_select_init(ngx_cycle_t *cycle)
{
ngx_event_t **index;
@@ -135,7 +135,7 @@
}
-static int ngx_select_add_event(ngx_event_t *ev, int event, u_int flags)
+static ngx_int_t ngx_select_add_event(ngx_event_t *ev, int event, u_int flags)
{
ngx_connection_t *c;
@@ -196,7 +196,7 @@
}
-static int ngx_select_del_event(ngx_event_t *ev, int event, u_int flags)
+static ngx_int_t ngx_select_del_event(ngx_event_t *ev, int event, u_int flags)
{
ngx_connection_t *c;
@@ -249,7 +249,7 @@
}
-static int ngx_select_process_events(ngx_cycle_t *cycle)
+static ngx_int_t ngx_select_process_events(ngx_cycle_t *cycle)
{
int ready, nready;
ngx_uint_t i, found, lock, expire;
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
index d669182..a74430a 100644
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -504,7 +504,7 @@
ngx_event_conf_t *old_ecf;
ngx_event_module_t *module;
- if (ecf->use != NGX_CONF_UNSET) {
+ if (ecf->use != NGX_CONF_UNSET_UINT) {
return "is duplicate" ;
}
@@ -633,19 +633,19 @@
#if (HAVE_KQUEUE)
ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_value(ecf->use, ngx_kqueue_module.ctx_index);
+ ngx_conf_init_unsigned_value(ecf->use, ngx_kqueue_module.ctx_index);
ngx_conf_init_ptr_value(ecf->name, ngx_kqueue_module_ctx.name->data);
#elif (HAVE_DEVPOLL)
ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_value(ecf->use, ngx_devpoll_module.ctx_index);
+ ngx_conf_init_unsigned_value(ecf->use, ngx_devpoll_module.ctx_index);
ngx_conf_init_ptr_value(ecf->name, ngx_devpoll_module_ctx.name->data);
#elif (HAVE_EPOLL)
ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_value(ecf->use, ngx_epoll_module.ctx_index);
+ ngx_conf_init_unsigned_value(ecf->use, ngx_epoll_module.ctx_index);
ngx_conf_init_ptr_value(ecf->name, ngx_epoll_module_ctx.name->data);
#elif (HAVE_RTSIG)
@@ -653,7 +653,7 @@
ngx_core_conf_t *ccf;
ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_value(ecf->use, ngx_rtsig_module.ctx_index);
+ ngx_conf_init_unsigned_value(ecf->use, ngx_rtsig_module.ctx_index);
ngx_conf_init_ptr_value(ecf->name, ngx_rtsig_module_ctx.name->data);
#elif (HAVE_SELECT)
@@ -665,7 +665,7 @@
FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS);
#endif
- ngx_conf_init_value(ecf->use, ngx_select_module.ctx_index);
+ ngx_conf_init_unsigned_value(ecf->use, ngx_select_module.ctx_index);
ngx_conf_init_ptr_value(ecf->name, ngx_select_module_ctx.name->data);
#else
@@ -694,9 +694,9 @@
return NGX_CONF_ERROR;
}
- ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
+ ngx_conf_unsigned_init_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_value(ecf->use, m);
+ ngx_conf_unsigned_init_value(ecf->use, m);
ngx_conf_init_ptr_value(ecf->name, module->name->data);
#endif
diff --git a/src/event/ngx_event.h b/src/event/ngx_event.h
index 986ae0e..0c2e5d8 100644
--- a/src/event/ngx_event.h
+++ b/src/event/ngx_event.h
@@ -177,18 +177,18 @@
typedef struct {
- int (*add)(ngx_event_t *ev, int event, u_int flags);
- int (*del)(ngx_event_t *ev, int event, u_int flags);
+ ngx_int_t (*add)(ngx_event_t *ev, int event, u_int flags);
+ ngx_int_t (*del)(ngx_event_t *ev, int event, u_int flags);
- int (*enable)(ngx_event_t *ev, int event, u_int flags);
- int (*disable)(ngx_event_t *ev, int event, u_int flags);
+ ngx_int_t (*enable)(ngx_event_t *ev, int event, u_int flags);
+ ngx_int_t (*disable)(ngx_event_t *ev, int event, u_int flags);
- int (*add_conn)(ngx_connection_t *c);
- int (*del_conn)(ngx_connection_t *c, u_int flags);
+ ngx_int_t (*add_conn)(ngx_connection_t *c);
+ ngx_int_t (*del_conn)(ngx_connection_t *c, u_int flags);
- int (*process)(ngx_cycle_t *cycle);
- int (*init)(ngx_cycle_t *cycle);
- void (*done)(ngx_cycle_t *cycle);
+ ngx_int_t (*process)(ngx_cycle_t *cycle);
+ ngx_int_t (*init)(ngx_cycle_t *cycle);
+ void (*done)(ngx_cycle_t *cycle);
} ngx_event_actions_t;
@@ -249,21 +249,16 @@
#define NGX_USE_RTSIG_EVENT 0x00000100
/*
- * The alternative event method after the rt signals queue overflow.
- */
-#define NGX_OVERFLOW_EVENT 0x00000200
-
-/*
* No need to add or delete the event filters - overlapped, aio_read,
* aioread, io_submit.
*/
-#define NGX_USE_AIO_EVENT 0x00000400
+#define NGX_USE_AIO_EVENT 0x00000200
/*
* Need to add socket or handle only once - i/o completion port.
* It also requires HAVE_AIO and NGX_USE_AIO_EVENT to be set.
*/
-#define NGX_USE_IOCP_EVENT 0x00000800
+#define NGX_USE_IOCP_EVENT 0x00000400
@@ -390,7 +385,7 @@
typedef struct {
ngx_uint_t connections;
- ngx_int_t use;
+ ngx_uint_t use;
ngx_flag_t multi_accept;
ngx_flag_t accept_mutex;
diff --git a/src/http/modules/ngx_http_charset_filter.c b/src/http/modules/ngx_http_charset_filter.c
index b79a460..63ac0e1 100644
--- a/src/http/modules/ngx_http_charset_filter.c
+++ b/src/http/modules/ngx_http_charset_filter.c
@@ -128,7 +128,7 @@
static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
-static int ngx_http_charset_header_filter(ngx_http_request_t *r)
+static ngx_int_t ngx_http_charset_header_filter(ngx_http_request_t *r)
{
ngx_http_charset_t *charsets;
ngx_http_charset_ctx_t *ctx;
@@ -190,7 +190,8 @@
}
-static int ngx_http_charset_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
+static ngx_int_t ngx_http_charset_body_filter(ngx_http_request_t *r,
+ ngx_chain_t *in)
{
char *table;
ngx_chain_t *cl;
diff --git a/src/http/modules/ngx_http_chunked_filter.c b/src/http/modules/ngx_http_chunked_filter.c
index c429fa8..bd4c270 100644
--- a/src/http/modules/ngx_http_chunked_filter.c
+++ b/src/http/modules/ngx_http_chunked_filter.c
@@ -4,7 +4,7 @@
#include <ngx_http.h>
-static int ngx_http_chunked_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_chunked_filter_init(ngx_cycle_t *cycle);
static ngx_http_module_t ngx_http_chunked_filter_module_ctx = {
@@ -35,7 +35,7 @@
static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
-static int ngx_http_chunked_header_filter(ngx_http_request_t *r)
+static ngx_int_t ngx_http_chunked_header_filter(ngx_http_request_t *r)
{
if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED) {
return ngx_http_next_header_filter(r);
@@ -54,7 +54,8 @@
}
-static int ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
+static ngx_int_t ngx_http_chunked_body_filter(ngx_http_request_t *r,
+ ngx_chain_t *in)
{
u_char *chunk;
size_t size, len;
@@ -138,7 +139,7 @@
}
-static int ngx_http_chunked_filter_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_http_chunked_filter_init(ngx_cycle_t *cycle)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_chunked_header_filter;
diff --git a/src/http/modules/ngx_http_gzip_filter.c b/src/http/modules/ngx_http_gzip_filter.c
index 0e02015..5f3825e 100644
--- a/src/http/modules/ngx_http_gzip_filter.c
+++ b/src/http/modules/ngx_http_gzip_filter.c
@@ -64,8 +64,8 @@
} ngx_http_gzip_ctx_t;
-static int ngx_http_gzip_proxied(ngx_http_request_t *r,
- ngx_http_gzip_conf_t *conf);
+static ngx_int_t ngx_http_gzip_proxied(ngx_http_request_t *r,
+ ngx_http_gzip_conf_t *conf);
static void *ngx_http_gzip_filter_alloc(void *opaque, u_int items,
u_int size);
static void ngx_http_gzip_filter_free(void *opaque, void *address);
@@ -74,8 +74,8 @@
static u_char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
-static int ngx_http_gzip_pre_conf(ngx_conf_t *cf);
-static int ngx_http_gzip_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_gzip_pre_conf(ngx_conf_t *cf);
+static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle);
static void *ngx_http_gzip_create_conf(ngx_conf_t *cf);
static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
void *parent, void *child);
@@ -238,7 +238,7 @@
static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
-static int ngx_http_gzip_header_filter(ngx_http_request_t *r)
+static ngx_int_t ngx_http_gzip_header_filter(ngx_http_request_t *r)
{
ngx_http_gzip_ctx_t *ctx;
ngx_http_gzip_conf_t *conf;
@@ -288,10 +288,7 @@
* hangs up or crashes
*/
- if (r->headers_in.user_agent
- && r->unparsed_uri.len > 200
- && ngx_strstr(r->headers_in.user_agent->value.data, "MSIE 4"))
- {
+ if (r->headers_in.msie4 && r->unparsed_uri.len > 200) {
return ngx_http_next_header_filter(r);
}
@@ -323,8 +320,8 @@
}
-static int ngx_http_gzip_proxied(ngx_http_request_t *r,
- ngx_http_gzip_conf_t *conf)
+static ngx_int_t ngx_http_gzip_proxied(ngx_http_request_t *r,
+ ngx_http_gzip_conf_t *conf)
{
time_t date, expires;
@@ -403,7 +400,8 @@
}
-static int ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
+static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r,
+ ngx_chain_t *in)
{
int rc, wbits, memlevel, last;
struct gztrailer *trailer;
@@ -819,7 +817,8 @@
}
return buf + ngx_snprintf((char *) buf, NGX_INT32_LEN + 4,
- "%d.%02d", zint, zfrac);
+ "%" NGX_UINT_T_FMT ".%02" NGX_UINT_T_FMT,
+ zint, zfrac);
}
@@ -838,7 +837,7 @@
}
-static int ngx_http_gzip_pre_conf(ngx_conf_t *cf)
+static ngx_int_t ngx_http_gzip_pre_conf(ngx_conf_t *cf)
{
ngx_http_log_op_name_t *op;
@@ -859,7 +858,7 @@
}
-static int ngx_http_gzip_filter_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_gzip_header_filter;
@@ -894,9 +893,9 @@
conf->http_version = NGX_CONF_UNSET_UINT;
conf->level = NGX_CONF_UNSET;
- conf->wbits = NGX_CONF_UNSET_UINT;
- conf->memlevel = NGX_CONF_UNSET_UINT;
- conf->min_length = NGX_CONF_UNSET_UINT;
+ conf->wbits = (size_t) NGX_CONF_UNSET;
+ conf->memlevel = (size_t) NGX_CONF_UNSET;
+ conf->min_length = NGX_CONF_UNSET;
return conf;
}
diff --git a/src/http/modules/ngx_http_headers_filter.c b/src/http/modules/ngx_http_headers_filter.c
index 560b5b1..7f74b47 100644
--- a/src/http/modules/ngx_http_headers_filter.c
+++ b/src/http/modules/ngx_http_headers_filter.c
@@ -14,7 +14,7 @@
#define NGX_HTTP_EXPIRES_EPOCH -2147483645
-static int ngx_http_headers_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_headers_filter_init(ngx_cycle_t *cycle);
static void *ngx_http_headers_create_conf(ngx_conf_t *cf);
static char *ngx_http_headers_merge_conf(ngx_conf_t *cf,
void *parent, void *child);
@@ -61,7 +61,7 @@
static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
-static int ngx_http_headers_filter(ngx_http_request_t *r)
+static ngx_int_t ngx_http_headers_filter(ngx_http_request_t *r)
{
size_t len;
ngx_table_elt_t *expires, *cc;
@@ -145,7 +145,7 @@
}
-static int ngx_http_headers_filter_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_http_headers_filter_init(ngx_cycle_t *cycle)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_headers_filter;
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index de609ac..80e4d19 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -29,7 +29,7 @@
static ngx_int_t ngx_http_index_error(ngx_http_request_t *r,
ngx_http_index_ctx_t *ctx, ngx_err_t err);
-static int ngx_http_index_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_index_init(ngx_cycle_t *cycle);
static void *ngx_http_index_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
@@ -95,7 +95,7 @@
* that path contains the usual file in place of the directory.
*/
-int ngx_http_index_handler(ngx_http_request_t *r)
+ngx_int_t ngx_http_index_handler(ngx_http_request_t *r)
{
u_char *name;
ngx_fd_t fd;
@@ -361,7 +361,7 @@
}
-static int ngx_http_index_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_http_index_init(ngx_cycle_t *cycle)
{
ngx_http_handler_pt *h;
ngx_http_conf_ctx_t *ctx;
diff --git a/src/http/modules/ngx_http_not_modified_filter.c b/src/http/modules/ngx_http_not_modified_filter.c
index e1a961f..f14a78b 100644
--- a/src/http/modules/ngx_http_not_modified_filter.c
+++ b/src/http/modules/ngx_http_not_modified_filter.c
@@ -5,7 +5,7 @@
-static int ngx_http_not_modified_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_not_modified_filter_init(ngx_cycle_t *cycle);
static ngx_http_module_t ngx_http_not_modified_filter_module_ctx = {
@@ -35,7 +35,7 @@
static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
-static int ngx_http_not_modified_header_filter(ngx_http_request_t *r)
+static ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
{
time_t ims;
@@ -71,7 +71,7 @@
}
-static int ngx_http_not_modified_filter_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_http_not_modified_filter_init(ngx_cycle_t *cycle)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_not_modified_header_filter;
diff --git a/src/http/modules/ngx_http_range_filter.c b/src/http/modules/ngx_http_range_filter.c
index 65a5fd0..8d3e3dd 100644
--- a/src/http/modules/ngx_http_range_filter.c
+++ b/src/http/modules/ngx_http_range_filter.c
@@ -339,7 +339,7 @@
if (r->headers_out.charset.len) {
ctx->boundary_header.len =
ngx_snprintf((char *) ctx->boundary_header.data, len,
- CRLF "--%010u" CRLF
+ CRLF "--%010" NGX_UINT_T_FMT CRLF
"Content-Type: %s; charset=%s" CRLF
"Content-Range: bytes ",
boundary,
@@ -351,7 +351,7 @@
} else {
ctx->boundary_header.len =
ngx_snprintf((char *) ctx->boundary_header.data, len,
- CRLF "--%010u" CRLF
+ CRLF "--%010" NGX_UINT_T_FMT CRLF
"Content-Type: %s" CRLF
"Content-Range: bytes ",
boundary,
@@ -368,7 +368,8 @@
ngx_snprintf((char *)
r->headers_out.content_type->value.data,
31 + 10 + 1,
- "multipart/byteranges; boundary=%010u",
+ "multipart/byteranges; boundary=%010"
+ NGX_UINT_T_FMT,
boundary);
/* the size of the last boundary CRLF "--0123456789--" CRLF */
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index d523fc1..99ac1aa 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -5,7 +5,7 @@
#include <ngx_http_proxy_handler.h>
-static int ngx_http_proxy_handler(ngx_http_request_t *r);
+static ngx_int_t ngx_http_proxy_handler(ngx_http_request_t *r);
static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r,
u_char *buf, uintptr_t data);
@@ -14,7 +14,7 @@
static u_char *ngx_http_proxy_log_reason(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
-static int ngx_http_proxy_pre_conf(ngx_conf_t *cf);
+static ngx_int_t ngx_http_proxy_pre_conf(ngx_conf_t *cf);
static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
@@ -307,7 +307,7 @@
};
-static int ngx_http_proxy_handler(ngx_http_request_t *r)
+static ngx_int_t ngx_http_proxy_handler(ngx_http_request_t *r)
{
ngx_http_proxy_ctx_t *p;
@@ -732,7 +732,8 @@
*buf++ = '-';
} else {
- buf += ngx_snprintf((char *) buf, 4, "%d", p->state->status);
+ buf += ngx_snprintf((char *) buf, 4, "%" NGX_UINT_T_FMT,
+ p->state->status);
}
*buf++ = '/';
@@ -796,7 +797,7 @@
}
-static int ngx_http_proxy_pre_conf(ngx_conf_t *cf)
+static ngx_int_t ngx_http_proxy_pre_conf(ngx_conf_t *cf)
{
ngx_http_log_op_name_t *op;
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 73333df..9e040d6 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -14,8 +14,8 @@
uint64_t ngx_http_total_sent;
-int (*ngx_http_top_header_filter) (ngx_http_request_t *r);
-int (*ngx_http_top_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
+ngx_int_t (*ngx_http_top_header_filter) (ngx_http_request_t *r);
+ngx_int_t (*ngx_http_top_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
static ngx_command_t ngx_http_commands[] = {
diff --git a/src/http/ngx_http.h b/src/http/ngx_http.h
index 87eabd1..33d6f34 100644
--- a/src/http/ngx_http.h
+++ b/src/http/ngx_http.h
@@ -59,26 +59,26 @@
void ngx_http_init_connection(ngx_connection_t *c);
-int ngx_http_parse_request_line(ngx_http_request_t *r);
-int ngx_http_parse_complex_uri(ngx_http_request_t *r);
-int ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b);
+ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r);
+ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r);
+ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b);
-int ngx_http_find_server_conf(ngx_http_request_t *r);
+ngx_int_t ngx_http_find_server_conf(ngx_http_request_t *r);
void ngx_http_handler(ngx_http_request_t *r);
void ngx_http_finalize_request(ngx_http_request_t *r, int error);
void ngx_http_writer(ngx_event_t *wev);
void ngx_http_empty_handler(ngx_event_t *wev);
-int ngx_http_send_last(ngx_http_request_t *r);
+ngx_int_t ngx_http_send_last(ngx_http_request_t *r);
void ngx_http_close_request(ngx_http_request_t *r, int error);
void ngx_http_close_connection(ngx_connection_t *c);
ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r);
-int ngx_http_send_header(ngx_http_request_t *r);
-int ngx_http_special_response_handler(ngx_http_request_t *r, int error);
+ngx_int_t ngx_http_send_header(ngx_http_request_t *r);
+ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r, int error);
time_t ngx_http_parse_time(u_char *value, size_t len);
@@ -88,8 +88,7 @@
-int ngx_http_discard_body(ngx_http_request_t *r);
-
+ngx_int_t ngx_http_discard_body(ngx_http_request_t *r);
extern ngx_module_t ngx_http_module;
@@ -99,9 +98,12 @@
extern uint64_t ngx_http_total_sent;
+extern ngx_http_output_header_filter_pt ngx_http_top_header_filter;
+extern ngx_http_output_body_filter_pt ngx_http_top_body_filter;
+
/* STUB */
-int ngx_http_log_handler(ngx_http_request_t *r);
+ngx_int_t ngx_http_log_handler(ngx_http_request_t *r);
/**/
diff --git a/src/http/ngx_http_config.h b/src/http/ngx_http_config.h
index 45c2b7e..03c6347 100644
--- a/src/http/ngx_http_config.h
+++ b/src/http/ngx_http_config.h
@@ -14,22 +14,16 @@
typedef struct {
- int (*output_header_filter) (ngx_http_request_t *r);
- int (*output_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
-} ngx_http_conf_filter_t;
+ ngx_int_t (*pre_conf)(ngx_conf_t *cf);
+ void *(*create_main_conf)(ngx_conf_t *cf);
+ char *(*init_main_conf)(ngx_conf_t *cf, void *conf);
-typedef struct {
- int (*pre_conf)(ngx_conf_t *cf);
+ void *(*create_srv_conf)(ngx_conf_t *cf);
+ char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf);
- void *(*create_main_conf)(ngx_conf_t *cf);
- char *(*init_main_conf)(ngx_conf_t *cf, void *conf);
-
- void *(*create_srv_conf)(ngx_conf_t *cf);
- char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf);
-
- void *(*create_loc_conf)(ngx_conf_t *cf);
- char *(*merge_loc_conf)(ngx_conf_t *cf, void *prev, void *conf);
+ void *(*create_loc_conf)(ngx_conf_t *cf);
+ char *(*merge_loc_conf)(ngx_conf_t *cf, void *prev, void *conf);
} ngx_http_module_t;
@@ -53,7 +47,5 @@
((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
-extern int (*ngx_http_top_header_filter) (ngx_http_request_t *r);
-
#endif /* _NGX_HTTP_CONFIG_H_INCLUDED_ */
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index f68a605..5e43d5d 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -18,7 +18,7 @@
static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
-static int ngx_http_core_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_core_init(ngx_cycle_t *cycle);
static char *ngx_server_block(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy);
static int ngx_cmp_locations(const void *first, const void *second);
static char *ngx_location_block(ngx_conf_t *cf, ngx_command_t *cmd,
@@ -448,7 +448,7 @@
}
-int ngx_http_find_location_config(ngx_http_request_t *r)
+ngx_int_t ngx_http_find_location_config(ngx_http_request_t *r)
{
int rc;
ngx_uint_t i;
@@ -665,7 +665,7 @@
}
-int ngx_http_send_header(ngx_http_request_t *r)
+ngx_int_t ngx_http_send_header(ngx_http_request_t *r)
{
if (r->main) {
return NGX_OK;
@@ -743,8 +743,8 @@
}
-int ngx_http_internal_redirect(ngx_http_request_t *r,
- ngx_str_t *uri, ngx_str_t *args)
+ngx_int_t ngx_http_internal_redirect(ngx_http_request_t *r,
+ ngx_str_t *uri, ngx_str_t *args)
{
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"internal redirect: \"%s\"", uri->data);
@@ -808,7 +808,7 @@
#endif
-static int ngx_http_core_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_http_core_init(ngx_cycle_t *cycle)
{
#if 0
ngx_http_handler_pt *h;
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 9224e95..d0539e0 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -117,7 +117,7 @@
ngx_str_t name; /* location name */
void **loc_conf ; /* pointer to the modules' loc_conf */
- int (*handler) (ngx_http_request_t *r);
+ ngx_http_handler_pt handler;
ngx_str_t root; /* root, alias */
@@ -163,27 +163,23 @@
-int ngx_http_find_location_config(ngx_http_request_t *r);
-int ngx_http_core_translate_handler(ngx_http_request_t *r);
+ngx_int_t ngx_http_find_location_config(ngx_http_request_t *r);
+ngx_int_t ngx_http_core_translate_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r);
ngx_int_t ngx_http_set_exten(ngx_http_request_t *r);
-int ngx_http_internal_redirect(ngx_http_request_t *r,
- ngx_str_t *uri, ngx_str_t *args);
+ngx_int_t ngx_http_internal_redirect(ngx_http_request_t *r,
+ ngx_str_t *uri, ngx_str_t *args);
-typedef int (*ngx_http_output_header_filter_pt)(ngx_http_request_t *r);
-typedef int (*ngx_http_output_body_filter_pt)
+typedef ngx_int_t (*ngx_http_output_header_filter_pt)(ngx_http_request_t *r);
+typedef ngx_int_t (*ngx_http_output_body_filter_pt)
(ngx_http_request_t *r, ngx_chain_t *chain);
-int ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *chain);
-int ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *chain);
-
-
-extern ngx_http_output_header_filter_pt ngx_http_top_header_filter;
-extern ngx_http_output_body_filter_pt ngx_http_top_body_filter;
+ngx_int_t ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *chain);
+ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *chain);
#endif /* _NGX_HTTP_CORE_H_INCLUDED_ */
diff --git a/src/http/ngx_http_header_filter.c b/src/http/ngx_http_header_filter.c
index eb55a69..738f1eb 100644
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -5,8 +5,8 @@
#include <nginx.h>
-static int ngx_http_header_filter_init(ngx_cycle_t *cycle);
-static int ngx_http_header_filter(ngx_http_request_t *r);
+static ngx_int_t ngx_http_header_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r);
static ngx_http_module_t ngx_http_header_filter_module_ctx = {
@@ -90,7 +90,7 @@
-static int ngx_http_header_filter(ngx_http_request_t *r)
+static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r)
{
u_char *p;
size_t len;
@@ -359,7 +359,7 @@
}
-static int ngx_http_header_filter_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_http_header_filter_init(ngx_cycle_t *cycle)
{
ngx_http_top_header_filter = ngx_http_header_filter;
diff --git a/src/http/ngx_http_log_handler.c b/src/http/ngx_http_log_handler.c
index 908d6fc..727cceb 100644
--- a/src/http/ngx_http_log_handler.c
+++ b/src/http/ngx_http_log_handler.c
@@ -35,7 +35,7 @@
static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
-static int ngx_http_log_pre_conf(ngx_conf_t *cf);
+static ngx_int_t ngx_http_log_pre_conf(ngx_conf_t *cf);
static void *ngx_http_log_create_main_conf(ngx_conf_t *cf);
static void *ngx_http_log_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent,
@@ -44,8 +44,8 @@
void *conf);
static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
-static int ngx_http_log_parse_format(ngx_conf_t *cf, ngx_array_t *ops,
- ngx_str_t *line);
+static ngx_int_t ngx_http_log_parse_format(ngx_conf_t *cf, ngx_array_t *ops,
+ ngx_str_t *line);
static ngx_command_t ngx_http_log_commands[] = {
@@ -116,7 +116,7 @@
};
-int ngx_http_log_handler(ngx_http_request_t *r)
+ngx_int_t ngx_http_log_handler(ngx_http_request_t *r)
{
ngx_uint_t i, l;
uintptr_t data;
@@ -198,7 +198,8 @@
static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
uintptr_t data)
{
- return buf + ngx_snprintf((char *) buf, NGX_INT32_LEN + 1, "%u",
+ return buf + ngx_snprintf((char *) buf, NGX_INT_T_LEN + 1,
+ "%" NGX_UINT_T_FMT,
r->connection->number);
}
@@ -239,7 +240,7 @@
static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf,
uintptr_t data)
{
- return buf + ngx_snprintf((char *) buf, 4, "%d",
+ return buf + ngx_snprintf((char *) buf, 4, "%" NGX_UINT_T_FMT,
r->err_status ? r->err_status : r->headers_out.status);
}
@@ -561,7 +562,7 @@
}
-static int ngx_http_log_pre_conf(ngx_conf_t *cf)
+static ngx_int_t ngx_http_log_pre_conf(ngx_conf_t *cf)
{
ngx_http_log_op_name_t *op;
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 98fbc28..3f50666 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -9,13 +9,13 @@
static void ngx_http_process_request_line(ngx_event_t *rev);
static void ngx_http_process_request_headers(ngx_event_t *rev);
static ssize_t ngx_http_read_request_header(ngx_http_request_t *r);
-static int ngx_http_process_request_header(ngx_http_request_t *r);
+static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r);
static void ngx_http_set_write_handler(ngx_http_request_t *r);
static void ngx_http_block_read(ngx_event_t *ev);
static void ngx_http_read_discarded_body_event(ngx_event_t *rev);
-static int ngx_http_read_discarded_body(ngx_http_request_t *r);
+static ngx_int_t ngx_http_read_discarded_body(ngx_http_request_t *r);
static void ngx_http_set_keepalive(ngx_http_request_t *r);
static void ngx_http_keepalive_handler(ngx_event_t *ev);
@@ -847,6 +847,7 @@
static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r)
{
+ u_char *ua;
size_t len;
ngx_uint_t i;
ngx_http_server_name_t *name;
@@ -935,6 +936,25 @@
}
}
+ if (r->headers_in.user_agent) {
+
+ /*
+ * check some widespread browsers while the headers are still
+ * in CPU cache
+ */
+
+ ua = ngx_strstr(r->headers_in.user_agent->value.data, "MSIE");
+ if (ua
+ && ua + 8 < r->headers_in.user_agent->value.data
+ + r->headers_in.user_agent->value.len)
+ {
+ r->headers_in.msie = 1;
+ if (ua[4] == ' ' && ua[5] == '4' && ua[6] == '.') {
+ r->headers_in.msie4 = 1;
+ }
+ }
+ }
+
return NGX_OK;
}
@@ -1116,7 +1136,7 @@
}
-int ngx_http_discard_body(ngx_http_request_t *r)
+ngx_int_t ngx_http_discard_body(ngx_http_request_t *r)
{
ssize_t size;
ngx_event_t *rev;
@@ -1182,7 +1202,7 @@
}
-static int ngx_http_read_discarded_body(ngx_http_request_t *r)
+static ngx_int_t ngx_http_read_discarded_body(ngx_http_request_t *r)
{
ssize_t size, n;
ngx_http_core_loc_conf_t *clcf;
@@ -1523,7 +1543,7 @@
}
-int ngx_http_send_last(ngx_http_request_t *r)
+ngx_int_t ngx_http_send_last(ngx_http_request_t *r)
{
ngx_buf_t *b;
ngx_chain_t out;
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index 3cf7307..52e110a 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -135,6 +135,9 @@
ssize_t content_length_n;
size_t connection_type;
ssize_t keep_alive_n;
+
+ unsigned msie;
+ unsigned msie4;
} ngx_http_headers_in_t;
@@ -201,7 +204,7 @@
};
-typedef int (*ngx_http_handler_pt)(ngx_http_request_t *r);
+typedef ngx_int_t (*ngx_http_handler_pt)(ngx_http_request_t *r);
struct ngx_http_request_s {
ngx_connection_t *connection;
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index 2e26640..70a6bb8 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -177,10 +177,10 @@
};
-int ngx_http_special_response_handler(ngx_http_request_t *r, int error)
+ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r, int error)
{
ngx_int_t rc;
- ngx_uint_t err, i;
+ ngx_uint_t err, i, msie_padding;
ngx_buf_t *b;
ngx_chain_t *out, **ll, *cl;
ngx_http_err_page_t *err_page;
@@ -248,16 +248,20 @@
}
}
+ msie_padding = 0;
+
if (error_pages[err].len) {
r->headers_out.content_length_n = error_pages[err].len
+ sizeof(error_tail) - 1;
if (clcf->msie_padding
+ && r->headers_in.msie
&& r->http_version >= NGX_HTTP_VERSION_10
&& error >= NGX_HTTP_BAD_REQUEST
&& error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
{
r->headers_out.content_length_n += sizeof(msie_stub) - 1;
+ msie_padding = 1;
}
if (!(r->headers_out.content_type =
@@ -314,11 +318,7 @@
ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR);
ngx_chain_add_link(out, ll, cl);
- if (clcf->msie_padding
- && r->http_version >= NGX_HTTP_VERSION_10
- && error >= NGX_HTTP_BAD_REQUEST
- && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
- {
+ if (msie_padding) {
if (!(b = ngx_calloc_buf(r->pool))) {
return NGX_ERROR;
}
diff --git a/src/http/ngx_http_write_filter.c b/src/http/ngx_http_write_filter.c
index 48aba43..b0e4737 100644
--- a/src/http/ngx_http_write_filter.c
+++ b/src/http/ngx_http_write_filter.c
@@ -18,7 +18,7 @@
static void *ngx_http_write_filter_create_conf(ngx_conf_t *cf);
static char *ngx_http_write_filter_merge_conf(ngx_conf_t *cf,
void *parent, void *child);
-static int ngx_http_write_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle);
static ngx_command_t ngx_http_write_filter_commands[] = {
@@ -66,7 +66,7 @@
};
-int ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
+ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
{
int last;
off_t size, flush;
@@ -196,7 +196,7 @@
}
-static int ngx_http_write_filter_init(ngx_cycle_t *cycle)
+static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle)
{
ngx_http_top_body_filter = ngx_http_write_filter;