mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
nginx-0.0.2-2004-03-16-10:10:12 import
This commit is contained in:
parent
5596ede94e
commit
10a543a810
5
auto/cc
5
auto/cc
@ -131,6 +131,7 @@ case $CC in
|
||||
|
||||
# warnings
|
||||
CFLAGS="$CFLAGS -w1"
|
||||
#CFLAGS="$CFLAGS -w2"
|
||||
|
||||
# stop on warning
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
@ -189,8 +190,8 @@ case $CC in
|
||||
CFLAGS="$CFLAGS $CPU_OPT"
|
||||
|
||||
# warnings
|
||||
CFLAGS="$CFLAGS -W3"
|
||||
#CFLAGS="$CFLAGS -W4"
|
||||
#CFLAGS="$CFLAGS -W3"
|
||||
CFLAGS="$CFLAGS -W4"
|
||||
|
||||
# stop on warning
|
||||
CFLAGS="$CFLAGS -WX"
|
||||
|
@ -5,36 +5,6 @@
|
||||
#include <nginx.h>
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
typedef struct {
|
||||
ngx_flag_t daemon;
|
||||
ngx_flag_t master;
|
||||
ngx_flag_t worker_reopen;
|
||||
uid_t user;
|
||||
gid_t group;
|
||||
ngx_str_t pid;
|
||||
ngx_str_t newpid;
|
||||
} ngx_core_conf_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_file_t pid;
|
||||
char *name;
|
||||
int argc;
|
||||
char *const *argv;
|
||||
} ngx_master_ctx_t;
|
||||
|
||||
|
||||
static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx);
|
||||
static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx);
|
||||
static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data);
|
||||
#if (NGX_THREADS)
|
||||
static int ngx_worker_thread_cycle(void *data);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_getopt(ngx_master_ctx_t *ctx, ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_core_module_init(ngx_cycle_t *cycle);
|
||||
@ -112,7 +82,7 @@ int main(int argc, char *const *argv)
|
||||
ngx_master_ctx_t ctx;
|
||||
#if !(WIN32)
|
||||
size_t len;
|
||||
char pid[/* STUB */ 10];
|
||||
u_char pid[/* STUB */ 10];
|
||||
#endif
|
||||
|
||||
#if __FreeBSD__
|
||||
@ -220,7 +190,7 @@ int main(int argc, char *const *argv)
|
||||
NGINX_NEW_PID_EXT, sizeof(NGINX_NEW_PID_EXT));
|
||||
}
|
||||
|
||||
len = ngx_snprintf(pid, /* STUB */ 10, PID_T_FMT, ngx_getpid());
|
||||
len = ngx_snprintf((char *) pid, /* STUB */ 10, PID_T_FMT, ngx_getpid());
|
||||
ngx_memzero(&ctx.pid, sizeof(ngx_file_t));
|
||||
ctx.pid.name = ngx_inherited ? ccf->newpid : ccf->pid;
|
||||
ctx.name = ccf->pid.data;
|
||||
@ -253,11 +223,11 @@ int main(int argc, char *const *argv)
|
||||
|
||||
static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle)
|
||||
{
|
||||
char *p, *v, *inherited;
|
||||
u_char *p, *v, *inherited;
|
||||
ngx_socket_t s;
|
||||
ngx_listening_t *ls;
|
||||
|
||||
inherited = getenv(NGINX_VAR);
|
||||
inherited = (u_char *) getenv(NGINX_VAR);
|
||||
|
||||
if (inherited == NULL) {
|
||||
return NGX_OK;
|
||||
@ -280,11 +250,11 @@ static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle)
|
||||
break;
|
||||
}
|
||||
|
||||
v = p + 1;
|
||||
v = p + 1;
|
||||
|
||||
if (!(ls = ngx_push_array(&cycle->listening))) {
|
||||
if (!(ls = ngx_push_array(&cycle->listening))) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
ls->fd = s;
|
||||
}
|
||||
@ -299,7 +269,7 @@ static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle)
|
||||
ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
|
||||
{
|
||||
char *env[2], *var, *p;
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
ngx_pid_t pid;
|
||||
ngx_exec_ctx_t ctx;
|
||||
ngx_listening_t *ls;
|
||||
@ -312,7 +282,7 @@ ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
|
||||
+ cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
|
||||
cycle->log);
|
||||
|
||||
p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));
|
||||
p = (char *) ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));
|
||||
|
||||
ls = cycle->listening.elts;
|
||||
for (i = 0; i < cycle->listening.nelts; i++) {
|
||||
@ -347,7 +317,7 @@ static ngx_int_t ngx_getopt(ngx_master_ctx_t *ctx, ngx_cycle_t *cycle)
|
||||
switch (ctx->argv[i][1]) {
|
||||
|
||||
case 'c':
|
||||
cycle->conf_file.data = ctx->argv[++i];
|
||||
cycle->conf_file.data = (u_char *) ctx->argv[++i];
|
||||
cycle->conf_file.len = ngx_strlen(cycle->conf_file.data);
|
||||
break;
|
||||
|
||||
@ -425,7 +395,7 @@ static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
value = (ngx_str_t *) cf->args->elts;
|
||||
|
||||
pwd = getpwnam(value[1].data);
|
||||
pwd = getpwnam((const char *) value[1].data);
|
||||
if (pwd == NULL) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
||||
"getpwnam(%s) failed", value[1].data);
|
||||
@ -438,7 +408,7 @@ static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
||||
grp = getgrnam(value[2].data);
|
||||
grp = getgrnam((const char *) value[2].data);
|
||||
if (grp == NULL) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
||||
"getgrnam(%s) failed", value[1].data);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
#define NGINX_VER "nginx/0.0.2"
|
||||
#define NGINX_CONF "nginx.conf"
|
||||
#define NGINX_CONF (u_char *) "nginx.conf"
|
||||
#define NGINX_PID "nginx.pid"
|
||||
#define NGINX_NEW_PID_EXT ".newbin"
|
||||
#define NGINX_NEW_PID NGINX_PID NGINX_NEW_PID_EXT
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
||||
ngx_array_t *ngx_create_array(ngx_pool_t *p, int n, size_t size)
|
||||
ngx_array_t *ngx_create_array(ngx_pool_t *p, ngx_uint_t n, size_t size)
|
||||
{
|
||||
ngx_array_t *a;
|
||||
|
||||
|
@ -7,15 +7,15 @@
|
||||
|
||||
|
||||
struct ngx_array_s {
|
||||
void *elts;
|
||||
int nelts;
|
||||
size_t size;
|
||||
int nalloc;
|
||||
ngx_pool_t *pool;
|
||||
void *elts;
|
||||
ngx_uint_t nelts;
|
||||
size_t size;
|
||||
ngx_uint_t nalloc;
|
||||
ngx_pool_t *pool;
|
||||
};
|
||||
|
||||
|
||||
ngx_array_t *ngx_create_array(ngx_pool_t *p, int n, size_t size);
|
||||
ngx_array_t *ngx_create_array(ngx_pool_t *p, ngx_uint_t n, size_t size);
|
||||
void ngx_destroy_array(ngx_array_t *a);
|
||||
void *ngx_push_array(ngx_array_t *a);
|
||||
|
||||
|
@ -281,7 +281,7 @@ ngx_log_debug(cf->log, "rv: %d" _ rv);
|
||||
|
||||
static int ngx_conf_read_token(ngx_conf_t *cf)
|
||||
{
|
||||
char *start, ch, *src, *dst;
|
||||
u_char *start, ch, *src, *dst;
|
||||
int len;
|
||||
int found, need_space, last_space, sharp_comment;
|
||||
int quoted, s_quoted, d_quoted;
|
||||
@ -514,7 +514,7 @@ ngx_log_debug(cf->log, "FOUND %d:'%s'" _ word->len _ word->data);
|
||||
|
||||
ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
|
||||
{
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_open_file_t *file;
|
||||
|
||||
if (name) {
|
||||
@ -666,20 +666,20 @@ char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
char *p = conf;
|
||||
|
||||
ssize_t *sp;
|
||||
size_t *sp;
|
||||
ngx_str_t *value;
|
||||
ngx_conf_post_t *post;
|
||||
|
||||
|
||||
sp = (ssize_t *) (p + cmd->offset);
|
||||
if (*sp != NGX_CONF_UNSET) {
|
||||
sp = (size_t *) (p + cmd->offset);
|
||||
if (*sp != NGX_CONF_UNSET_SIZE) {
|
||||
return "is duplicate";
|
||||
}
|
||||
|
||||
value = (ngx_str_t *) cf->args->elts;
|
||||
|
||||
*sp = ngx_parse_size(&value[1]);
|
||||
if (*sp == NGX_ERROR) {
|
||||
if (*sp == (size_t) NGX_ERROR) {
|
||||
return "invalid value";
|
||||
}
|
||||
|
||||
@ -702,7 +702,7 @@ char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
|
||||
msp = (ngx_msec_t *) (p + cmd->offset);
|
||||
if (*msp != (ngx_msec_t) NGX_CONF_UNSET) {
|
||||
if (*msp != NGX_CONF_UNSET_MSEC) {
|
||||
return "is duplicate";
|
||||
}
|
||||
|
||||
@ -793,12 +793,12 @@ char *ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
char *p = conf;
|
||||
|
||||
ngx_int_t *np, i, m;
|
||||
ngx_uint_t *np, i, m;
|
||||
ngx_str_t *value;
|
||||
ngx_conf_bitmask_t *mask;
|
||||
|
||||
|
||||
np = (ngx_int_t *) (p + cmd->offset);
|
||||
np = (ngx_uint_t *) (p + cmd->offset);
|
||||
value = (ngx_str_t *) cf->args->elts;
|
||||
mask = cmd->post;
|
||||
|
||||
|
@ -43,6 +43,8 @@
|
||||
|
||||
|
||||
#define NGX_CONF_UNSET -1
|
||||
#define NGX_CONF_UNSET_SIZE (size_t) -1
|
||||
#define NGX_CONF_UNSET_MSEC (ngx_msec_t) -1
|
||||
|
||||
|
||||
#define NGX_CONF_OK NULL
|
||||
@ -189,8 +191,8 @@ char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
|
||||
}
|
||||
|
||||
#define ngx_conf_merge_msec_value(conf, prev, default) \
|
||||
if (conf == (ngx_msec_t) NGX_CONF_UNSET) { \
|
||||
conf = (prev == (ngx_msec_t) NGX_CONF_UNSET) ? default : prev; \
|
||||
if (conf == NGX_CONF_UNSET_MSEC) { \
|
||||
conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev; \
|
||||
}
|
||||
|
||||
#define ngx_conf_merge_sec_value(conf, prev, default) \
|
||||
@ -199,8 +201,8 @@ char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
|
||||
}
|
||||
|
||||
#define ngx_conf_merge_size_value(conf, prev, default) \
|
||||
if (conf == (ssize_t) NGX_CONF_UNSET) { \
|
||||
conf = (prev == (ssize_t) NGX_CONF_UNSET) ? default : prev; \
|
||||
if (conf == NGX_CONF_UNSET_SIZE) { \
|
||||
conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev; \
|
||||
}
|
||||
|
||||
#define ngx_conf_merge_str_value(conf, prev, default) \
|
||||
|
@ -9,7 +9,7 @@ ngx_os_io_t ngx_io;
|
||||
|
||||
ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
ngx_listening_t *ls;
|
||||
struct sockaddr_in *addr_in;
|
||||
|
||||
@ -63,7 +63,7 @@ ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle)
|
||||
|
||||
ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_int_t tries, failed, reuseaddr, i;
|
||||
ngx_uint_t tries, failed, reuseaddr, i;
|
||||
ngx_err_t err;
|
||||
ngx_log_t *log;
|
||||
ngx_socket_t s;
|
||||
@ -78,7 +78,7 @@ ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
||||
|
||||
/* TODO: tries configurable */
|
||||
|
||||
for (tries = /* STUB */ 1; tries; tries--) {
|
||||
for (tries = /* STUB */ 5; tries; tries--) {
|
||||
failed = 0;
|
||||
|
||||
/* for each listening socket */
|
||||
@ -204,7 +204,7 @@ ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
||||
|
||||
void ngx_close_listening_sockets(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
ngx_socket_t fd;
|
||||
ngx_listening_t *ls;
|
||||
|
||||
@ -233,7 +233,7 @@ void ngx_close_listening_sockets(ngx_cycle_t *cycle)
|
||||
ls[i].addr_text.data);
|
||||
}
|
||||
|
||||
cycle->connections[fd].fd = -1;
|
||||
cycle->connections[fd].fd = (ngx_socket_t) -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,8 @@ typedef struct ngx_connection_s ngx_connection_t;
|
||||
#define NGX_ABORT -6
|
||||
|
||||
|
||||
#define LF 10
|
||||
#define CR 13
|
||||
#define LF (u_char) 10
|
||||
#define CR (u_char) 13
|
||||
#define CRLF "\x0d\x0a"
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ static ngx_connection_t dumb;
|
||||
|
||||
ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
|
||||
{
|
||||
ngx_int_t i, n, failed;
|
||||
ngx_uint_t i, n, failed;
|
||||
ngx_log_t *log;
|
||||
ngx_conf_t conf;
|
||||
ngx_pool_t *pool;
|
||||
@ -374,7 +374,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
|
||||
void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
|
||||
{
|
||||
ngx_fd_t fd;
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
ngx_open_file_t *file;
|
||||
|
||||
file = cycle->open_files.elts;
|
||||
@ -412,7 +412,7 @@ void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
|
||||
}
|
||||
#else
|
||||
if (user != (ngx_uid_t) -1) {
|
||||
if (chown(file[i].name.data, user, -1) == -1) {
|
||||
if (chown((const char *) file[i].name.data, user, -1) == -1) {
|
||||
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
||||
"chown \"%s\" failed", file[i].name.data);
|
||||
|
||||
@ -461,7 +461,7 @@ void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
|
||||
|
||||
static void ngx_clean_old_cycles(ngx_event_t *ev)
|
||||
{
|
||||
int i, n, found, live;
|
||||
ngx_uint_t i, n, found, live;
|
||||
ngx_log_t *log;
|
||||
ngx_cycle_t **cycle;
|
||||
|
||||
@ -482,7 +482,7 @@ static void ngx_clean_old_cycles(ngx_event_t *ev)
|
||||
found = 0;
|
||||
|
||||
for (n = 0; n < cycle[i]->connection_n; n++) {
|
||||
if (cycle[i]->connections[n].fd != -1) {
|
||||
if (cycle[i]->connections[n].fd != (ngx_socket_t) -1) {
|
||||
found = 1;
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n);
|
||||
|
@ -14,7 +14,7 @@ struct ngx_cycle_s {
|
||||
ngx_array_t open_files;
|
||||
ngx_array_t pathes;
|
||||
|
||||
int connection_n;
|
||||
ngx_uint_t connection_n;
|
||||
ngx_connection_t *connections;
|
||||
ngx_event_t *read_events;
|
||||
ngx_event_t *write_events;
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
||||
static int ngx_temp_number;
|
||||
static int ngx_random;
|
||||
static ngx_uint_t ngx_temp_number;
|
||||
static ngx_uint_t ngx_random;
|
||||
|
||||
|
||||
int ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
|
||||
@ -50,8 +50,9 @@ int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
|
||||
num = ngx_next_temp_number(0);
|
||||
|
||||
for ( ;; ) {
|
||||
ngx_snprintf(file->name.data + path->name.len + 1 + path->len, 11,
|
||||
"%010u", num);
|
||||
ngx_snprintf((char *)
|
||||
(file->name.data + path->name.len + 1 + path->len),
|
||||
11, "%010u", num);
|
||||
|
||||
ngx_create_hashed_filename(file, path);
|
||||
|
||||
@ -183,7 +184,7 @@ void ngx_init_temp_number()
|
||||
}
|
||||
|
||||
|
||||
int ngx_next_temp_number(int collision)
|
||||
ngx_uint_t ngx_next_temp_number(ngx_uint_t collision)
|
||||
{
|
||||
if (collision) {
|
||||
ngx_temp_number += ngx_random;
|
||||
@ -197,7 +198,8 @@ char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
char *p = conf;
|
||||
|
||||
int i, n, level;
|
||||
ngx_int_t level;
|
||||
ngx_uint_t i, n;
|
||||
ngx_str_t *value;
|
||||
ngx_path_t *path, **pp;
|
||||
|
||||
|
@ -51,7 +51,7 @@ void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path);
|
||||
int ngx_create_path(ngx_file_t *file, ngx_path_t *path);
|
||||
|
||||
void ngx_init_temp_number();
|
||||
int ngx_next_temp_number(int collision);
|
||||
ngx_uint_t ngx_next_temp_number(ngx_uint_t collision);
|
||||
|
||||
char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||
|
||||
|
@ -53,7 +53,7 @@ void garbage_collector()
|
||||
|
||||
void stub_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_gc_t ctx;
|
||||
ngx_path_t **path;
|
||||
|
||||
@ -71,13 +71,17 @@ void stub_init(ngx_cycle_t *cycle)
|
||||
static int ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level)
|
||||
{
|
||||
int rc;
|
||||
char *last;
|
||||
u_char *last;
|
||||
size_t len;
|
||||
ngx_err_t err;
|
||||
ngx_str_t fname, buf;
|
||||
ngx_dir_t dir;
|
||||
|
||||
buf.len = 0;
|
||||
#if (NGX_SUPPRESS_WARN)
|
||||
buf.data = NULL;
|
||||
fname.data = NULL;
|
||||
#endif
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_CORE, ctx->log, 0,
|
||||
"gc dir \"%s\":%d", dname->data, dname->len);
|
||||
|
@ -31,8 +31,8 @@ ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, size_t size)
|
||||
|
||||
ngx_chain_t *ngx_create_chain_of_hunks(ngx_pool_t *pool, ngx_bufs_t *bufs)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
ngx_int_t i;
|
||||
u_char *p;
|
||||
ngx_hunk_t *h;
|
||||
ngx_chain_t *chain, *cl, **ll;
|
||||
|
||||
|
@ -45,14 +45,14 @@ typedef void * ngx_hunk_tag_t;
|
||||
typedef struct ngx_hunk_s ngx_hunk_t;
|
||||
|
||||
struct ngx_hunk_s {
|
||||
char *pos;
|
||||
char *last;
|
||||
u_char *pos;
|
||||
u_char *last;
|
||||
off_t file_pos;
|
||||
off_t file_last;
|
||||
|
||||
int type;
|
||||
char *start; /* start of hunk */
|
||||
char *end; /* end of hunk */
|
||||
u_char *start; /* start of hunk */
|
||||
u_char *end; /* end of hunk */
|
||||
ngx_hunk_tag_t tag;
|
||||
ngx_file_t *file;
|
||||
ngx_hunk_t *shadow;
|
||||
@ -69,7 +69,7 @@ struct ngx_chain_s {
|
||||
|
||||
|
||||
typedef struct {
|
||||
int num;
|
||||
ngx_int_t num;
|
||||
size_t size;
|
||||
} ngx_bufs_t;
|
||||
|
||||
@ -87,7 +87,7 @@ typedef struct {
|
||||
unsigned need_in_temp;
|
||||
|
||||
ngx_pool_t *pool;
|
||||
int hunks;
|
||||
ngx_int_t hunks;
|
||||
ngx_bufs_t bufs;
|
||||
ngx_hunk_tag_t tag;
|
||||
|
||||
|
@ -5,9 +5,10 @@
|
||||
|
||||
/* AF_INET only */
|
||||
|
||||
size_t ngx_sock_ntop(int family, struct sockaddr *addr, char *text, size_t len)
|
||||
size_t ngx_sock_ntop(int family, struct sockaddr *addr, u_char *text,
|
||||
size_t len)
|
||||
{
|
||||
char *p;
|
||||
u_char *p;
|
||||
struct sockaddr_in *addr_in;
|
||||
|
||||
if (family != AF_INET) {
|
||||
@ -15,27 +16,21 @@ size_t ngx_sock_ntop(int family, struct sockaddr *addr, char *text, size_t len)
|
||||
}
|
||||
|
||||
addr_in = (struct sockaddr_in *) addr;
|
||||
p = (char *) &addr_in->sin_addr;
|
||||
p = (u_char *) &addr_in->sin_addr;
|
||||
|
||||
return ngx_snprintf(text, len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
|
||||
"%u.%u.%u.%u",
|
||||
(unsigned char) p[0],
|
||||
(unsigned char) p[1],
|
||||
(unsigned char) p[2],
|
||||
(unsigned char) p[3]);
|
||||
return ngx_snprintf((char *) text,
|
||||
len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
|
||||
"%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
|
||||
}
|
||||
|
||||
|
||||
size_t ngx_inet_ntop(int family, char *addr, char *text, size_t len)
|
||||
size_t ngx_inet_ntop(int family, u_char *addr, u_char *text, size_t len)
|
||||
{
|
||||
if (family != AF_INET) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ngx_snprintf(text, len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
|
||||
"%u.%u.%u.%u",
|
||||
(unsigned char) addr[0],
|
||||
(unsigned char) addr[1],
|
||||
(unsigned char) addr[2],
|
||||
(unsigned char) addr[3]);
|
||||
return ngx_snprintf((char *) text,
|
||||
len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
|
||||
"%u.%u.%u.%u", addr[0], addr[1], addr[2], addr[3]);
|
||||
}
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define _NGX_INET_H_INCLUDED_
|
||||
|
||||
|
||||
size_t ngx_sock_ntop(int family, struct sockaddr *addr, char *text, size_t len);
|
||||
size_t ngx_inet_ntop(int family, char *addr, char *text, size_t len);
|
||||
size_t ngx_sock_ntop(int family, struct sockaddr *addr, u_char *text,
|
||||
size_t len);
|
||||
size_t ngx_inet_ntop(int family, u_char *addr, u_char *text, size_t len);
|
||||
|
||||
|
||||
#endif /* _NGX_INET_H_INCLUDED_ */
|
||||
|
@ -325,8 +325,8 @@ static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log)
|
||||
{
|
||||
ngx_int_t i, n, d;
|
||||
ngx_str_t *value;
|
||||
ngx_uint_t i, n, d;
|
||||
ngx_str_t *value;
|
||||
|
||||
value = cf->args->elts;
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
||||
int ngx_parse_size(ngx_str_t *line)
|
||||
ngx_int_t ngx_parse_size(ngx_str_t *line)
|
||||
{
|
||||
int scale, size;
|
||||
char last;
|
||||
size_t len;
|
||||
u_char last;
|
||||
size_t len;
|
||||
ngx_int_t scale, size;
|
||||
|
||||
len = line->len;
|
||||
last = line->data[len - 1];
|
||||
@ -40,12 +40,12 @@ int ngx_parse_size(ngx_str_t *line)
|
||||
}
|
||||
|
||||
|
||||
int ngx_parse_time(ngx_str_t *line, int sec)
|
||||
ngx_int_t ngx_parse_time(ngx_str_t *line, ngx_int_t sec)
|
||||
{
|
||||
int value, total, scale;
|
||||
u_int max, i;
|
||||
size_t len;
|
||||
char *start, last;
|
||||
size_t len;
|
||||
u_char *start, last;
|
||||
ngx_int_t value, total, scale;
|
||||
ngx_uint_t max, i;
|
||||
enum {
|
||||
st_start = 0,
|
||||
st_year,
|
||||
|
@ -9,8 +9,8 @@
|
||||
#define NGX_PARSE_LARGE_TIME -2
|
||||
|
||||
|
||||
int ngx_parse_size(ngx_str_t *line);
|
||||
int ngx_parse_time(ngx_str_t *line, int sec);
|
||||
ngx_int_t ngx_parse_size(ngx_str_t *line);
|
||||
ngx_int_t ngx_parse_time(ngx_str_t *line, ngx_int_t sec);
|
||||
|
||||
|
||||
#endif /* _NGX_PARSE_H_INCLUDED_ */
|
||||
|
@ -27,15 +27,16 @@ ngx_regex_t *ngx_regex_compile(ngx_str_t *pattern, ngx_int_t options,
|
||||
|
||||
ngx_pcre_pool = pool;
|
||||
|
||||
re = pcre_compile(pattern->data, (int) options, &errstr, &erroff, NULL);
|
||||
re = pcre_compile((const char *) pattern->data, (int) options,
|
||||
&errstr, &erroff, NULL);
|
||||
|
||||
if (re == NULL) {
|
||||
if ((size_t) erroff == pattern->len) {
|
||||
ngx_snprintf(err->data, err->len - 1,
|
||||
ngx_snprintf((char *) err->data, err->len - 1,
|
||||
"pcre_compile() failed: %s in \"%s\"",
|
||||
errstr, pattern->data);
|
||||
} else {
|
||||
ngx_snprintf(err->data, err->len - 1,
|
||||
ngx_snprintf((char *) err->data, err->len - 1,
|
||||
"pcre_compile() failed: %s in \"%s\" at \"%s\"",
|
||||
errstr, pattern->data, pattern->data + erroff);
|
||||
}
|
||||
@ -50,7 +51,8 @@ ngx_int_t ngx_regex_exec(ngx_regex_t *re, ngx_str_t *s,
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = pcre_exec(re, NULL, s->data, s->len, 0, 0, matches, size);
|
||||
rc = pcre_exec(re, NULL, (const char *) s->data, s->len, 0, 0,
|
||||
matches, size);
|
||||
|
||||
if (rc == -1) {
|
||||
return NGX_DECLINED;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
||||
char *ngx_cpystrn(char *dst, char *src, size_t n)
|
||||
u_char *ngx_cpystrn(u_char *dst, u_char *src, size_t n)
|
||||
{
|
||||
if (n == 0) {
|
||||
return dst;
|
||||
@ -23,7 +23,7 @@ char *ngx_cpystrn(char *dst, char *src, size_t n)
|
||||
}
|
||||
|
||||
|
||||
int ngx_rstrncmp(char *s1, char *s2, size_t n)
|
||||
ngx_int_t ngx_rstrncmp(u_char *s1, u_char *s2, size_t n)
|
||||
{
|
||||
if (n == 0) {
|
||||
return 0;
|
||||
@ -33,7 +33,7 @@ int ngx_rstrncmp(char *s1, char *s2, size_t n)
|
||||
|
||||
for ( ;; ) {
|
||||
if (s1[n] != s2[n]) {
|
||||
return (u_char) s1[n] - (u_char) s2[n];
|
||||
return s1[n] - s2[n];
|
||||
}
|
||||
|
||||
if (n == 0) {
|
||||
@ -45,9 +45,9 @@ int ngx_rstrncmp(char *s1, char *s2, size_t n)
|
||||
}
|
||||
|
||||
|
||||
int ngx_atoi(char *line, size_t n)
|
||||
ngx_int_t ngx_atoi(u_char *line, size_t n)
|
||||
{
|
||||
int value;
|
||||
ngx_int_t value;
|
||||
|
||||
if (n == 0) {
|
||||
return NGX_ERROR;
|
||||
@ -69,10 +69,10 @@ int ngx_atoi(char *line, size_t n)
|
||||
}
|
||||
|
||||
|
||||
void ngx_md5_text(char *text, u_char *md5)
|
||||
void ngx_md5_text(u_char *text, u_char *md5)
|
||||
{
|
||||
int i;
|
||||
static char hex[] = "0123456789abcdef";
|
||||
int i;
|
||||
static u_char hex[] = "0123456789abcdef";
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
*text++ = hex[md5[i] >> 4];
|
||||
|
@ -7,12 +7,12 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
size_t len;
|
||||
char *data;
|
||||
size_t len;
|
||||
u_char *data;
|
||||
} ngx_str_t;
|
||||
|
||||
|
||||
#define ngx_string(str) { sizeof(str) - 1, str }
|
||||
#define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
|
||||
#define ngx_null_string { 0, NULL }
|
||||
|
||||
|
||||
@ -26,8 +26,10 @@ typedef struct {
|
||||
|
||||
#else
|
||||
|
||||
#define ngx_strncasecmp strncasecmp
|
||||
#define ngx_strcasecmp strcasecmp
|
||||
#define ngx_strncasecmp(s1, s2, n) \
|
||||
strncasecmp((const char *) s1, (const char *) s2, n)
|
||||
#define ngx_strcasecmp(s1, s2) \
|
||||
strcasecmp((const char *) s1, (const char *) s2)
|
||||
|
||||
#define ngx_snprintf snprintf
|
||||
#define ngx_vsnprintf vsnprintf
|
||||
@ -35,13 +37,14 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
|
||||
#define ngx_strncmp strncmp
|
||||
#define ngx_strncmp(s1, s2, n) \
|
||||
strncmp((const char *) s1, (const char *) s2, n)
|
||||
|
||||
/* msvc and icc compile strcmp() to inline loop */
|
||||
#define ngx_strcmp strcmp
|
||||
#define ngx_strcmp(s1, s2) strcmp((const char *) s1, (const char *) s2)
|
||||
|
||||
#define ngx_strstr strstr
|
||||
#define ngx_strlen strlen
|
||||
#define ngx_strstr(s1, s2) strstr((const char *) s1, (const char *) s2)
|
||||
#define ngx_strlen(s) strlen((const char *) s)
|
||||
|
||||
/*
|
||||
* msvc and icc compile memset() to inline "rep stos"
|
||||
@ -53,16 +56,16 @@ typedef struct {
|
||||
|
||||
/* msvc and icc compile memcpy() to inline "rep movs" */
|
||||
#define ngx_memcpy(dst, src, n) memcpy(dst, src, n)
|
||||
#define ngx_cpymem(dst, src, n) ((char *) memcpy(dst, src, n)) + n
|
||||
#define ngx_cpymem(dst, src, n) ((u_char *) memcpy(dst, src, n)) + n
|
||||
|
||||
/* msvc and icc compile memcmp() to inline loop */
|
||||
#define ngx_memcmp memcmp
|
||||
|
||||
char *ngx_cpystrn(char *dst, char *src, size_t n);
|
||||
int ngx_rstrncmp(char *s1, char *s2, size_t n);
|
||||
int ngx_atoi(char *line, size_t n);
|
||||
u_char *ngx_cpystrn(u_char *dst, u_char *src, size_t n);
|
||||
ngx_int_t ngx_rstrncmp(u_char *s1, u_char *s2, size_t n);
|
||||
ngx_int_t ngx_atoi(u_char *line, size_t n);
|
||||
|
||||
void ngx_md5_text(char *text, u_char *md5);
|
||||
void ngx_md5_text(u_char *text, u_char *md5);
|
||||
|
||||
|
||||
#define ngx_qsort qsort
|
||||
|
@ -15,13 +15,13 @@ ngx_epoch_msec_t ngx_start_msec;
|
||||
|
||||
ngx_tm_t ngx_cached_gmtime;
|
||||
|
||||
static char cached_err_log_time[] = "1970/09/28 12:00:00";
|
||||
static u_char cached_err_log_time[] = "1970/09/28 12:00:00";
|
||||
ngx_str_t ngx_cached_err_log_time;
|
||||
|
||||
static char cached_http_time[] = "Mon, 28 Sep 1970 06:00:00 GMT";
|
||||
static u_char cached_http_time[] = "Mon, 28 Sep 1970 06:00:00 GMT";
|
||||
ngx_str_t ngx_cached_http_time;
|
||||
|
||||
static char cached_http_log_time[] = "28/Sep/1970:12:00:00";
|
||||
static u_char cached_http_log_time[] = "28/Sep/1970:12:00:00";
|
||||
ngx_str_t ngx_cached_http_log_time;
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ void ngx_time_update(time_t s)
|
||||
|
||||
ngx_gmtime(ngx_cached_time, &ngx_cached_gmtime);
|
||||
|
||||
ngx_cached_http_time.len = ngx_snprintf(ngx_cached_http_time.data,
|
||||
ngx_cached_http_time.len = ngx_snprintf((char *) ngx_cached_http_time.data,
|
||||
sizeof("Mon, 28 Sep 1970 06:00:00 GMT"),
|
||||
"%s, %02d %s %4d %02d:%02d:%02d GMT",
|
||||
week[ngx_cached_gmtime.ngx_tm_wday],
|
||||
@ -99,14 +99,16 @@ void ngx_time_update(time_t s)
|
||||
|
||||
ngx_localtime(&tm);
|
||||
|
||||
ngx_cached_err_log_time.len = ngx_snprintf(ngx_cached_err_log_time.data,
|
||||
ngx_cached_err_log_time.len = ngx_snprintf((char *)
|
||||
ngx_cached_err_log_time.data,
|
||||
sizeof("1970/09/28 12:00:00"),
|
||||
"%4d/%02d/%02d %02d:%02d:%02d",
|
||||
tm.ngx_tm_year, tm.ngx_tm_mon,
|
||||
tm.ngx_tm_mday, tm.ngx_tm_hour,
|
||||
tm.ngx_tm_min, tm.ngx_tm_sec);
|
||||
|
||||
ngx_cached_http_log_time.len = ngx_snprintf(ngx_cached_http_log_time.data,
|
||||
ngx_cached_http_log_time.len = ngx_snprintf((char *)
|
||||
ngx_cached_http_log_time.data,
|
||||
sizeof("28/Sep/1970:12:00:00"),
|
||||
"%02d/%s/%d:%02d:%02d:%02d",
|
||||
tm.ngx_tm_mday,
|
||||
@ -123,13 +125,13 @@ void ngx_time_update(time_t s)
|
||||
}
|
||||
|
||||
|
||||
size_t ngx_http_time(char *buf, time_t t)
|
||||
size_t ngx_http_time(u_char *buf, time_t t)
|
||||
{
|
||||
ngx_tm_t tm;
|
||||
|
||||
ngx_gmtime(t, &tm);
|
||||
|
||||
return ngx_snprintf(buf, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"),
|
||||
return ngx_snprintf((char *) buf, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"),
|
||||
"%s, %02d %s %4d %02d:%02d:%02d GMT",
|
||||
week[tm.ngx_tm_wday],
|
||||
tm.ngx_tm_mday,
|
||||
@ -143,7 +145,7 @@ size_t ngx_http_time(char *buf, time_t t)
|
||||
|
||||
void ngx_gmtime(time_t t, ngx_tm_t *tp)
|
||||
{
|
||||
int sec, min, hour, mday, mon, year, wday, yday, days;
|
||||
ngx_int_t sec, min, hour, mday, mon, year, wday, yday, days;
|
||||
|
||||
days = t / 86400;
|
||||
|
||||
@ -200,11 +202,11 @@ void ngx_gmtime(time_t t, ngx_tm_t *tp)
|
||||
}
|
||||
}
|
||||
|
||||
tp->ngx_tm_sec = sec;
|
||||
tp->ngx_tm_min = min;
|
||||
tp->ngx_tm_hour = hour;
|
||||
tp->ngx_tm_mday = mday;
|
||||
tp->ngx_tm_mon = mon;
|
||||
tp->ngx_tm_year = year;
|
||||
tp->ngx_tm_wday = wday;
|
||||
tp->ngx_tm_sec = (ngx_tm_sec_t) sec;
|
||||
tp->ngx_tm_min = (ngx_tm_min_t) min;
|
||||
tp->ngx_tm_hour = (ngx_tm_hour_t) hour;
|
||||
tp->ngx_tm_mday = (ngx_tm_mday_t) mday;
|
||||
tp->ngx_tm_mon = (ngx_tm_mon_t) mon;
|
||||
tp->ngx_tm_year = (ngx_tm_year_t) year;
|
||||
tp->ngx_tm_wday = (ngx_tm_wday_t) wday;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ void ngx_time_init();
|
||||
ngx_int_t ngx_time_mutex_init(ngx_log_t *log);
|
||||
#endif
|
||||
void ngx_time_update(time_t s);
|
||||
size_t ngx_http_time(char *buf, time_t t);
|
||||
size_t ngx_http_time(u_char *buf, time_t t);
|
||||
void ngx_gmtime(time_t t, ngx_tm_t *tp);
|
||||
|
||||
#define ngx_time() ngx_cached_time
|
||||
|
@ -176,7 +176,7 @@ static int ngx_select_add_event(ngx_event_t *ev, int event, u_int flags)
|
||||
#endif
|
||||
|
||||
ev->active = 1;
|
||||
ev->oneshot = (flags & NGX_ONESHOT_EVENT) ? 1 : 0;
|
||||
ev->oneshot = (u_char) ((flags & NGX_ONESHOT_EVENT) ? 1 : 0);
|
||||
|
||||
event_index[nevents] = ev;
|
||||
ev->index = nevents;
|
||||
|
@ -126,7 +126,8 @@ ngx_module_t ngx_event_core_module = {
|
||||
|
||||
static int ngx_event_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
int m, i, fd;
|
||||
ngx_uint_t m, i;
|
||||
ngx_socket_t fd;
|
||||
ngx_event_t *rev, *wev;
|
||||
ngx_listening_t *s;
|
||||
ngx_connection_t *c;
|
||||
@ -174,7 +175,7 @@ static int ngx_event_init(ngx_cycle_t *cycle)
|
||||
|
||||
c = cycle->connections;
|
||||
for (i = 0; i < cycle->connection_n; i++) {
|
||||
c[i].fd = -1;
|
||||
c[i].fd = (ngx_socket_t) -1;
|
||||
}
|
||||
|
||||
cycle->read_events = ngx_alloc(sizeof(ngx_event_t) * ecf->connections,
|
||||
@ -250,7 +251,7 @@ static int ngx_event_init(ngx_cycle_t *cycle)
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
cycle->old_cycle->connections[fd].fd = -1;
|
||||
cycle->old_cycle->connections[fd].fd = (ngx_socket_t) -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ typedef struct {
|
||||
int connections;
|
||||
int use;
|
||||
ngx_flag_t multi_accept;
|
||||
char *name;
|
||||
u_char *name;
|
||||
} ngx_event_conf_t;
|
||||
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
int flag;
|
||||
char *name;
|
||||
int flag;
|
||||
u_char *name;
|
||||
} ngx_accept_log_ctx_t;
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ static size_t ngx_accept_log_error(void *data, char *buf, size_t len);
|
||||
|
||||
void ngx_event_accept(ngx_event_t *ev)
|
||||
{
|
||||
int instance, accepted;
|
||||
ngx_uint_t instance, accepted;
|
||||
socklen_t len;
|
||||
struct sockaddr *sa;
|
||||
ngx_err_t err;
|
||||
@ -216,8 +216,8 @@ void ngx_event_accept(ngx_event_t *ev)
|
||||
c->sockaddr = sa;
|
||||
c->socklen = len;
|
||||
|
||||
rev->instance = !instance;
|
||||
wev->instance = !instance;
|
||||
rev->instance = (u_char) !instance;
|
||||
wev->instance = (u_char) !instance;
|
||||
|
||||
rev->index = NGX_INVALID_INDEX;
|
||||
wev->index = NGX_INVALID_INDEX;
|
||||
|
@ -10,7 +10,8 @@
|
||||
|
||||
int ngx_event_connect_peer(ngx_peer_connection_t *pc)
|
||||
{
|
||||
int rc, instance;
|
||||
int rc;
|
||||
ngx_uint_t instance;
|
||||
u_int event;
|
||||
time_t now;
|
||||
ngx_err_t err;
|
||||
@ -170,8 +171,8 @@ int ngx_event_connect_peer(ngx_peer_connection_t *pc)
|
||||
c->write = wev;
|
||||
wev->write = 1;
|
||||
|
||||
rev->instance = !instance;
|
||||
wev->instance = !instance;
|
||||
rev->instance = (u_char) !instance;
|
||||
wev->instance = (u_char) !instance;
|
||||
|
||||
c->log = pc->log;
|
||||
rev->log = pc->log;
|
||||
@ -203,7 +204,7 @@ int ngx_event_connect_peer(ngx_peer_connection_t *pc)
|
||||
ngx_memzero(&addr, sizeof(struct sockaddr_in));
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = peer->port;
|
||||
addr.sin_port = (u_short) peer->port;
|
||||
addr.sin_addr.s_addr = peer->addr;
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pc->log, 0,
|
||||
@ -224,7 +225,7 @@ int ngx_event_connect_peer(ngx_peer_connection_t *pc)
|
||||
ngx_close_socket_n " failed");
|
||||
}
|
||||
|
||||
c->fd = -1;
|
||||
c->fd = (ngx_socket_t) -1;
|
||||
|
||||
return NGX_CONNECT_ERROR;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ static int ngx_http_chunked_header_filter(ngx_http_request_t *r)
|
||||
|
||||
static int ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||
{
|
||||
char *chunk;
|
||||
u_char *chunk;
|
||||
size_t size, len;
|
||||
ngx_hunk_t *h;
|
||||
ngx_chain_t *out, *cl, *tl, **ll;
|
||||
@ -87,7 +87,7 @@ static int ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||
}
|
||||
|
||||
ngx_test_null(chunk, ngx_palloc(r->pool, 11), NGX_ERROR);
|
||||
len = ngx_snprintf(chunk, 11, SIZE_T_X_FMT CRLF, size);
|
||||
len = ngx_snprintf((char *) chunk, 11, SIZE_T_X_FMT CRLF, size);
|
||||
|
||||
ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR);
|
||||
h->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_TEMP;
|
||||
|
@ -7,12 +7,14 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
int enable;
|
||||
ngx_flag_t enable;
|
||||
ngx_flag_t no_buffer;
|
||||
|
||||
ngx_bufs_t bufs;
|
||||
|
||||
int level;
|
||||
ssize_t wbits;
|
||||
ssize_t memlevel;
|
||||
int no_buffer;
|
||||
int wbits;
|
||||
int memlevel;
|
||||
} ngx_http_gzip_conf_t;
|
||||
|
||||
|
||||
@ -39,7 +41,7 @@ typedef struct {
|
||||
size_t zin;
|
||||
size_t zout;
|
||||
|
||||
u_int crc32;
|
||||
uint32_t crc32;
|
||||
z_stream zstream;
|
||||
ngx_http_request_t *request;
|
||||
} ngx_http_gzip_ctx_t;
|
||||
@ -51,8 +53,8 @@ static void ngx_http_gzip_filter_free(void *opaque, void *address);
|
||||
|
||||
ngx_inline static int ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx);
|
||||
|
||||
static char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
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);
|
||||
@ -158,15 +160,15 @@ static u_char gzheader[10] = { 0x1f, 0x8b, Z_DEFLATED, 0, 0, 0, 0, 0, 0, 3 };
|
||||
#if (HAVE_LITTLE_ENDIAN)
|
||||
|
||||
struct gztrailer {
|
||||
u_int crc32;
|
||||
u_int zlen;
|
||||
uint32_t crc32;
|
||||
uint32_t zlen;
|
||||
};
|
||||
|
||||
#else /* HAVE_BIG_ENDIAN */
|
||||
|
||||
struct gztrailer {
|
||||
u_char crc32[4];
|
||||
u_char zlen[4];
|
||||
u_char crc32[4];
|
||||
u_char zlen[4];
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -296,7 +298,7 @@ static int ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||
ngx_test_null(h, ngx_calloc_hunk(r->pool), ngx_http_gzip_error(ctx));
|
||||
|
||||
h->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_MEMORY;
|
||||
h->pos = (char *) gzheader;
|
||||
h->pos = gzheader;
|
||||
h->last = h->pos + 10;
|
||||
|
||||
ngx_alloc_link_and_set_hunk(cl, h, r->pool, ngx_http_gzip_error(ctx));
|
||||
@ -396,8 +398,8 @@ static int ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||
ctx->zstream.avail_in, ctx->zstream.avail_out,
|
||||
rc);
|
||||
|
||||
ctx->in_hunk->pos = (char *) ctx->zstream.next_in;
|
||||
ctx->out_hunk->last = (char *) ctx->zstream.next_out;
|
||||
ctx->in_hunk->pos = ctx->zstream.next_in;
|
||||
ctx->out_hunk->last = ctx->zstream.next_out;
|
||||
|
||||
if (ctx->zstream.avail_out == 0) {
|
||||
ngx_alloc_link_and_set_hunk(cl, ctx->out_hunk, r->pool,
|
||||
@ -558,10 +560,10 @@ static void ngx_http_gzip_filter_free(void *opaque, void *address)
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
u_int zint, zfrac;
|
||||
ngx_uint_t zint, zfrac;
|
||||
ngx_http_gzip_ctx_t *ctx;
|
||||
|
||||
ctx = ngx_http_get_module_ctx(r, ngx_http_gzip_filter_module);
|
||||
@ -572,14 +574,14 @@ static char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
|
||||
#if 0
|
||||
return buf + ngx_snprintf(buf, NGX_INT32_LEN + 4, "%.2f",
|
||||
return buf + ngx_snprintf((char *) buf, NGX_INT32_LEN + 4, "%.2f",
|
||||
(float) ctx->zin / ctx->zout);
|
||||
#endif
|
||||
|
||||
/* we prefer do not use FPU */
|
||||
|
||||
zint = ctx->zin / ctx->zout;
|
||||
zfrac = (ctx->zin * 100 / ctx->zout) % 100;
|
||||
zint = (ngx_uint_t) (ctx->zin / ctx->zout);
|
||||
zfrac = (ngx_uint_t) ((ctx->zin * 100 / ctx->zout) % 100);
|
||||
|
||||
if ((ctx->zin * 1000 / ctx->zout) %10 > 4) {
|
||||
if (++zfrac > 99) {
|
||||
@ -588,7 +590,8 @@ static char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
}
|
||||
|
||||
return buf + ngx_snprintf(buf, NGX_INT32_LEN + 4, "%d.%02d", zint, zfrac);
|
||||
return buf + ngx_snprintf((char *) buf, NGX_INT32_LEN + 4,
|
||||
"%d.%02d", zint, zfrac);
|
||||
}
|
||||
|
||||
|
||||
@ -647,8 +650,10 @@ static void *ngx_http_gzip_create_conf(ngx_conf_t *cf)
|
||||
NGX_CONF_ERROR);
|
||||
|
||||
conf->enable = NGX_CONF_UNSET;
|
||||
/* conf->bufs.num = 0; */
|
||||
conf->no_buffer = NGX_CONF_UNSET;
|
||||
|
||||
/* conf->bufs.num = 0; */
|
||||
|
||||
conf->level = NGX_CONF_UNSET;
|
||||
conf->wbits = NGX_CONF_UNSET;
|
||||
conf->memlevel = NGX_CONF_UNSET;
|
||||
@ -667,9 +672,8 @@ static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
|
||||
ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 4,
|
||||
/* STUB: PAGE_SIZE */ 4096);
|
||||
ngx_conf_merge_value(conf->level, prev->level, 1);
|
||||
ngx_conf_merge_size_value(conf->wbits, prev->wbits, MAX_WBITS);
|
||||
ngx_conf_merge_size_value(conf->memlevel, prev->memlevel,
|
||||
MAX_MEM_LEVEL - 1);
|
||||
ngx_conf_merge_value(conf->wbits, prev->wbits, MAX_WBITS);
|
||||
ngx_conf_merge_value(conf->memlevel, prev->memlevel, MAX_MEM_LEVEL - 1);
|
||||
ngx_conf_merge_value(conf->no_buffer, prev->no_buffer, 0);
|
||||
|
||||
return NGX_CONF_OK;
|
||||
|
@ -12,8 +12,8 @@ typedef struct {
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_int_t index;
|
||||
char *last;
|
||||
ngx_uint_t index;
|
||||
u_char *last;
|
||||
ngx_str_t path;
|
||||
ngx_str_t redirect;
|
||||
ngx_http_cache_t *cache;
|
||||
@ -97,7 +97,7 @@ ngx_module_t ngx_http_index_module = {
|
||||
|
||||
int ngx_http_index_handler(ngx_http_request_t *r)
|
||||
{
|
||||
char *name;
|
||||
u_char *name;
|
||||
size_t len;
|
||||
ngx_fd_t fd;
|
||||
ngx_int_t rc;
|
||||
@ -161,13 +161,13 @@ int ngx_http_index_handler(ngx_http_request_t *r)
|
||||
|
||||
#endif
|
||||
|
||||
len = clcf->doc_root.len + r->uri.len + ilcf->max_index_len;
|
||||
len = clcf->root.len + r->uri.len + ilcf->max_index_len;
|
||||
if (!(ctx->path.data = ngx_palloc(r->pool, len))) {
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
ctx->redirect.data = ngx_cpymem(ctx->path.data, clcf->doc_root.data,
|
||||
clcf->doc_root.len);
|
||||
ctx->redirect.data = ngx_cpymem(ctx->path.data, clcf->root.data,
|
||||
clcf->root.len);
|
||||
ctx->last = ngx_cpystrn(ctx->redirect.data, r->uri.data,
|
||||
r->uri.len + 1);
|
||||
ctx->path.len = ctx->last - ctx->path.data;
|
||||
@ -237,7 +237,7 @@ int ngx_http_index_handler(ngx_http_request_t *r)
|
||||
|
||||
} else {
|
||||
ctx->redirect.len = r->uri.len + index[ctx->index].len;
|
||||
r->file.name.len = clcf->doc_root.len + r->uri.len
|
||||
r->file.name.len = clcf->root.len + r->uri.len
|
||||
+ index[ctx->index].len;
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf,
|
||||
ngx_http_index_loc_conf_t *prev = parent;
|
||||
ngx_http_index_loc_conf_t *conf = child;
|
||||
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *index, *prev_index;
|
||||
|
||||
if (conf->max_index_len == 0) {
|
||||
@ -434,7 +434,7 @@ static char *ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
{
|
||||
ngx_http_index_loc_conf_t *ilcf = conf;
|
||||
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *index, *value;
|
||||
|
||||
value = cf->args->elts;
|
||||
|
@ -44,7 +44,7 @@ typedef struct {
|
||||
} ngx_http_range_filter_ctx_t;
|
||||
|
||||
|
||||
static int ngx_http_range_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_range_filter_init(ngx_cycle_t *cycle);
|
||||
|
||||
|
||||
static ngx_http_module_t ngx_http_range_filter_module_ctx = {
|
||||
@ -75,10 +75,12 @@ static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
|
||||
static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
|
||||
|
||||
|
||||
static int ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
static ngx_int_t ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
{
|
||||
ngx_int_t rc, boundary, suffix, len, i;
|
||||
char *p;
|
||||
ngx_int_t rc;
|
||||
ngx_uint_t boundary, suffix, i;
|
||||
u_char *p;
|
||||
size_t len;
|
||||
off_t start, end;
|
||||
ngx_http_range_t *range;
|
||||
ngx_http_range_filter_ctx_t *ctx;
|
||||
@ -235,9 +237,9 @@ static int ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
NGX_ERROR);
|
||||
|
||||
r->headers_out.content_range->value.len =
|
||||
ngx_snprintf(r->headers_out.content_range->value.data,
|
||||
8 + 20 + 1, "bytes */" OFF_T_FMT,
|
||||
r->headers_out.content_length_n);
|
||||
ngx_snprintf((char *) r->headers_out.content_range->value.data,
|
||||
8 + 20 + 1, "bytes */" OFF_T_FMT,
|
||||
r->headers_out.content_length_n);
|
||||
|
||||
r->headers_out.content_length_n = -1;
|
||||
if (r->headers_out.content_length) {
|
||||
@ -268,7 +270,8 @@ static int ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
/* "Content-Range: bytes SSSS-EEEE/TTTT" header */
|
||||
|
||||
r->headers_out.content_range->value.len =
|
||||
ngx_snprintf(r->headers_out.content_range->value.data,
|
||||
ngx_snprintf((char *)
|
||||
r->headers_out.content_range->value.data,
|
||||
6 + 20 + 1 + 20 + 1 + 20 + 1,
|
||||
"bytes " OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT,
|
||||
range->start, range->end - 1,
|
||||
@ -313,7 +316,7 @@ static int ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
|
||||
if (r->headers_out.charset.len) {
|
||||
ctx->boundary_header.len =
|
||||
ngx_snprintf(ctx->boundary_header.data, len,
|
||||
ngx_snprintf((char *) ctx->boundary_header.data, len,
|
||||
CRLF "--%010u" CRLF
|
||||
"Content-Type: %s; charset=%s" CRLF
|
||||
"Content-Range: bytes ",
|
||||
@ -325,7 +328,7 @@ static int ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
|
||||
} else {
|
||||
ctx->boundary_header.len =
|
||||
ngx_snprintf(ctx->boundary_header.data, len,
|
||||
ngx_snprintf((char *) ctx->boundary_header.data, len,
|
||||
CRLF "--%010u" CRLF
|
||||
"Content-Type: %s" CRLF
|
||||
"Content-Range: bytes ",
|
||||
@ -340,7 +343,8 @@ static int ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
/* "Content-Type: multipart/byteranges; boundary=0123456789" */
|
||||
|
||||
r->headers_out.content_type->value.len =
|
||||
ngx_snprintf(r->headers_out.content_type->value.data,
|
||||
ngx_snprintf((char *)
|
||||
r->headers_out.content_type->value.data,
|
||||
31 + 10 + 1,
|
||||
"multipart/byteranges; boundary=%010u",
|
||||
boundary);
|
||||
@ -357,7 +361,7 @@ static int ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
/* the size of the range: "SSSS-EEEE/TTTT" CRLF CRLF */
|
||||
|
||||
range[i].content_range.len =
|
||||
ngx_snprintf(range[i].content_range.data,
|
||||
ngx_snprintf((char *) range[i].content_range.data,
|
||||
20 + 1 + 20 + 1 + 20 + 5,
|
||||
OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT CRLF CRLF,
|
||||
range[i].start, range[i].end - 1,
|
||||
@ -376,9 +380,10 @@ static int ngx_http_range_header_filter(ngx_http_request_t *r)
|
||||
}
|
||||
|
||||
|
||||
static int ngx_http_range_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||
static ngx_int_t ngx_http_range_body_filter(ngx_http_request_t *r,
|
||||
ngx_chain_t *in)
|
||||
{
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_hunk_t *h;
|
||||
ngx_chain_t *out, *hcl, *rcl, *dcl, **ll;
|
||||
ngx_http_range_t *range;
|
||||
@ -475,7 +480,7 @@ static int ngx_http_range_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||
}
|
||||
|
||||
|
||||
static int ngx_http_range_filter_init(ngx_cycle_t *cycle)
|
||||
static ngx_int_t ngx_http_range_filter_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_range_header_filter;
|
||||
|
@ -82,10 +82,11 @@ ngx_module_t ngx_http_rewrite_module = {
|
||||
static ngx_int_t ngx_http_rewrite_handler(ngx_http_request_t *r)
|
||||
{
|
||||
int *matches;
|
||||
char *p;
|
||||
u_char *p;
|
||||
size_t len;
|
||||
uintptr_t data;
|
||||
ngx_int_t rc, i, n, m;
|
||||
ngx_int_t rc;
|
||||
ngx_uint_t i, m, n;
|
||||
ngx_str_t uri;
|
||||
ngx_http_rewrite_op_t *op;
|
||||
ngx_http_rewrite_rule_t *rule;
|
||||
@ -134,7 +135,7 @@ static ngx_int_t ngx_http_rewrite_handler(ngx_http_request_t *r)
|
||||
|
||||
uri.len = rule[i].size;
|
||||
|
||||
for (n = 1; n < rc; n++) {
|
||||
for (n = 1; n < (ngx_uint_t) rc; n++) {
|
||||
uri.len += matches[2 * n + 1] - matches[2 * n];
|
||||
}
|
||||
|
||||
@ -150,7 +151,7 @@ static ngx_int_t ngx_http_rewrite_handler(ngx_http_request_t *r)
|
||||
len = op[n].len;
|
||||
data = op[n].data;
|
||||
while (len--) {
|
||||
*p++ = data & 0xff;
|
||||
*p++ = (char) (data & 0xff);
|
||||
data >>= 8;
|
||||
}
|
||||
|
||||
@ -208,13 +209,13 @@ static char *ngx_http_rewrite_rule(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
{
|
||||
ngx_http_rewrite_srv_conf_t *scf = conf;
|
||||
|
||||
char *data, *p;
|
||||
u_char *data, *p;
|
||||
size_t len;
|
||||
ngx_str_t *value, err;
|
||||
ngx_uint_t i;
|
||||
ngx_http_rewrite_op_t *op;
|
||||
ngx_http_rewrite_rule_t *rule;
|
||||
char errstr[NGX_MAX_CONF_ERRSTR];
|
||||
u_char errstr[NGX_MAX_CONF_ERRSTR];
|
||||
|
||||
if (!(rule = ngx_push_array(&scf->rules))) {
|
||||
return NGX_CONF_ERROR;
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
int enable;
|
||||
ssize_t value_len;
|
||||
ngx_flag_t enable;
|
||||
size_t value_len;
|
||||
} ngx_http_ssi_conf_t;
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@ typedef struct {
|
||||
typedef struct {
|
||||
ngx_hunk_t *buf;
|
||||
|
||||
char *start;
|
||||
char *last;
|
||||
char *pos;
|
||||
u_char *start;
|
||||
u_char *last;
|
||||
u_char *pos;
|
||||
|
||||
ngx_str_t command;
|
||||
ngx_array_t params;
|
||||
@ -41,7 +41,7 @@ typedef struct {
|
||||
ngx_chain_t **last_out;
|
||||
ngx_chain_t *busy;
|
||||
|
||||
int state;
|
||||
ngx_uint_t state;
|
||||
size_t saved;
|
||||
} ngx_http_ssi_ctx_t;
|
||||
|
||||
@ -839,7 +839,7 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r,
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((ssize_t) ctx->param->value.len >= conf->value_len) {
|
||||
if (ctx->param->value.len >= conf->value_len) {
|
||||
ctx->last = last;
|
||||
ctx->pos = p;
|
||||
ctx->state = ssi_error_state;
|
||||
@ -853,7 +853,7 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r,
|
||||
break;
|
||||
|
||||
case ssi_double_quoted_value_quote_state:
|
||||
if ((ssize_t) ctx->param->value.len >= conf->value_len) {
|
||||
if (ctx->param->value.len >= conf->value_len) {
|
||||
ctx->last = last;
|
||||
ctx->pos = p;
|
||||
ctx->state = ssi_error_state;
|
||||
@ -877,7 +877,7 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r,
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((ssize_t) ctx->param->value.len >= conf->value_len) {
|
||||
if (ctx->param->value.len >= conf->value_len) {
|
||||
ctx->last = last;
|
||||
ctx->pos = p;
|
||||
ctx->state = ssi_error_state;
|
||||
@ -891,7 +891,7 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r,
|
||||
break;
|
||||
|
||||
case ssi_quoted_value_quote_state:
|
||||
if ((ssize_t) ctx->param->value.len >= conf->value_len) {
|
||||
if (ctx->param->value.len >= conf->value_len) {
|
||||
ctx->last = last;
|
||||
ctx->pos = p;
|
||||
ctx->state = ssi_error_state;
|
||||
@ -1006,7 +1006,7 @@ static void *ngx_http_ssi_create_conf(ngx_conf_t *cf)
|
||||
}
|
||||
|
||||
conf->enable = NGX_CONF_UNSET;
|
||||
conf->value_len = NGX_CONF_UNSET;
|
||||
conf->value_len = NGX_CONF_UNSET_SIZE;
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ ngx_module_t ngx_http_static_module = {
|
||||
|
||||
static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
|
||||
{
|
||||
char *last;
|
||||
u_char *last;
|
||||
ngx_fd_t fd;
|
||||
ngx_int_t rc;
|
||||
ngx_uint_t level;
|
||||
@ -115,14 +115,31 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
|
||||
* in a possible redirect and for the last '\0'
|
||||
*/
|
||||
|
||||
name.data = ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2);
|
||||
name.data = ngx_palloc(r->pool, clcf->root.len + r->uri.len + 2
|
||||
- clcf->alias * clcf->name.len);
|
||||
if (name.data == NULL) {
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
location.data = ngx_cpymem(name.data, clcf->doc_root.data,
|
||||
clcf->doc_root.len);
|
||||
last = ngx_cpystrn(location.data, r->uri.data, r->uri.len + 1);
|
||||
location.data = ngx_cpymem(name.data, clcf->root.data, clcf->root.len);
|
||||
|
||||
if (clcf->alias) {
|
||||
last = ngx_cpystrn(location.data, r->uri.data + clcf->name.len,
|
||||
r->uri.len + 1 - clcf->name.len);
|
||||
|
||||
/*
|
||||
* aliases usually have trailling "/",
|
||||
* set it in the start of the possible redirect
|
||||
*/
|
||||
|
||||
if (*location.data != '/') {
|
||||
location.data--;
|
||||
}
|
||||
|
||||
} else {
|
||||
last = ngx_cpystrn(location.data, r->uri.data, r->uri.len + 1);
|
||||
}
|
||||
|
||||
name.len = last - name.data;
|
||||
location.len = last - location.data + 1;
|
||||
|
||||
|
@ -7,12 +7,12 @@
|
||||
|
||||
static int ngx_http_proxy_handler(ngx_http_request_t *r);
|
||||
|
||||
static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_proxy_log_reason(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r,
|
||||
u_char *buf, uintptr_t data);
|
||||
static u_char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r,
|
||||
u_char *buf, uintptr_t data);
|
||||
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 void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf);
|
||||
@ -146,7 +146,7 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
||||
ngx_conf_set_path_slot,
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
offsetof(ngx_http_proxy_loc_conf_t, temp_path),
|
||||
ngx_garbage_collector_temp_handler },
|
||||
(void *) ngx_garbage_collector_temp_handler },
|
||||
|
||||
{ ngx_string("proxy_temp_file_write_size"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
||||
@ -591,7 +591,7 @@ void ngx_http_proxy_close_connection(ngx_http_proxy_ctx_t *p)
|
||||
ngx_close_socket_n " failed");
|
||||
}
|
||||
|
||||
c->fd = -1;
|
||||
c->fd = (ngx_socket_t) -1;
|
||||
}
|
||||
|
||||
|
||||
@ -614,12 +614,12 @@ size_t ngx_http_proxy_log_error(void *data, char *buf, size_t len)
|
||||
ctx->proxy->lcf->upstream->uri.data,
|
||||
r->uri.data + ctx->proxy->lcf->upstream->location->len,
|
||||
r->args.len ? "?" : "",
|
||||
r->args.len ? r->args.data : "");
|
||||
r->args.len ? r->args.data : (u_char *) "");
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r,
|
||||
u_char *buf, uintptr_t data)
|
||||
{
|
||||
ngx_http_proxy_ctx_t *p;
|
||||
|
||||
@ -644,7 +644,8 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
|
||||
*buf++ = '-';
|
||||
|
||||
} else {
|
||||
buf += ngx_snprintf(buf, NGX_TIME_T_LEN, TIME_T_FMT, p->state->expired);
|
||||
buf += ngx_snprintf((char *) buf, NGX_TIME_T_LEN,
|
||||
TIME_T_FMT, p->state->expired);
|
||||
}
|
||||
|
||||
*buf++ = '/';
|
||||
@ -653,7 +654,8 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
|
||||
*buf++ = '-';
|
||||
|
||||
} else {
|
||||
buf += ngx_snprintf(buf, NGX_TIME_T_LEN, TIME_T_FMT, p->state->bl_time);
|
||||
buf += ngx_snprintf((char *) buf, NGX_TIME_T_LEN,
|
||||
TIME_T_FMT, p->state->bl_time);
|
||||
}
|
||||
|
||||
*buf++ = '/';
|
||||
@ -666,7 +668,7 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
|
||||
*buf++ = '-';
|
||||
|
||||
} else {
|
||||
buf += ngx_snprintf(buf, 4, "%d", p->state->status);
|
||||
buf += ngx_snprintf((char *) buf, 4, "%d", p->state->status);
|
||||
}
|
||||
|
||||
*buf++ = '/';
|
||||
@ -685,7 +687,8 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
|
||||
*buf++ = '-';
|
||||
|
||||
} else {
|
||||
buf += ngx_snprintf(buf, NGX_TIME_T_LEN, TIME_T_FMT, p->state->expires);
|
||||
buf += ngx_snprintf((char *) buf, NGX_TIME_T_LEN,
|
||||
TIME_T_FMT, p->state->expires);
|
||||
}
|
||||
|
||||
*buf++ = ' ';
|
||||
@ -695,8 +698,8 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r,
|
||||
u_char *buf, uintptr_t data)
|
||||
{
|
||||
ngx_http_proxy_ctx_t *p;
|
||||
|
||||
@ -712,8 +715,8 @@ static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_proxy_log_reason(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_proxy_log_reason(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
ngx_http_proxy_ctx_t *p;
|
||||
|
||||
@ -777,17 +780,17 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
||||
|
||||
*/
|
||||
|
||||
conf->request_buffer_size = NGX_CONF_UNSET;
|
||||
conf->connect_timeout = NGX_CONF_UNSET;
|
||||
conf->send_timeout = NGX_CONF_UNSET;
|
||||
conf->request_buffer_size = NGX_CONF_UNSET_SIZE;
|
||||
conf->connect_timeout = NGX_CONF_UNSET_MSEC;
|
||||
conf->send_timeout = NGX_CONF_UNSET_MSEC;
|
||||
|
||||
conf->preserve_host = NGX_CONF_UNSET;
|
||||
conf->set_x_real_ip = NGX_CONF_UNSET;
|
||||
conf->add_x_forwarded_for = NGX_CONF_UNSET;
|
||||
|
||||
conf->header_buffer_size = NGX_CONF_UNSET;
|
||||
conf->read_timeout = NGX_CONF_UNSET;
|
||||
conf->busy_buffers_size = NGX_CONF_UNSET;
|
||||
conf->header_buffer_size = NGX_CONF_UNSET_SIZE;
|
||||
conf->read_timeout = NGX_CONF_UNSET_MSEC;
|
||||
conf->busy_buffers_size = NGX_CONF_UNSET_SIZE;
|
||||
|
||||
/*
|
||||
* "proxy_max_temp_file_size" is hardcoded to 1G for reverse proxy,
|
||||
@ -795,7 +798,7 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
||||
*/
|
||||
conf->max_temp_file_size = 1024 * 1024 * 1024;
|
||||
|
||||
conf->temp_file_write_size = NGX_CONF_UNSET;
|
||||
conf->temp_file_write_size = NGX_CONF_UNSET_SIZE;
|
||||
|
||||
/* "proxy_cyclic_temp_file" is disabled */
|
||||
conf->cyclic_temp_file = 0;
|
||||
@ -906,8 +909,9 @@ static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
{
|
||||
ngx_http_proxy_loc_conf_t *lcf = conf;
|
||||
|
||||
int i, len;
|
||||
char *err, *host;
|
||||
ngx_uint_t i, len;
|
||||
char *err;
|
||||
u_char *host;
|
||||
in_addr_t addr;
|
||||
ngx_str_t *value;
|
||||
struct hostent *h;
|
||||
@ -946,10 +950,10 @@ static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
|
||||
/* AF_INET only */
|
||||
|
||||
addr = inet_addr(host);
|
||||
addr = inet_addr((char *) host);
|
||||
|
||||
if (addr == INADDR_NONE) {
|
||||
h = gethostbyname(host);
|
||||
h = gethostbyname((char *) host);
|
||||
|
||||
if (h == NULL || h->h_addr_list[0] == NULL) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "host %s not found", host);
|
||||
@ -980,7 +984,7 @@ static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
NGX_CONF_ERROR);
|
||||
|
||||
len = ngx_inet_ntop(AF_INET,
|
||||
(char *) &lcf->peers->peers[i].addr,
|
||||
(u_char *) &lcf->peers->peers[i].addr,
|
||||
lcf->peers->peers[i].addr_port_text.data,
|
||||
len);
|
||||
|
||||
|
@ -40,40 +40,40 @@ typedef struct {
|
||||
ngx_str_t host_header;
|
||||
ngx_str_t port_text;
|
||||
ngx_str_t *location;
|
||||
int port;
|
||||
|
||||
ngx_int_t port;
|
||||
|
||||
unsigned default_port:1;
|
||||
} ngx_http_proxy_upstream_conf_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ssize_t request_buffer_size;
|
||||
size_t request_buffer_size;
|
||||
size_t header_buffer_size;
|
||||
size_t busy_buffers_size;
|
||||
size_t max_temp_file_size;
|
||||
size_t temp_file_write_size;
|
||||
|
||||
ngx_msec_t connect_timeout;
|
||||
ngx_msec_t send_timeout;
|
||||
ssize_t header_buffer_size;
|
||||
ngx_msec_t read_timeout;
|
||||
time_t default_expires;
|
||||
|
||||
ngx_int_t lm_factor;
|
||||
|
||||
ngx_uint_t next_upstream;
|
||||
ngx_uint_t use_stale;
|
||||
|
||||
ngx_bufs_t bufs;
|
||||
ssize_t busy_buffers_size;
|
||||
|
||||
ssize_t max_temp_file_size;
|
||||
ssize_t temp_file_write_size;
|
||||
ngx_flag_t cyclic_temp_file;
|
||||
|
||||
ngx_flag_t cache;
|
||||
|
||||
ngx_flag_t preserve_host;
|
||||
ngx_flag_t set_x_real_ip;
|
||||
ngx_flag_t add_x_forwarded_for;
|
||||
|
||||
ngx_flag_t pass_server;
|
||||
ngx_flag_t pass_x_accel_expires;
|
||||
|
||||
ngx_flag_t ignore_expires;
|
||||
int lm_factor;
|
||||
time_t default_expires;
|
||||
|
||||
u_int next_upstream;
|
||||
u_int use_stale;
|
||||
|
||||
ngx_path_t *cache_path;
|
||||
ngx_path_t *temp_path;
|
||||
@ -96,9 +96,9 @@ typedef struct {
|
||||
ngx_http_proxy_state_e cache_state;
|
||||
time_t expired;
|
||||
time_t bl_time;
|
||||
int bl_state;
|
||||
ngx_uint_t bl_state;
|
||||
|
||||
int status;
|
||||
ngx_uint_t status;
|
||||
ngx_http_proxy_reason_e reason;
|
||||
time_t time;
|
||||
time_t expires;
|
||||
@ -130,7 +130,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
ngx_http_cache_ctx_t ctx;
|
||||
int status;
|
||||
ngx_uint_t status;
|
||||
ngx_str_t status_line;
|
||||
|
||||
ngx_http_proxy_headers_in_t headers_in;
|
||||
@ -139,9 +139,9 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
ngx_peer_connection_t peer;
|
||||
int status;
|
||||
ngx_uint_t status;
|
||||
ngx_str_t status_line;
|
||||
int method;
|
||||
ngx_uint_t method;
|
||||
|
||||
ngx_output_chain_ctx_t *output_chain_ctx;
|
||||
ngx_event_pipe_t *event_pipe;
|
||||
@ -175,23 +175,23 @@ struct ngx_http_proxy_ctx_s {
|
||||
|
||||
|
||||
/* used to parse an upstream HTTP header */
|
||||
int status;
|
||||
char *status_start;
|
||||
char *status_end;
|
||||
int status_count;
|
||||
int parse_state;
|
||||
ngx_uint_t status;
|
||||
u_char *status_start;
|
||||
u_char *status_end;
|
||||
ngx_uint_t status_count;
|
||||
ngx_uint_t parse_state;
|
||||
|
||||
ngx_http_proxy_state_t *state;
|
||||
ngx_array_t states; /* of ngx_http_proxy_state_t */
|
||||
|
||||
char *action;
|
||||
u_char *action;
|
||||
ngx_http_log_ctx_t *saved_ctx;
|
||||
ngx_log_handler_pt saved_handler;
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_int connection;
|
||||
ngx_uint_t connection;
|
||||
ngx_http_proxy_ctx_t *proxy;
|
||||
} ngx_http_proxy_log_ctx_t;
|
||||
|
||||
|
@ -11,7 +11,7 @@ static int ngx_http_proxy_rewrite_location_header(ngx_http_proxy_ctx_t *p,
|
||||
int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p,
|
||||
ngx_http_proxy_headers_in_t *headers_in)
|
||||
{
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_table_elt_t *ho, *h;
|
||||
ngx_http_request_t *r;
|
||||
|
||||
@ -97,7 +97,7 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p,
|
||||
static int ngx_http_proxy_rewrite_location_header(ngx_http_proxy_ctx_t *p,
|
||||
ngx_table_elt_t *loc)
|
||||
{
|
||||
char *last;
|
||||
u_char *last;
|
||||
ngx_http_request_t *r;
|
||||
ngx_http_proxy_upstream_conf_t *uc;
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
int ngx_http_proxy_parse_status_line(ngx_http_proxy_ctx_t *p)
|
||||
{
|
||||
char ch;
|
||||
char *pos;
|
||||
u_char ch;
|
||||
u_char *pos;
|
||||
enum {
|
||||
sw_start = 0,
|
||||
sw_H,
|
||||
|
@ -98,8 +98,8 @@ int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p)
|
||||
|
||||
static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p)
|
||||
{
|
||||
int i;
|
||||
size_t len;
|
||||
ngx_uint_t i;
|
||||
ngx_hunk_t *h;
|
||||
ngx_chain_t *chain;
|
||||
ngx_table_elt_t *header;
|
||||
|
@ -46,8 +46,8 @@ ngx_module_t ngx_http_module = {
|
||||
|
||||
static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
int mi, m, s, l, p, a, n;
|
||||
int port_found, addr_found, virtual_names;
|
||||
ngx_uint_t mi, m, s, l, p, a, n;
|
||||
ngx_uint_t port_found, addr_found, virtual_names;
|
||||
char *rv;
|
||||
struct sockaddr_in *addr_in;
|
||||
ngx_conf_t pcf;
|
||||
@ -304,10 +304,8 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
* serves this address:port
|
||||
*/
|
||||
|
||||
if (lscf[l].flags & NGX_HTTP_DEFAULT_SERVER) {
|
||||
if (in_addr[a].flags
|
||||
& NGX_HTTP_DEFAULT_SERVER) {
|
||||
|
||||
if (lscf[l].default_server) {
|
||||
if (in_addr[a].default_server) {
|
||||
ngx_log_error(NGX_LOG_ERR, cf->log, 0,
|
||||
"duplicate default server in %s:%d",
|
||||
lscf[l].file_name.data,
|
||||
@ -316,8 +314,8 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
in_addr[a].flags |= NGX_HTTP_DEFAULT_SERVER;
|
||||
in_addr[a].core_srv_conf = cscfp[s];
|
||||
in_addr[a].default_server = 1;
|
||||
}
|
||||
|
||||
addr_found = 1;
|
||||
@ -340,7 +338,7 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
sizeof(ngx_http_in_addr_t));
|
||||
|
||||
in_addr[a].addr = lscf[l].addr;
|
||||
in_addr[a].flags = lscf[l].flags;
|
||||
in_addr[a].default_server = lscf[l].default_server;
|
||||
in_addr[a].core_srv_conf = cscfp[s];
|
||||
|
||||
/*
|
||||
@ -370,7 +368,7 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
NGX_CONF_ERROR);
|
||||
|
||||
inaddr->addr = lscf[l].addr;
|
||||
inaddr->flags = lscf[l].flags;
|
||||
inaddr->default_server = lscf[l].default_server;
|
||||
inaddr->core_srv_conf = cscfp[s];
|
||||
|
||||
/*
|
||||
@ -397,7 +395,8 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
ngx_test_null(in_port->port_name.data, ngx_palloc(cf->pool, 7),
|
||||
NGX_CONF_ERROR);
|
||||
in_port->port_name.len = ngx_snprintf(in_port->port_name.data,
|
||||
in_port->port_name.len = ngx_snprintf((char *)
|
||||
in_port->port_name.data,
|
||||
7, ":%d",
|
||||
in_port->port);
|
||||
|
||||
@ -413,7 +412,7 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
/* ... and add the address to this list */
|
||||
|
||||
inaddr->addr = lscf[l].addr;
|
||||
inaddr->flags = lscf[l].flags;
|
||||
inaddr->default_server = lscf[l].default_server;
|
||||
inaddr->core_srv_conf = cscfp[s];
|
||||
|
||||
/*
|
||||
@ -495,14 +494,15 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
NGX_CONF_ERROR);
|
||||
|
||||
ls->addr_text.len =
|
||||
ngx_snprintf(ls->addr_text.data
|
||||
ngx_snprintf((char *) ls->addr_text.data
|
||||
+ ngx_inet_ntop(AF_INET,
|
||||
(char *) &in_addr[a].addr,
|
||||
(u_char *)
|
||||
&in_addr[a].addr,
|
||||
ls->addr_text.data,
|
||||
INET_ADDRSTRLEN),
|
||||
6, ":%d", in_port[p].port);
|
||||
|
||||
ls->fd = -1;
|
||||
ls->fd = (ngx_socket_t) -1;
|
||||
ls->family = AF_INET;
|
||||
ls->type = SOCK_STREAM;
|
||||
ls->protocol = IPPROTO_IP;
|
||||
@ -596,8 +596,8 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
"port: %d %08x", in_port[p].port, &in_port[p]);
|
||||
in_addr = in_port[p].addrs.elts;
|
||||
for (a = 0; a < in_port[p].addrs.nelts; a++) {
|
||||
char ip[20];
|
||||
ngx_inet_ntop(AF_INET, (char *) &in_addr[a].addr, ip, 20);
|
||||
u_char ip[20];
|
||||
ngx_inet_ntop(AF_INET, (u_char *) &in_addr[a].addr, ip, 20);
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, cf->log, 0,
|
||||
"%s %08x", ip, in_addr[a].core_srv_conf);
|
||||
s_name = in_addr[a].names.elts;
|
||||
|
@ -22,10 +22,10 @@ typedef struct ngx_http_cleanup_s ngx_http_cleanup_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_int connection;
|
||||
char *action;
|
||||
char *client;
|
||||
char *url;
|
||||
u_int connection;
|
||||
u_char *action;
|
||||
u_char *client;
|
||||
u_char *url;
|
||||
} ngx_http_log_ctx_t;
|
||||
|
||||
|
||||
@ -69,14 +69,14 @@ void ngx_http_close_request(ngx_http_request_t *r, int error);
|
||||
void ngx_http_close_connection(ngx_connection_t *c);
|
||||
|
||||
|
||||
int ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
int request_buffer_size);
|
||||
ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
size_t request_buffer_size);
|
||||
|
||||
int ngx_http_send_header(ngx_http_request_t *r);
|
||||
int ngx_http_special_response_handler(ngx_http_request_t *r, int error);
|
||||
|
||||
|
||||
time_t ngx_http_parse_time(char *value, size_t len);
|
||||
time_t ngx_http_parse_time(u_char *value, size_t len);
|
||||
size_t ngx_http_get_time(char *buf, time_t t);
|
||||
ngx_table_elt_t *ngx_http_add_header(void *header,
|
||||
ngx_http_header_t *http_headers);
|
||||
|
@ -190,7 +190,7 @@ char *ngx_http_set_busy_lock_slot(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
{
|
||||
char *p = conf;
|
||||
|
||||
int i, dup, invalid;
|
||||
ngx_uint_t i, dup, invalid;
|
||||
ngx_str_t *value, line;
|
||||
ngx_http_busy_lock_t *bl, **blp;
|
||||
|
||||
|
@ -28,6 +28,7 @@ static char *ngx_set_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf);
|
||||
static char *ngx_set_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||
static char *ngx_set_server_name(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
void *conf);
|
||||
static char *ngx_set_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||
static char *ngx_set_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||
static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||
|
||||
@ -129,9 +130,16 @@ static ngx_command_t ngx_http_core_commands[] = {
|
||||
|
||||
{ ngx_string("root"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
||||
ngx_conf_set_str_slot,
|
||||
ngx_set_root,
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
offsetof(ngx_http_core_loc_conf_t, doc_root),
|
||||
0,
|
||||
NULL },
|
||||
|
||||
{ ngx_string("alias"),
|
||||
NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
||||
ngx_set_root,
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
0,
|
||||
NULL },
|
||||
|
||||
{ ngx_string("client_body_timeout"),
|
||||
@ -382,12 +390,12 @@ static void ngx_http_run_phases(ngx_http_request_t *r)
|
||||
|
||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||
|
||||
if (!(path = ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len))) {
|
||||
if (!(path = ngx_palloc(r->pool, clcf->root.len + r->uri.len))) {
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ngx_cpystrn(ngx_cpymem(path, clcf->doc_root.data, clcf->doc_root.len),
|
||||
ngx_cpystrn(ngx_cpymem(path, clcf->root.data, clcf->root.len),
|
||||
r->uri.data, r->uri.len + 1);
|
||||
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
@ -406,7 +414,8 @@ static void ngx_http_run_phases(ngx_http_request_t *r)
|
||||
|
||||
int ngx_http_find_location_config(ngx_http_request_t *r)
|
||||
{
|
||||
ngx_int_t i, rc, exact;
|
||||
int rc;
|
||||
ngx_uint_t i, exact;
|
||||
ngx_str_t *auto_redirect;
|
||||
ngx_http_core_loc_conf_t *clcf, **clcfp;
|
||||
ngx_http_core_srv_conf_t *cscf;
|
||||
@ -544,7 +553,7 @@ int ngx_http_find_location_config(ngx_http_request_t *r)
|
||||
ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r)
|
||||
{
|
||||
uint32_t key;
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
ngx_http_type_t *type;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
||||
@ -856,7 +865,7 @@ static char *ngx_location_block(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
|
||||
ngx_http_core_loc_conf_t *clcf, **clcfp;
|
||||
#if (HAVE_PCRE)
|
||||
ngx_str_t err;
|
||||
char errstr[NGX_MAX_CONF_ERRSTR];
|
||||
u_char errstr[NGX_MAX_CONF_ERRSTR];
|
||||
#endif
|
||||
|
||||
if (!(ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)))) {
|
||||
@ -973,7 +982,8 @@ static char *ngx_set_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
|
||||
{
|
||||
ngx_http_core_loc_conf_t *lcf = conf;
|
||||
|
||||
int i, key;
|
||||
uint32_t key;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *args;
|
||||
ngx_http_type_t *type;
|
||||
|
||||
@ -1021,9 +1031,11 @@ static void *ngx_http_core_create_main_conf(ngx_conf_t *cf)
|
||||
|
||||
static char *ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf)
|
||||
{
|
||||
#if 0
|
||||
ngx_http_core_main_conf_t *cmcf = conf;
|
||||
|
||||
/* TODO: remove it if no directives */
|
||||
#endif
|
||||
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
@ -1044,11 +1056,11 @@ static void *ngx_http_core_create_srv_conf(ngx_conf_t *cf)
|
||||
ngx_init_array(cscf->server_names, cf->pool,
|
||||
5, sizeof(ngx_http_server_name_t), NGX_CONF_ERROR);
|
||||
|
||||
cscf->connection_pool_size = NGX_CONF_UNSET;
|
||||
cscf->post_accept_timeout = NGX_CONF_UNSET;
|
||||
cscf->request_pool_size = NGX_CONF_UNSET;
|
||||
cscf->client_header_timeout = NGX_CONF_UNSET;
|
||||
cscf->client_header_buffer_size = NGX_CONF_UNSET;
|
||||
cscf->connection_pool_size = NGX_CONF_UNSET_SIZE;
|
||||
cscf->post_accept_timeout = NGX_CONF_UNSET_MSEC;
|
||||
cscf->request_pool_size = NGX_CONF_UNSET_SIZE;
|
||||
cscf->client_header_timeout = NGX_CONF_UNSET_MSEC;
|
||||
cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE;
|
||||
cscf->large_client_header = NGX_CONF_UNSET;
|
||||
|
||||
return cscf;
|
||||
@ -1083,7 +1095,7 @@ static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf,
|
||||
ngx_test_null(n->name.data, ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN),
|
||||
NGX_CONF_ERROR);
|
||||
|
||||
if (gethostname(n->name.data, NGX_MAXHOSTNAMELEN) == -1) {
|
||||
if (gethostname((char *) n->name.data, NGX_MAXHOSTNAMELEN) == -1) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
||||
"gethostname() failed");
|
||||
return NGX_CONF_ERROR;
|
||||
@ -1120,8 +1132,8 @@ static void *ngx_http_core_create_loc_conf(ngx_conf_t *cf)
|
||||
|
||||
/* set by ngx_pcalloc():
|
||||
|
||||
lcf->doc_root.len = 0;
|
||||
lcf->doc_root.data = NULL;
|
||||
lcf->root.len = 0;
|
||||
lcf->root.data = NULL;
|
||||
lcf->types = NULL;
|
||||
lcf->default_type.len = 0;
|
||||
lcf->default_type.data = NULL;
|
||||
@ -1131,18 +1143,19 @@ static void *ngx_http_core_create_loc_conf(ngx_conf_t *cf)
|
||||
lcf->regex = NULL;
|
||||
lcf->exact_match = 0;
|
||||
lcf->auto_redirect = 0;
|
||||
lcf->alias = 0;
|
||||
|
||||
*/
|
||||
|
||||
lcf->client_body_timeout = NGX_CONF_UNSET;
|
||||
lcf->client_body_timeout = NGX_CONF_UNSET_MSEC;
|
||||
lcf->sendfile = NGX_CONF_UNSET;
|
||||
lcf->tcp_nopush = NGX_CONF_UNSET;
|
||||
lcf->send_timeout = NGX_CONF_UNSET;
|
||||
lcf->send_lowat = NGX_CONF_UNSET;
|
||||
lcf->discarded_buffer_size = NGX_CONF_UNSET;
|
||||
lcf->keepalive_timeout = NGX_CONF_UNSET;
|
||||
lcf->lingering_time = NGX_CONF_UNSET;
|
||||
lcf->lingering_timeout = NGX_CONF_UNSET;
|
||||
lcf->send_timeout = NGX_CONF_UNSET_MSEC;
|
||||
lcf->send_lowat = NGX_CONF_UNSET_SIZE;
|
||||
lcf->discarded_buffer_size = NGX_CONF_UNSET_SIZE;
|
||||
lcf->keepalive_timeout = NGX_CONF_UNSET_MSEC;
|
||||
lcf->lingering_time = NGX_CONF_UNSET_MSEC;
|
||||
lcf->lingering_timeout = NGX_CONF_UNSET_MSEC;
|
||||
|
||||
lcf->msie_padding = NGX_CONF_UNSET;
|
||||
|
||||
@ -1167,7 +1180,7 @@ static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf,
|
||||
int i, key;
|
||||
ngx_http_type_t *t;
|
||||
|
||||
ngx_conf_merge_str_value(conf->doc_root, prev->doc_root, "html");
|
||||
ngx_conf_merge_str_value(conf->root, prev->root, "html");
|
||||
|
||||
if (conf->types == NULL) {
|
||||
if (prev->types) {
|
||||
@ -1241,7 +1254,7 @@ static char *ngx_set_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_http_core_srv_conf_t *scf = conf;
|
||||
|
||||
char *addr;
|
||||
u_char *addr;
|
||||
u_int p;
|
||||
struct hostent *h;
|
||||
ngx_str_t *args;
|
||||
@ -1255,7 +1268,7 @@ static char *ngx_set_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
/* AF_INET only */
|
||||
|
||||
ls->family = AF_INET;
|
||||
ls->flags = 0;
|
||||
ls->default_server = 0;
|
||||
ls->file_name = cf->conf_file->file.name;
|
||||
ls->line = cf->conf_file->line;
|
||||
|
||||
@ -1295,9 +1308,9 @@ static char *ngx_set_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
||||
ls->addr = inet_addr(addr);
|
||||
ls->addr = inet_addr((const char *) addr);
|
||||
if (ls->addr == INADDR_NONE) {
|
||||
h = gethostbyname(addr);
|
||||
h = gethostbyname((const char *) addr);
|
||||
|
||||
if (h == NULL || h->h_addr_list[0] == NULL) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
@ -1317,7 +1330,7 @@ static char *ngx_set_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_http_core_srv_conf_t *scf = conf;
|
||||
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *value;
|
||||
ngx_http_server_name_t *sn;
|
||||
|
||||
@ -1346,11 +1359,44 @@ static char *ngx_set_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_set_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_http_core_loc_conf_t *lcf = conf;
|
||||
|
||||
ngx_uint_t alias;
|
||||
ngx_str_t *value;
|
||||
|
||||
alias = (cmd->name.len == sizeof("alias") - 1) ? 1 : 0;
|
||||
|
||||
if (lcf->root.data) {
|
||||
if (lcf->alias == alias) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"\"%s\" directive is duplicate",
|
||||
cmd->name.data);
|
||||
} else {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"\"%s\" directive is duplicate, "
|
||||
"\"%s\" directive is specified before",
|
||||
cmd->name.data, lcf->alias ? "alias" : "root");
|
||||
}
|
||||
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
value = cf->args->elts;
|
||||
|
||||
lcf->alias = alias;
|
||||
lcf->root = value[1];
|
||||
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_set_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_http_core_loc_conf_t *lcf = conf;
|
||||
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *value;
|
||||
ngx_http_err_page_t *err;
|
||||
|
||||
@ -1403,7 +1449,7 @@ static char *ngx_http_lowat_check(ngx_conf_t *cf, void *post, void *data)
|
||||
{
|
||||
#if (HAVE_LOWAT_EVENT)
|
||||
|
||||
int *np = data;
|
||||
ssize_t *np = data;
|
||||
|
||||
if (*np >= ngx_freebsd_net_inet_tcp_sendspace) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
|
@ -11,9 +11,10 @@ typedef struct {
|
||||
in_addr_t addr;
|
||||
int port;
|
||||
int family;
|
||||
int flags; /* 'default' */
|
||||
ngx_str_t file_name;
|
||||
int line;
|
||||
|
||||
unsigned default_server:1;
|
||||
} ngx_http_listen_t;
|
||||
|
||||
|
||||
@ -27,7 +28,7 @@ typedef enum {
|
||||
|
||||
typedef struct {
|
||||
ngx_array_t handlers;
|
||||
int type; /* NGX_OK, NGX_DECLINED */
|
||||
ngx_int_t type; /* NGX_OK, NGX_DECLINED */
|
||||
} ngx_http_phase_t;
|
||||
|
||||
|
||||
@ -50,12 +51,14 @@ typedef struct {
|
||||
|
||||
ngx_http_conf_ctx_t *ctx; /* server ctx */
|
||||
|
||||
size_t connection_pool_size;
|
||||
size_t request_pool_size;
|
||||
size_t client_header_buffer_size;
|
||||
|
||||
ngx_msec_t post_accept_timeout;
|
||||
ssize_t connection_pool_size;
|
||||
ssize_t request_pool_size;
|
||||
ngx_msec_t client_header_timeout;
|
||||
ssize_t client_header_buffer_size;
|
||||
int large_client_header;
|
||||
|
||||
ngx_flag_t large_client_header;
|
||||
} ngx_http_core_srv_conf_t;
|
||||
|
||||
|
||||
@ -73,11 +76,9 @@ typedef struct {
|
||||
ngx_array_t names; /* array of ngx_http_server_name_t */
|
||||
ngx_http_core_srv_conf_t *core_srv_conf; /* default server conf
|
||||
for this address:port */
|
||||
int flags;
|
||||
} ngx_http_in_addr_t;
|
||||
|
||||
/* ngx_http_in_addr_t's flags */
|
||||
#define NGX_HTTP_DEFAULT_SERVER 1
|
||||
unsigned default_server:1;
|
||||
} ngx_http_in_addr_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
@ -115,22 +116,24 @@ typedef struct {
|
||||
|
||||
int (*handler) (ngx_http_request_t *r);
|
||||
|
||||
ngx_str_t doc_root; /* root */
|
||||
ngx_str_t root; /* root, alias */
|
||||
|
||||
ngx_array_t *types;
|
||||
ngx_str_t default_type;
|
||||
|
||||
size_t send_lowat; /* send_lowat */
|
||||
size_t discarded_buffer_size; /* discarded_buffer_size */
|
||||
|
||||
ngx_msec_t client_body_timeout; /* client_body_timeout */
|
||||
int sendfile; /* sendfile */
|
||||
int tcp_nopush; /* tcp_nopush */
|
||||
ngx_msec_t send_timeout; /* send_timeout */
|
||||
ssize_t send_lowat; /* send_lowat */
|
||||
ssize_t discarded_buffer_size; /* discarded_buffer_size */
|
||||
ngx_msec_t keepalive_timeout; /* keepalive_timeout */
|
||||
ngx_msec_t lingering_time; /* lingering_time */
|
||||
ngx_msec_t lingering_timeout; /* lingering_timeout */
|
||||
|
||||
int msie_padding; /* msie_padding */
|
||||
ngx_flag_t sendfile; /* sendfile */
|
||||
ngx_flag_t tcp_nopush; /* tcp_nopush */
|
||||
ngx_flag_t msie_padding; /* msie_padding */
|
||||
|
||||
ngx_array_t *error_pages; /* error_page */
|
||||
|
||||
ngx_http_cache_hash_t *open_files;
|
||||
@ -141,6 +144,7 @@ typedef struct {
|
||||
|
||||
unsigned exact_match:1;
|
||||
unsigned auto_redirect:1;
|
||||
unsigned alias:1;
|
||||
|
||||
ngx_log_t *err_log;
|
||||
} ngx_http_core_loc_conf_t;
|
||||
|
@ -92,8 +92,9 @@ static ngx_str_t http_codes[] = {
|
||||
|
||||
static int ngx_http_header_filter(ngx_http_request_t *r)
|
||||
{
|
||||
int len, status, i;
|
||||
char *p;
|
||||
u_char *p;
|
||||
size_t len;
|
||||
ngx_uint_t status, i;
|
||||
ngx_hunk_t *h;
|
||||
ngx_chain_t *ln;
|
||||
ngx_table_elt_t *header;
|
||||
@ -246,7 +247,7 @@ static int ngx_http_header_filter(ngx_http_request_t *r)
|
||||
|
||||
if (r->headers_out.content_length == NULL) {
|
||||
if (r->headers_out.content_length_n >= 0) {
|
||||
h->last += ngx_snprintf(h->last,
|
||||
h->last += ngx_snprintf((char *) h->last,
|
||||
sizeof("Content-Length: ") + NGX_OFF_T_LEN + 2,
|
||||
"Content-Length: " OFF_T_FMT CRLF,
|
||||
r->headers_out.content_length_n);
|
||||
|
@ -60,8 +60,8 @@ ngx_http_header_t ngx_http_headers_out[] = {
|
||||
ngx_table_elt_t *ngx_http_add_header(void *header,
|
||||
ngx_http_header_t *http_headers)
|
||||
{
|
||||
int i, j;
|
||||
char *prev;
|
||||
ngx_uint_t i, j;
|
||||
ngx_table_t *headers;
|
||||
ngx_table_elt_t *h, *new;
|
||||
|
||||
|
@ -5,35 +5,35 @@
|
||||
#include <nginx.h>
|
||||
|
||||
|
||||
static char *ngx_http_log_addr(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_connection(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_pipe(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_time(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_request(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_status(ngx_http_request_t *r, char *buf,
|
||||
static u_char *ngx_http_log_addr(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_length(ngx_http_request_t *r, char *buf,
|
||||
static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_apache_length(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_header_in(ngx_http_request_t *r, char *buf,
|
||||
static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
|
||||
char *buf, uintptr_t data);
|
||||
static char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r,
|
||||
char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_unknown_header_in(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_header_out(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
|
||||
u_char *buf, uintptr_t data);
|
||||
static u_char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r,
|
||||
u_char *buf,
|
||||
uintptr_t data);
|
||||
static u_char *ngx_http_log_unknown_header_in(ngx_http_request_t *r,
|
||||
u_char *buf, uintptr_t data);
|
||||
static u_char *ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
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 void *ngx_http_log_create_main_conf(ngx_conf_t *cf);
|
||||
@ -118,9 +118,9 @@ ngx_http_log_op_name_t ngx_http_log_fmt_ops[] = {
|
||||
|
||||
int ngx_http_log_handler(ngx_http_request_t *r)
|
||||
{
|
||||
int i, l;
|
||||
u_int data;
|
||||
char *line, *p;
|
||||
ngx_uint_t i, l;
|
||||
uintptr_t data;
|
||||
u_char *line, *p;
|
||||
size_t len;
|
||||
ngx_http_log_t *log;
|
||||
ngx_http_log_op_t *op;
|
||||
@ -162,7 +162,7 @@ int ngx_http_log_handler(ngx_http_request_t *r)
|
||||
len = op[i].len;
|
||||
data = op[i].data;
|
||||
while (len--) {
|
||||
*p++ = data & 0xff;
|
||||
*p++ = (char) (data & 0xff);
|
||||
data >>= 8;
|
||||
}
|
||||
|
||||
@ -187,22 +187,24 @@ int ngx_http_log_handler(ngx_http_request_t *r)
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_addr(ngx_http_request_t *r, char *buf, uintptr_t data)
|
||||
static u_char *ngx_http_log_addr(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
return ngx_cpymem(buf, r->connection->addr_text.data,
|
||||
r->connection->addr_text.len);
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_connection(ngx_http_request_t *r, char *buf,
|
||||
static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
return buf + ngx_snprintf(buf, NGX_INT32_LEN + 1, "%u",
|
||||
return buf + ngx_snprintf((char *) buf, NGX_INT32_LEN + 1, "%u",
|
||||
r->connection->number);
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_pipe(ngx_http_request_t *r, char *buf, uintptr_t data)
|
||||
static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
if (r->pipeline) {
|
||||
*buf = 'p';
|
||||
@ -214,53 +216,54 @@ static char *ngx_http_log_pipe(ngx_http_request_t *r, char *buf, uintptr_t data)
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_time(ngx_http_request_t *r, char *buf, uintptr_t data)
|
||||
static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
return ngx_cpymem(buf, ngx_cached_http_log_time.data,
|
||||
ngx_cached_http_log_time.len);
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_request(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
if (buf == NULL) {
|
||||
/* find the request line length */
|
||||
return (char *) r->request_line.len;
|
||||
return (u_char *) r->request_line.len;
|
||||
}
|
||||
|
||||
return ngx_cpymem(buf, r->request_line.data, r->request_line.len);
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_status(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
return buf + ngx_snprintf(buf, 4, "%d",
|
||||
return buf + ngx_snprintf((char *) buf, 4, "%d",
|
||||
r->err_status ? r->err_status : r->headers_out.status);
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_length(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
return buf + ngx_snprintf(buf, NGX_OFF_T_LEN + 1, OFF_T_FMT,
|
||||
return buf + ngx_snprintf((char *) buf, NGX_OFF_T_LEN + 1, OFF_T_FMT,
|
||||
r->connection->sent);
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_apache_length(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
return buf + ngx_snprintf(buf, NGX_OFF_T_LEN + 1, OFF_T_FMT,
|
||||
return buf + ngx_snprintf((char *) buf, NGX_OFF_T_LEN + 1, OFF_T_FMT,
|
||||
r->connection->sent - r->header_size);
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_header_in(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *s;
|
||||
ngx_table_elt_t *h;
|
||||
ngx_http_log_op_t *op;
|
||||
@ -281,7 +284,7 @@ static char *ngx_http_log_header_in(ngx_http_request_t *r, char *buf,
|
||||
|
||||
if (buf == NULL) {
|
||||
/* find the header length */
|
||||
return (char *) h->value.len;
|
||||
return (u_char *) h->value.len;
|
||||
}
|
||||
|
||||
return ngx_cpymem(buf, h->value.data, h->value.len);
|
||||
@ -315,10 +318,10 @@ static char *ngx_http_log_header_in(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_unknown_header_in(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_unknown_header_in(ngx_http_request_t *r,
|
||||
u_char *buf, uintptr_t data)
|
||||
{
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *s;
|
||||
ngx_table_elt_t *h;
|
||||
|
||||
@ -333,7 +336,7 @@ static char *ngx_http_log_unknown_header_in(ngx_http_request_t *r, char *buf,
|
||||
if (ngx_strncasecmp(h[i].key.data, s->data, s->len) == 0) {
|
||||
if (buf == NULL) {
|
||||
/* find the header length */
|
||||
return (char *) h[i].value.len;
|
||||
return (u_char *) h[i].value.len;
|
||||
}
|
||||
|
||||
return ngx_cpymem(buf, h[i].value.data, h[i].value.len);
|
||||
@ -350,10 +353,10 @@ static char *ngx_http_log_unknown_header_in(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_header_out(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *s;
|
||||
ngx_table_elt_t *h;
|
||||
ngx_http_log_op_t *op;
|
||||
@ -384,7 +387,7 @@ static char *ngx_http_log_header_out(ngx_http_request_t *r, char *buf,
|
||||
|
||||
if (data == offsetof(ngx_http_headers_out_t, date)) {
|
||||
if (buf == NULL) {
|
||||
return (char *) ngx_cached_http_time.len;
|
||||
return (u_char *) ngx_cached_http_time.len;
|
||||
}
|
||||
return ngx_cpymem(buf, ngx_cached_http_time.data,
|
||||
ngx_cached_http_time.len);
|
||||
@ -392,7 +395,7 @@ static char *ngx_http_log_header_out(ngx_http_request_t *r, char *buf,
|
||||
|
||||
if (data == offsetof(ngx_http_headers_out_t, server)) {
|
||||
if (buf == NULL) {
|
||||
return (char *) (sizeof(NGINX_VER) - 1);
|
||||
return (u_char *) (sizeof(NGINX_VER) - 1);
|
||||
}
|
||||
return ngx_cpymem(buf, NGINX_VER, sizeof(NGINX_VER) - 1);
|
||||
}
|
||||
@ -406,9 +409,10 @@ static char *ngx_http_log_header_out(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
|
||||
if (buf == NULL) {
|
||||
return (char *) NGX_OFF_T_LEN;
|
||||
return (u_char *) NGX_OFF_T_LEN;
|
||||
}
|
||||
return buf + ngx_snprintf(buf, NGX_OFF_T_LEN + 2, OFF_T_FMT,
|
||||
return buf + ngx_snprintf((char *) buf,
|
||||
NGX_OFF_T_LEN + 2, OFF_T_FMT,
|
||||
r->headers_out.content_length_n);
|
||||
}
|
||||
|
||||
@ -421,7 +425,8 @@ static char *ngx_http_log_header_out(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
|
||||
if (buf == NULL) {
|
||||
return (char *) sizeof("Mon, 28 Sep 1970 06:00:00 GMT") - 1;
|
||||
return (u_char *)
|
||||
sizeof("Mon, 28 Sep 1970 06:00:00 GMT") - 1;
|
||||
}
|
||||
return buf + ngx_http_time(buf,
|
||||
r->headers_out.last_modified_time);
|
||||
@ -436,7 +441,7 @@ static char *ngx_http_log_header_out(ngx_http_request_t *r, char *buf,
|
||||
|
||||
if (buf == NULL) {
|
||||
/* find the header length */
|
||||
return (char *) h->value.len;
|
||||
return (u_char *) h->value.len;
|
||||
}
|
||||
|
||||
return ngx_cpymem(buf, h->value.data, h->value.len);
|
||||
@ -485,12 +490,12 @@ static char *ngx_http_log_header_out(ngx_http_request_t *r, char *buf,
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
|
||||
char *buf, uintptr_t data)
|
||||
static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
|
||||
u_char *buf, uintptr_t data)
|
||||
{
|
||||
if (buf == NULL) {
|
||||
return (char *) ((r->keepalive) ? sizeof("keep-alive") - 1:
|
||||
sizeof("close") - 1);
|
||||
return (u_char *) ((r->keepalive) ? sizeof("keep-alive") - 1:
|
||||
sizeof("close") - 1);
|
||||
}
|
||||
|
||||
if (r->keepalive) {
|
||||
@ -502,12 +507,12 @@ static char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r,
|
||||
char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r,
|
||||
u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
if (buf == NULL) {
|
||||
return (char *) ((r->chunked) ? sizeof("chunked") - 1 : 1);
|
||||
return (u_char *) ((r->chunked) ? sizeof("chunked") - 1 : 1);
|
||||
}
|
||||
|
||||
if (r->chunked) {
|
||||
@ -520,10 +525,11 @@ static char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r,
|
||||
}
|
||||
|
||||
|
||||
static char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data)
|
||||
static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r,
|
||||
u_char *buf,
|
||||
uintptr_t data)
|
||||
{
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *s;
|
||||
ngx_table_elt_t *h;
|
||||
|
||||
@ -538,7 +544,7 @@ static char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, char *buf,
|
||||
if (ngx_strncasecmp(h[i].key.data, s->data, s->len) == 0) {
|
||||
if (buf == NULL) {
|
||||
/* find the header length */
|
||||
return (char *) h[i].value.len;
|
||||
return (u_char *) h[i].value.len;
|
||||
}
|
||||
|
||||
return ngx_cpymem(buf, h[i].value.data, h[i].value.len);
|
||||
@ -665,7 +671,7 @@ static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
{
|
||||
ngx_http_log_loc_conf_t *llcf = conf;
|
||||
|
||||
int i;
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *value, name;
|
||||
ngx_http_log_t *log;
|
||||
ngx_http_log_fmt_t *fmt;
|
||||
@ -715,8 +721,8 @@ static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
{
|
||||
ngx_http_log_main_conf_t *lmcf = conf;
|
||||
|
||||
int s, f, invalid;
|
||||
char *data, *p, *fname;
|
||||
ngx_uint_t s, f, invalid;
|
||||
u_char *data, *p, *fname;
|
||||
size_t i, len, fname_len;
|
||||
ngx_str_t *value, arg, *a;
|
||||
ngx_http_log_op_t *op;
|
||||
@ -843,7 +849,7 @@ static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
}
|
||||
|
||||
*a = arg;
|
||||
name->op(NULL, (char *) op, (uintptr_t) a);
|
||||
name->op(NULL, (u_char *) op, (uintptr_t) a);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <ngx_http.h>
|
||||
|
||||
|
||||
typedef char *(*ngx_http_log_op_pt) (ngx_http_request_t *r, char *buf,
|
||||
uintptr_t data);
|
||||
typedef u_char *(*ngx_http_log_op_pt) (ngx_http_request_t *r, u_char *buf,
|
||||
uintptr_t data);
|
||||
|
||||
#define NGX_HTTP_LOG_COPY_SHORT (ngx_http_log_op_pt) 0
|
||||
#define NGX_HTTP_LOG_COPY_LONG (ngx_http_log_op_pt) -1
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r)
|
||||
{
|
||||
char ch, *p;
|
||||
u_char ch, *p;
|
||||
enum {
|
||||
sw_start = 0,
|
||||
sw_G,
|
||||
@ -421,7 +421,7 @@ ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r)
|
||||
|
||||
ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_hunk_t *h)
|
||||
{
|
||||
char c, ch, *p;
|
||||
u_char c, ch, *p;
|
||||
enum {
|
||||
sw_start = 0,
|
||||
sw_name,
|
||||
@ -458,7 +458,7 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_hunk_t *h)
|
||||
state = sw_name;
|
||||
r->header_name_start = p - 1;
|
||||
|
||||
c = ch | 0x20;
|
||||
c = (char) (ch | 0x20);
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
break;
|
||||
}
|
||||
@ -478,7 +478,7 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_hunk_t *h)
|
||||
|
||||
/* header name */
|
||||
case sw_name:
|
||||
c = ch | 0x20;
|
||||
c = (u_char) (ch | 0x20);
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
break;
|
||||
}
|
||||
@ -623,7 +623,7 @@ ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_hunk_t *h)
|
||||
|
||||
ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r)
|
||||
{
|
||||
char c, ch, decoded, *p, *u;
|
||||
u_char c, ch, decoded, *p, *u;
|
||||
enum {
|
||||
sw_usual = 0,
|
||||
sw_slash,
|
||||
@ -778,15 +778,15 @@ ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r)
|
||||
|
||||
case sw_quoted:
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
decoded = ch - '0';
|
||||
decoded = (char) (ch - '0');
|
||||
state = sw_quoted_second;
|
||||
ch = *p++;
|
||||
break;
|
||||
}
|
||||
|
||||
c = ch | 0x20;
|
||||
c = (char) (ch | 0x20);
|
||||
if (c >= 'a' && c <= 'f') {
|
||||
decoded = c - 'a' + 10;
|
||||
decoded = (char) (c - 'a' + 10);
|
||||
state = sw_quoted_second;
|
||||
ch = *p++;
|
||||
break;
|
||||
@ -796,7 +796,7 @@ ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r)
|
||||
|
||||
case sw_quoted_second:
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
ch = (decoded << 4) + ch - '0';
|
||||
ch = (char) ((decoded << 4) + ch - '0');
|
||||
if (ch == '%') {
|
||||
state = sw_usual;
|
||||
*u++ = ch;
|
||||
@ -807,9 +807,9 @@ ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r)
|
||||
break;
|
||||
}
|
||||
|
||||
c = ch | 0x20;
|
||||
c = (char) (ch | 0x20);
|
||||
if (c >= 'a' && c <= 'f') {
|
||||
ch = (decoded << 4) + c - 'a' + 10;
|
||||
ch = (char) ((decoded << 4) + c - 'a' + 10);
|
||||
if (ch == '%') {
|
||||
state = sw_usual;
|
||||
*u++ = ch;
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
static int mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
time_t ngx_http_parse_time(char *value, size_t len)
|
||||
time_t ngx_http_parse_time(u_char *value, size_t len)
|
||||
{
|
||||
char *p, *end;
|
||||
int day, month, year, hour, min, sec;
|
||||
u_char *p, *end;
|
||||
int day, month, year, hour, min, sec;
|
||||
enum {
|
||||
no = 0,
|
||||
rfc822, /* Tue 10 Nov 2002 23:50:13 */
|
||||
|
@ -115,7 +115,7 @@ void ngx_http_init_connection(ngx_connection_t *c)
|
||||
|
||||
static void ngx_http_init_request(ngx_event_t *rev)
|
||||
{
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
socklen_t len;
|
||||
struct sockaddr_in addr_in;
|
||||
ngx_connection_t *c;
|
||||
@ -182,12 +182,13 @@ static void ngx_http_init_request(ngx_event_t *rev)
|
||||
ngx_http_close_connection(c);
|
||||
return;
|
||||
}
|
||||
|
||||
r->in_addr = addr_in.sin_addr.s_addr;
|
||||
|
||||
#if (WIN32)
|
||||
}
|
||||
#endif
|
||||
|
||||
r->in_addr = addr_in.sin_addr.s_addr;
|
||||
|
||||
/* the last in_port->addrs address is "*" */
|
||||
|
||||
for ( /* void */ ; i < in_port->addrs.nelts - 1; i++) {
|
||||
@ -279,7 +280,7 @@ static void ngx_http_init_request(ngx_event_t *rev)
|
||||
|
||||
static void ngx_http_process_request_line(ngx_event_t *rev)
|
||||
{
|
||||
char *p;
|
||||
u_char *p;
|
||||
ssize_t n;
|
||||
ngx_int_t rc, offset;
|
||||
ngx_connection_t *c;
|
||||
@ -453,11 +454,12 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
|
||||
"http uri: \"%s\"", r->uri.data);
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"http args: \"%s\"", r->args.data ? r->args.data : "");
|
||||
"http args: \"%s\"",
|
||||
r->args.data ? r->args.data : (u_char *) "");
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"http exten: \"%s\"",
|
||||
r->exten.data ? r->exten.data : "");
|
||||
r->exten.data ? r->exten.data : (u_char *) "");
|
||||
|
||||
if (r->http_version < NGX_HTTP_VERSION_10) {
|
||||
rev->event_handler = ngx_http_block_read;
|
||||
@ -681,7 +683,7 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
|
||||
|
||||
#if (NGX_LOG_DEBUG)
|
||||
if (rc == NGX_HTTP_PARSE_INVALID_HEADER) {
|
||||
char *p;
|
||||
u_char *p;
|
||||
for (p = r->header_name_start;
|
||||
p < r->header_in->last - 1;
|
||||
p++)
|
||||
@ -794,7 +796,7 @@ static ssize_t ngx_http_read_request_header(ngx_http_request_t *r)
|
||||
static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r)
|
||||
{
|
||||
size_t len;
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
ngx_http_server_name_t *name;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
||||
@ -1133,8 +1135,8 @@ static int ngx_http_read_discarded_body(ngx_http_request_t *r)
|
||||
|
||||
size = r->headers_in.content_length_n;
|
||||
|
||||
if (size > clcf->discarded_buffer_size) {
|
||||
size = clcf->discarded_buffer_size;
|
||||
if (size > (ssize_t) clcf->discarded_buffer_size) {
|
||||
size = (ssize_t) clcf->discarded_buffer_size;
|
||||
}
|
||||
|
||||
n = ngx_recv(r->connection, r->discarded_buffer, size);
|
||||
@ -1396,7 +1398,8 @@ static void ngx_http_lingering_close_handler(ngx_event_t *rev)
|
||||
instead of r->header_in->last */
|
||||
|
||||
if (r->header_in->end - r->header_in->last
|
||||
>= clcf->discarded_buffer_size) {
|
||||
>= (ssize_t) clcf->discarded_buffer_size)
|
||||
{
|
||||
r->discarded_buffer = r->header_in->last;
|
||||
|
||||
} else {
|
||||
@ -1458,7 +1461,7 @@ int ngx_http_send_last(ngx_http_request_t *r)
|
||||
|
||||
void ngx_http_close_request(ngx_http_request_t *r, int error)
|
||||
{
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
ngx_log_t *log;
|
||||
ngx_http_log_ctx_t *ctx;
|
||||
ngx_http_cleanup_t *cleanup;
|
||||
@ -1559,7 +1562,7 @@ void ngx_http_close_connection(ngx_connection_t *c)
|
||||
ngx_close_socket_n " failed");
|
||||
}
|
||||
|
||||
c->fd = -1;
|
||||
c->fd = (ngx_socket_t) -1;
|
||||
c->data = NULL;
|
||||
|
||||
ngx_destroy_pool(c->pool);
|
||||
|
@ -2,34 +2,34 @@
|
||||
#define _NGX_HTTP_REQUEST_H_INCLUDED_
|
||||
|
||||
|
||||
#define NGX_HTTP_VERSION_9 9
|
||||
#define NGX_HTTP_VERSION_10 1000
|
||||
#define NGX_HTTP_VERSION_11 1001
|
||||
#define NGX_HTTP_VERSION_9 9
|
||||
#define NGX_HTTP_VERSION_10 1000
|
||||
#define NGX_HTTP_VERSION_11 1001
|
||||
|
||||
#define NGX_HTTP_GET 1
|
||||
#define NGX_HTTP_HEAD 2
|
||||
#define NGX_HTTP_POST 3
|
||||
#define NGX_HTTP_GET 1
|
||||
#define NGX_HTTP_HEAD 2
|
||||
#define NGX_HTTP_POST 3
|
||||
|
||||
#define NGX_HTTP_CONNECTION_CLOSE 1
|
||||
#define NGX_HTTP_CONNECTION_KEEP_ALIVE 2
|
||||
#define NGX_HTTP_CONNECTION_CLOSE 1
|
||||
#define NGX_HTTP_CONNECTION_KEEP_ALIVE 2
|
||||
|
||||
|
||||
#define NGX_NONE 1
|
||||
#define NGX_NONE 1
|
||||
|
||||
|
||||
#define NGX_HTTP_PARSE_HEADER_DONE 1
|
||||
#define NGX_HTTP_PARSE_HEADER_DONE 1
|
||||
|
||||
#define NGX_HTTP_CLIENT_ERROR 10
|
||||
#define NGX_HTTP_PARSE_INVALID_METHOD 10
|
||||
#define NGX_HTTP_PARSE_INVALID_REQUEST 11
|
||||
#define NGX_HTTP_PARSE_TOO_LONG_URI 12
|
||||
#define NGX_HTTP_PARSE_INVALID_09_METHOD 13
|
||||
#define NGX_HTTP_CLIENT_ERROR 10
|
||||
#define NGX_HTTP_PARSE_INVALID_METHOD 10
|
||||
#define NGX_HTTP_PARSE_INVALID_REQUEST 11
|
||||
#define NGX_HTTP_PARSE_TOO_LONG_URI 12
|
||||
#define NGX_HTTP_PARSE_INVALID_09_METHOD 13
|
||||
|
||||
#define NGX_HTTP_PARSE_HEADER_ERROR 14
|
||||
#define NGX_HTTP_PARSE_INVALID_HEADER 14
|
||||
#define NGX_HTTP_PARSE_TOO_LONG_HEADER 15
|
||||
#define NGX_HTTP_PARSE_NO_HOST_HEADER 16
|
||||
#define NGX_HTTP_PARSE_INVALID_CL_HEADER 17
|
||||
#define NGX_HTTP_PARSE_HEADER_ERROR 14
|
||||
#define NGX_HTTP_PARSE_INVALID_HEADER 14
|
||||
#define NGX_HTTP_PARSE_TOO_LONG_HEADER 15
|
||||
#define NGX_HTTP_PARSE_NO_HOST_HEADER 16
|
||||
#define NGX_HTTP_PARSE_INVALID_CL_HEADER 17
|
||||
|
||||
|
||||
#define NGX_HTTP_OK 200
|
||||
@ -80,8 +80,8 @@ typedef enum {
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_str_t name;
|
||||
int offset;
|
||||
ngx_str_t name;
|
||||
ngx_uint_t offset;
|
||||
} ngx_http_header_t;
|
||||
|
||||
|
||||
@ -124,14 +124,14 @@ typedef struct {
|
||||
ngx_file_t temp_file;
|
||||
ngx_path_t *temp_path;
|
||||
off_t offset;
|
||||
char *header_in_pos;
|
||||
u_char *header_in_pos;
|
||||
} ngx_http_request_body_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
off_t start;
|
||||
off_t end;
|
||||
ngx_str_t content_range;
|
||||
off_t start;
|
||||
off_t end;
|
||||
ngx_str_t content_range;
|
||||
} ngx_http_range_t;
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ typedef struct {
|
||||
ngx_array_t ranges;
|
||||
|
||||
off_t content_length_n;
|
||||
char *etag;
|
||||
u_char *etag;
|
||||
time_t date_time;
|
||||
time_t last_modified_time;
|
||||
} ngx_http_headers_out_t;
|
||||
@ -165,7 +165,7 @@ struct ngx_http_cleanup_s {
|
||||
union {
|
||||
struct {
|
||||
ngx_fd_t fd;
|
||||
char *name;
|
||||
u_char *name;
|
||||
} file;
|
||||
|
||||
struct {
|
||||
@ -202,10 +202,10 @@ struct ngx_http_request_s {
|
||||
|
||||
time_t lingering_time;
|
||||
|
||||
int method;
|
||||
int http_version;
|
||||
int http_major;
|
||||
int http_minor;
|
||||
ngx_uint_t method;
|
||||
ngx_uint_t http_version;
|
||||
ngx_uint_t http_major;
|
||||
ngx_uint_t http_minor;
|
||||
|
||||
ngx_str_t request_line;
|
||||
ngx_str_t uri;
|
||||
@ -215,20 +215,20 @@ struct ngx_http_request_s {
|
||||
|
||||
ngx_http_request_t *main;
|
||||
|
||||
u_int in_addr;
|
||||
int port;
|
||||
uint32_t in_addr;
|
||||
ngx_uint_t port;
|
||||
ngx_str_t *port_name; /* ":80" */
|
||||
ngx_str_t *server_name;
|
||||
ngx_array_t *virtual_names;
|
||||
|
||||
int phase;
|
||||
int phase_handler;
|
||||
ngx_uint_t phase;
|
||||
ngx_int_t phase_handler;
|
||||
ngx_http_handler_pt content_handler;
|
||||
|
||||
ngx_temp_file_t *temp_file;
|
||||
ngx_chain_t *request_hunks;
|
||||
ngx_hunk_t *request_body_hunk;
|
||||
int request_body_len;
|
||||
size_t request_body_len;
|
||||
void (*request_body_handler) (void *data);
|
||||
void *data;
|
||||
|
||||
@ -236,9 +236,9 @@ struct ngx_http_request_s {
|
||||
|
||||
size_t header_size;
|
||||
|
||||
char *discarded_buffer;
|
||||
u_char *discarded_buffer;
|
||||
void **err_ctx;
|
||||
int err_status;
|
||||
ngx_uint_t err_status;
|
||||
|
||||
unsigned http_state:4;
|
||||
|
||||
@ -268,21 +268,21 @@ struct ngx_http_request_s {
|
||||
unsigned closed:1;
|
||||
#endif
|
||||
|
||||
/* TODO: use filter or bits ???? */
|
||||
int filter;
|
||||
/* TODO: use the filter flags or the separate bits ???? */
|
||||
u_int filter;
|
||||
|
||||
/* used to parse HTTP headers */
|
||||
int state;
|
||||
char *uri_start;
|
||||
char *uri_end;
|
||||
char *uri_ext;
|
||||
char *args_start;
|
||||
char *request_start;
|
||||
char *request_end;
|
||||
char *header_name_start;
|
||||
char *header_name_end;
|
||||
char *header_start;
|
||||
char *header_end;
|
||||
ngx_int_t state;
|
||||
u_char *uri_start;
|
||||
u_char *uri_end;
|
||||
u_char *uri_ext;
|
||||
u_char *args_start;
|
||||
u_char *request_start;
|
||||
u_char *request_end;
|
||||
u_char *header_name_start;
|
||||
u_char *header_name_end;
|
||||
u_char *header_start;
|
||||
u_char *header_end;
|
||||
};
|
||||
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
static void ngx_http_read_client_request_body_handler(ngx_event_t *rev);
|
||||
|
||||
|
||||
int ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
int request_buffer_size)
|
||||
ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
size_t request_buffer_size)
|
||||
{
|
||||
ssize_t size;
|
||||
ngx_hunk_t *h;
|
||||
@ -73,7 +73,8 @@ int ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
|
||||
static void ngx_http_read_client_request_body_handler(ngx_event_t *rev)
|
||||
{
|
||||
ssize_t n, size;
|
||||
size_t size;
|
||||
ssize_t n;
|
||||
ngx_hunk_t *h;
|
||||
ngx_connection_t *c;
|
||||
ngx_http_request_t *r;
|
||||
|
@ -5,14 +5,14 @@
|
||||
#include <nginx.h>
|
||||
|
||||
|
||||
static char error_tail[] =
|
||||
static u_char error_tail[] =
|
||||
"<hr><center>" NGINX_VER "</center>" CRLF
|
||||
"</body>" CRLF
|
||||
"</html>" CRLF
|
||||
;
|
||||
|
||||
|
||||
static char msie_stub[] =
|
||||
static u_char msie_stub[] =
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
@ -176,7 +176,8 @@ static ngx_str_t error_pages[] = {
|
||||
|
||||
int ngx_http_special_response_handler(ngx_http_request_t *r, int error)
|
||||
{
|
||||
int err, rc, i;
|
||||
ngx_int_t rc;
|
||||
ngx_uint_t err, i;
|
||||
ngx_hunk_t *h;
|
||||
ngx_chain_t *out, **ll, *cl;
|
||||
ngx_http_err_page_t *err_page;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
ssize_t postpone_output;
|
||||
size_t postpone_output;
|
||||
} ngx_http_write_filter_conf_t;
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ static void *ngx_http_write_filter_create_conf(ngx_conf_t *cf)
|
||||
ngx_palloc(cf->pool, sizeof(ngx_http_write_filter_conf_t)),
|
||||
NULL);
|
||||
|
||||
conf->postpone_output = NGX_CONF_UNSET;
|
||||
conf->postpone_output = NGX_CONF_UNSET_SIZE;
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
||||
ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
|
||||
{
|
||||
ssize_t n;
|
||||
|
||||
@ -48,7 +48,7 @@ ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
}
|
||||
|
||||
|
||||
ssize_t ngx_write_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
|
||||
{
|
||||
ssize_t n;
|
||||
|
||||
@ -104,7 +104,7 @@ ssize_t ngx_write_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl,
|
||||
off_t offset, ngx_pool_t *pool)
|
||||
{
|
||||
char *prev;
|
||||
u_char *prev;
|
||||
size_t size;
|
||||
ssize_t n;
|
||||
struct iovec *iov;
|
||||
@ -133,7 +133,7 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl,
|
||||
|
||||
} else {
|
||||
ngx_test_null(iov, ngx_push_array(&io), NGX_ERROR);
|
||||
iov->iov_base = cl->hunk->pos;
|
||||
iov->iov_base = (void *) cl->hunk->pos;
|
||||
iov->iov_len = cl->hunk->last - cl->hunk->pos;
|
||||
}
|
||||
|
||||
@ -146,7 +146,8 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl,
|
||||
|
||||
if (io.nelts == 1) {
|
||||
iov = io.elts;
|
||||
return ngx_write_file(file, iov[0].iov_base, iov[0].iov_len, offset);
|
||||
return ngx_write_file(file, (u_char *) iov[0].iov_base, iov[0].iov_len,
|
||||
offset);
|
||||
}
|
||||
|
||||
if (file->sys_offset != offset) {
|
||||
@ -180,7 +181,7 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl,
|
||||
|
||||
int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
|
||||
{
|
||||
dir->dir = opendir(name->data);
|
||||
dir->dir = opendir((const char *) name->data);
|
||||
|
||||
if (dir->dir == NULL) {
|
||||
return NGX_ERROR;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
#define ngx_open_file(name, access, create) \
|
||||
open(name, access|create, 0644)
|
||||
open((const char *) name, access|create, 0644)
|
||||
#define ngx_open_file_n "open()"
|
||||
|
||||
#define NGX_FILE_RDONLY O_RDONLY
|
||||
@ -26,20 +26,21 @@
|
||||
#define ngx_close_file_n "close()"
|
||||
|
||||
|
||||
#define ngx_delete_file unlink
|
||||
#define ngx_delete_file(name) unlink((const char *) name)
|
||||
#define ngx_delete_file_n "unlink()"
|
||||
|
||||
|
||||
#define ngx_open_tempfile(name, persistent) \
|
||||
open(name, O_CREAT|O_EXCL|O_RDWR, 0600)
|
||||
open((const char *) name, O_CREAT|O_EXCL|O_RDWR, 0600)
|
||||
#define ngx_open_tempfile_n "open()"
|
||||
|
||||
|
||||
ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset);
|
||||
ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset);
|
||||
#define ngx_read_file_n "read()"
|
||||
|
||||
|
||||
ssize_t ngx_write_file(ngx_file_t *file, char *buf, size_t size, off_t offset);
|
||||
ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size,
|
||||
off_t offset);
|
||||
|
||||
ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce,
|
||||
off_t offset, ngx_pool_t *pool);
|
||||
@ -49,7 +50,7 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce,
|
||||
#define ngx_rename_file_n "rename"
|
||||
|
||||
|
||||
#define ngx_file_info(file, sb) stat(file, sb)
|
||||
#define ngx_file_info(file, sb) stat((const char *) file, sb)
|
||||
#define ngx_file_info_n "stat()"
|
||||
|
||||
#define ngx_fd_info(fd, sb) fstat(fd, sb)
|
||||
@ -78,11 +79,11 @@ int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
|
||||
#define ngx_read_dir_n "readdir()"
|
||||
|
||||
|
||||
#define ngx_create_dir(name) mkdir(name, 0700)
|
||||
#define ngx_create_dir(name) mkdir((const char *) name, 0700)
|
||||
#define ngx_create_dir_n "mkdir()"
|
||||
|
||||
|
||||
#define ngx_delete_dir rmdir
|
||||
#define ngx_delete_dir(name) rmdir((const char *) name)
|
||||
#define ngx_delete_dir_n "rmdir()"
|
||||
|
||||
|
||||
@ -92,7 +93,7 @@ int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
|
||||
#else
|
||||
#define ngx_de_namelen(dir) ngx_strlen((dir)->de->d_name)
|
||||
#endif
|
||||
#define ngx_de_info(name, dir) stat(name, &(dir)->info)
|
||||
#define ngx_de_info(name, dir) stat((const char *) name, &(dir)->info)
|
||||
#define ngx_de_info_n "stat()"
|
||||
#define ngx_de_is_dir(dir) (S_ISDIR((dir)->info.st_mode))
|
||||
#define ngx_de_is_file(dir) (S_ISREG((dir)->info.st_mode))
|
||||
|
@ -14,8 +14,8 @@
|
||||
* it never sends a header with a part of the file in one packet until
|
||||
* FreeBSD 5.2-STABLE. Besides over the fast ethernet connection sendfile()
|
||||
* can send the partially filled packets, i.e. the 8 file pages can be sent
|
||||
* as 11 full 1460-bytes packets, then one incomplete 324-bytes packet, and
|
||||
* then again 11 full 1460-bytes packets.
|
||||
* as the 11 full 1460-bytes packets, then one incomplete 324-bytes packet,
|
||||
* and then again the 11 full 1460-bytes packets.
|
||||
*
|
||||
* So we use the TCP_NOPUSH option (similar to Linux's TCP_CORK)
|
||||
* to postpone the sending - it not only sends a header and the first part
|
||||
@ -31,7 +31,7 @@
|
||||
ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
{
|
||||
int rc;
|
||||
char *prev;
|
||||
u_char *prev;
|
||||
off_t sent, fprev;
|
||||
size_t hsize, fsize;
|
||||
ssize_t size;
|
||||
@ -93,7 +93,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
|
||||
} else {
|
||||
ngx_test_null(iov, ngx_push_array(&header), NGX_CHAIN_ERROR);
|
||||
iov->iov_base = cl->hunk->pos;
|
||||
iov->iov_base = (void *) cl->hunk->pos;
|
||||
iov->iov_len = cl->hunk->last - cl->hunk->pos;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
} else {
|
||||
ngx_test_null(iov, ngx_push_array(&trailer),
|
||||
NGX_CHAIN_ERROR);
|
||||
iov->iov_base = cl->hunk->pos;
|
||||
iov->iov_base = (void *) cl->hunk->pos;
|
||||
iov->iov_len = cl->hunk->last - cl->hunk->pos;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
{
|
||||
int rc;
|
||||
char *prev;
|
||||
u_char *prev;
|
||||
off_t fprev;
|
||||
size_t size, fsize, sent;
|
||||
ngx_int_t eintr;
|
||||
@ -71,7 +71,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
|
||||
} else {
|
||||
ngx_test_null(iov, ngx_push_array(&header), NGX_CHAIN_ERROR);
|
||||
iov->iov_base = cl->hunk->pos;
|
||||
iov->iov_base = (void *) cl->hunk->pos;
|
||||
iov->iov_len = cl->hunk->last - cl->hunk->pos;
|
||||
}
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
ssize_t (*recv)(ngx_connection_t *c, char *buf, size_t size);
|
||||
ssize_t (*recv)(ngx_connection_t *c, u_char *buf, size_t size);
|
||||
ssize_t (*recv_chain)(ngx_connection_t *c, ngx_chain_t *in);
|
||||
ssize_t (*send)(ngx_connection_t *c, char *buf, size_t size);
|
||||
ssize_t (*send)(ngx_connection_t *c, u_char *buf, size_t size);
|
||||
ngx_chain_t *(*send_chain)(ngx_connection_t *c, ngx_chain_t *in);
|
||||
int flags;
|
||||
} ngx_os_io_t;
|
||||
@ -39,7 +39,7 @@ int ngx_posix_init(ngx_log_t *log);
|
||||
int ngx_posix_post_conf_init(ngx_log_t *log);
|
||||
|
||||
|
||||
ssize_t ngx_unix_recv(ngx_connection_t *c, char *buf, size_t size);
|
||||
ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size);
|
||||
ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *entry);
|
||||
ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in);
|
||||
|
||||
|
@ -333,7 +333,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
|
||||
static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
{
|
||||
char *name;
|
||||
u_char *name;
|
||||
|
||||
if (ngx_inherited && getppid() > 1) {
|
||||
name = ctx->pid.name.data;
|
||||
@ -355,7 +355,7 @@ static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
|
||||
{
|
||||
sigset_t set;
|
||||
ngx_int_t i;
|
||||
ngx_uint_t i;
|
||||
ngx_listening_t *ls;
|
||||
ngx_core_conf_t *ccf;
|
||||
#if (NGX_THREADS)
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
typedef struct {
|
||||
ngx_file_t pid;
|
||||
char *name;
|
||||
u_char *name;
|
||||
int argc;
|
||||
char *const *argv;
|
||||
} ngx_master_ctx_t;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
|
||||
{
|
||||
char *prev;
|
||||
u_char *prev;
|
||||
ssize_t n, size;
|
||||
struct iovec *iov;
|
||||
ngx_err_t err;
|
||||
@ -58,7 +58,7 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
|
||||
|
||||
} else {
|
||||
ngx_test_null(iov, ngx_push_array(&io), NGX_ERROR);
|
||||
iov->iov_base = chain->hunk->last;
|
||||
iov->iov_base = (void *) chain->hunk->last;
|
||||
iov->iov_len = chain->hunk->end - chain->hunk->last;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#if (HAVE_KQUEUE)
|
||||
|
||||
ssize_t ngx_unix_recv(ngx_connection_t *c, char *buf, size_t size)
|
||||
ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
||||
{
|
||||
ssize_t n;
|
||||
ngx_err_t err;
|
||||
|
@ -12,7 +12,7 @@
|
||||
ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
{
|
||||
int fd;
|
||||
char *prev;
|
||||
u_char *prev;
|
||||
off_t fprev;
|
||||
size_t sent, size;
|
||||
ssize_t n;
|
||||
|
@ -25,6 +25,15 @@ typedef struct tm ngx_tm_t;
|
||||
#define ngx_tm_zone tm_zone
|
||||
#endif
|
||||
|
||||
#define ngx_tm_sec_t int
|
||||
#define ngx_tm_min_t int
|
||||
#define ngx_tm_hour_t int
|
||||
#define ngx_tm_mday_t int
|
||||
#define ngx_tm_mon_t int
|
||||
#define ngx_tm_year_t int
|
||||
#define ngx_tm_wday_t int
|
||||
|
||||
|
||||
|
||||
void ngx_localtime(ngx_tm_t *tm);
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
{
|
||||
char *prev;
|
||||
u_char *prev;
|
||||
ssize_t n, size;
|
||||
off_t sent;
|
||||
struct iovec *iov;
|
||||
@ -51,7 +51,7 @@ ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
|
||||
} else {
|
||||
ngx_test_null(iov, ngx_push_array(&io), NGX_CHAIN_ERROR);
|
||||
iov->iov_base = cl->hunk->pos;
|
||||
iov->iov_base = (void *) cl->hunk->pos;
|
||||
iov->iov_len = cl->hunk->last - cl->hunk->pos;
|
||||
prev = cl->hunk->last;
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
||||
ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
|
||||
{
|
||||
long high_offset;
|
||||
DWORD n;
|
||||
u_long n;
|
||||
ngx_err_t err;
|
||||
OVERLAPPED ovlp, *povlp;
|
||||
|
||||
@ -20,8 +20,9 @@ ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
if (file->offset != offset) {
|
||||
|
||||
/*
|
||||
* the maximum file size on FAT16 is 2G, but on FAT32 it's 4G so we
|
||||
* need to use high_offset because a single offset is signed value
|
||||
* the maximum file size on FAT16 is 2G, but on FAT32
|
||||
* the size is 4G so we need to use high_offset
|
||||
* because a single offset is signed value
|
||||
*/
|
||||
|
||||
high_offset = (long) (offset >> 32);
|
||||
@ -47,8 +48,8 @@ ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
} else {
|
||||
ovlp.Internal = 0;
|
||||
ovlp.InternalHigh = 0;
|
||||
ovlp.Offset = (DWORD) offset;
|
||||
ovlp.OffsetHigh = (DWORD) (offset >> 32);
|
||||
ovlp.Offset = (u_long) offset;
|
||||
ovlp.OffsetHigh = (u_long) (offset >> 32);
|
||||
ovlp.hEvent = NULL;
|
||||
|
||||
povlp = &ovlp;
|
||||
@ -65,10 +66,10 @@ ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
}
|
||||
|
||||
|
||||
ssize_t ngx_write_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
|
||||
{
|
||||
long high_offset;
|
||||
DWORD n;
|
||||
u_long n;
|
||||
ngx_err_t err;
|
||||
OVERLAPPED ovlp, *povlp;
|
||||
|
||||
@ -82,8 +83,9 @@ ssize_t ngx_write_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
if (file->offset != offset) {
|
||||
|
||||
/*
|
||||
* the maximum file size on FAT16 is 2G, but on FAT32 it's 4G so we
|
||||
* need to use high_offset because a single offset is signed value
|
||||
* the maximum file size on FAT16 is 2G, but on FAT32
|
||||
* the size is 4G so we need to use high_offset
|
||||
* because a single offset is signed value
|
||||
*/
|
||||
|
||||
high_offset = (long) (offset >> 32);
|
||||
@ -109,8 +111,8 @@ ssize_t ngx_write_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
|
||||
} else {
|
||||
ovlp.Internal = 0;
|
||||
ovlp.InternalHigh = 0;
|
||||
ovlp.Offset = (DWORD) offset;
|
||||
ovlp.OffsetHigh = (DWORD) (offset >> 32);
|
||||
ovlp.Offset = (u_long) offset;
|
||||
ovlp.OffsetHigh = (u_long) (offset >> 32);
|
||||
ovlp.hEvent = NULL;
|
||||
|
||||
povlp = &ovlp;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
#define ngx_open_file(name, access, create) \
|
||||
CreateFile(name, access, \
|
||||
CreateFile((const char *) name, access, \
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \
|
||||
NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL)
|
||||
/*
|
||||
@ -43,7 +43,7 @@ int ngx_file_append_mode(ngx_fd_t fd);
|
||||
|
||||
|
||||
#define ngx_open_tempfile(name, persistent) \
|
||||
CreateFile(name, \
|
||||
CreateFile((const char *) name, \
|
||||
GENERIC_READ|GENERIC_WRITE, \
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \
|
||||
NULL, \
|
||||
@ -139,10 +139,11 @@ int ngx_read_dir(ngx_dir_t *dir);
|
||||
|
||||
|
||||
|
||||
ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset);
|
||||
ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset);
|
||||
#define ngx_read_file_n "ReadFile()"
|
||||
|
||||
ssize_t ngx_write_file(ngx_file_t *file, char *buf, size_t size, off_t offset);
|
||||
ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size,
|
||||
off_t offset);
|
||||
|
||||
ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce,
|
||||
off_t offset, ngx_pool_t *pool);
|
||||
|
@ -13,8 +13,14 @@ ngx_int_t ngx_inherited;
|
||||
|
||||
sig_atomic_t ngx_reap;
|
||||
sig_atomic_t ngx_timer;
|
||||
|
||||
#endif
|
||||
|
||||
sig_atomic_t ngx_terminate;
|
||||
sig_atomic_t ngx_quit;
|
||||
|
||||
#if 0
|
||||
|
||||
sig_atomic_t ngx_noaccept;
|
||||
sig_atomic_t ngx_reconfigure;
|
||||
sig_atomic_t ngx_reopen;
|
||||
@ -23,6 +29,7 @@ sig_atomic_t ngx_change_binary;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
{
|
||||
ngx_int_t i;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
typedef struct {
|
||||
ngx_file_t pid;
|
||||
char *name;
|
||||
u_char *name;
|
||||
int argc;
|
||||
char *const *argv;
|
||||
} ngx_master_ctx_t;
|
||||
|
@ -23,6 +23,15 @@ typedef FILETIME ngx_mtime_t;
|
||||
#define ngx_tm_year wYear
|
||||
#define ngx_tm_wday wDayOfWeek
|
||||
|
||||
#define ngx_tm_sec_t u_short
|
||||
#define ngx_tm_min_t u_short
|
||||
#define ngx_tm_hour_t u_short
|
||||
#define ngx_tm_mday_t u_short
|
||||
#define ngx_tm_mon_t u_short
|
||||
#define ngx_tm_year_t u_short
|
||||
#define ngx_tm_wday_t u_short
|
||||
|
||||
|
||||
#define ngx_msleep Sleep
|
||||
#define ngx_localtime GetLocalTime
|
||||
|
||||
|
@ -27,13 +27,17 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:4201)
|
||||
|
||||
/* disable some "-W4" level warnings */
|
||||
|
||||
#pragma warning(disable:4054)
|
||||
#pragma warning(disable:4055)
|
||||
/* unreferenced formal parameter */
|
||||
#pragma warning(disable:4100)
|
||||
|
||||
/* STUB */
|
||||
#if 0
|
||||
#pragma warning(disable:4127)
|
||||
#endif
|
||||
#pragma warning(disable:4214)
|
||||
#pragma warning(disable:4702)
|
||||
#pragma warning(disable:4706)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user