Skip to content

Commit

Permalink
nginx-0.1.0-2004-10-01-19:53:53 import
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsysoev committed Oct 1, 2004
1 parent 4bed15b commit 8035fd2
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 29 deletions.
6 changes: 0 additions & 6 deletions auto/cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ case $CC in
# optimize for Pentium 4, gcc 3.x
CPU_OPT="-march=pentium4"
;;

sparc64)
# build 64-bit binary, sparcv9 only
CPU_OPT="-m64"
;;

esac

# STUB for batch builds
Expand Down
1 change: 1 addition & 0 deletions auto/install
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ install:
test -d $PREFIX || mkdir -p $PREFIX

test -d `dirname $SBIN_PATH` || mkdir -p `dirname $SBIN_PATH`
test ! -f $SBIN_PATH || mv $SBIN_PATH $SBIN_PATH.old
cp nginx $SBIN_PATH

test -d `dirname $CONF_PATH` || mkdir -p `dirname $CONF_PATH`
Expand Down
8 changes: 8 additions & 0 deletions auto/os/solaris
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ case $PLATFORM in

*:sun4u)
CFLAGS="$CFLAGS -mcpu=v9"

if [ ".$CPU" = ".sparc64" ]; then
CFLAGS="$CFLAGS -m64"
CPU_OPT="-m64"
CORE_LINK="$CORE_LINK -m64"

CC_TEST_FLAGS="$CC_TEST_FLAGS -mcpu=v9 -m64"
fi
;;

*)
Expand Down
10 changes: 9 additions & 1 deletion src/core/nginx.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int main(int argc, char *const *argv)

ngx_pid = ngx_getpid();

if (!(log = ngx_log_init_errlog())) {
if (!(log = ngx_log_init_stderr())) {
return 1;
}

Expand All @@ -144,6 +144,14 @@ int main(int argc, char *const *argv)
return 1;
}

if (ngx_test_config) {
log->log_level = NGX_LOG_INFO;
} else {
if (ngx_log_init_error_log() == NGX_ERROR) {
return 1;
}
}

if (ngx_os_init(log) == NGX_ERROR) {
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/ngx_cycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
NGX_FILE_RDWR,
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);

#if 1
#if 0
log->log_level = NGX_LOG_DEBUG_ALL;
#endif
ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
Expand Down
26 changes: 15 additions & 11 deletions src/core/ngx_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,8 @@ void ngx_assert_core(ngx_log_t *log, const char *fmt, ...)
#endif



ngx_log_t *ngx_log_init_errlog()
ngx_log_t *ngx_log_init_stderr()
{
ngx_fd_t fd;

#if (WIN32)

ngx_stderr.fd = GetStdHandle(STD_ERROR_HANDLE);
Expand All @@ -253,18 +250,25 @@ ngx_log_t *ngx_log_init_errlog()
#endif

ngx_log.file = &ngx_stderr;
ngx_log.log_level = NGX_LOG_ERR;

#ifdef NGX_ERROR_LOG_PATH
return &ngx_log;
}

ngx_log.log_level = NGX_LOG_ERR;

ngx_int_t ngx_log_init_error_log()
{
ngx_fd_t fd;

#ifdef NGX_ERROR_LOG_PATH

fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);

if (fd == NGX_INVALID_FILE) {
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
ngx_open_file_n " \"" NGX_ERROR_LOG_PATH "\" failed");
return NULL;
return NGX_ERROR;
}

#if (WIN32)
Expand All @@ -273,26 +277,26 @@ ngx_log_t *ngx_log_init_errlog()
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
ngx_file_append_mode_n " \"" NGX_ERROR_LOG_PATH
"\" failed");
return NULL;
return NGX_ERROR;
}

#else

if (dup2(fd, STDERR_FILENO) == NGX_ERROR) {
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
"dup2(STDERR) failed");
return NULL;
return NGX_ERROR;
}

#endif

#else
#else /* no NGX_ERROR_LOG_PATH */

ngx_log.log_level = NGX_LOG_INFO;

#endif

return &ngx_log;
return NGX_OK;
}


Expand Down
3 changes: 2 additions & 1 deletion src/core/ngx_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ void ngx_assert_core(ngx_log_t *log, const char *fmt, ...);
#define ngx_log_alloc_log(pool, log) ngx_palloc(pool, log, sizeof(ngx_log_t))
#define ngx_log_copy_log(new, old) ngx_memcpy(new, old, sizeof(ngx_log_t))

ngx_log_t *ngx_log_init_errlog();
ngx_log_t *ngx_log_init_stderr();
ngx_int_t ngx_log_init_error_log();
ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args);
char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log);

Expand Down
8 changes: 4 additions & 4 deletions src/http/modules/proxy/ngx_http_proxy_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,19 +919,19 @@ static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf,

ngx_conf_merge_msec_value(conf->connect_timeout,
prev->connect_timeout, 60000);
ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 30000);
ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 60000);

ngx_conf_merge_value(conf->preserve_host, prev->preserve_host, 0);
ngx_conf_merge_value(conf->set_x_real_ip, prev->set_x_real_ip, 0);
ngx_conf_merge_value(conf->add_x_forwarded_for,
prev->add_x_forwarded_for, 0);

ngx_conf_merge_msec_value(conf->read_timeout, prev->read_timeout, 30000);
ngx_conf_merge_msec_value(conf->read_timeout, prev->read_timeout, 60000);

ngx_conf_merge_size_value(conf->header_buffer_size,
prev->header_buffer_size, 4096);
prev->header_buffer_size, (size_t) ngx_pagesize);

ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 8, 4096);
ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 8, ngx_pagesize);

if (conf->bufs.num < 2) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
Expand Down
11 changes: 6 additions & 5 deletions src/http/ngx_http_core_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,11 +1330,11 @@ static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf,
}

ngx_conf_merge_size_value(conf->connection_pool_size,
prev->connection_pool_size, 2048);
prev->connection_pool_size, 256);
ngx_conf_merge_msec_value(conf->post_accept_timeout,
prev->post_accept_timeout, 30000);
prev->post_accept_timeout, 60000);
ngx_conf_merge_size_value(conf->request_pool_size,
prev->request_pool_size, 16384);
prev->request_pool_size, 4096);
ngx_conf_merge_msec_value(conf->client_header_timeout,
prev->client_header_timeout, 60000);
ngx_conf_merge_size_value(conf->client_header_buffer_size,
Expand Down Expand Up @@ -1469,9 +1469,10 @@ static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf,
prev->default_type, "text/plain");

ngx_conf_merge_size_value(conf->client_max_body_size,
prev->client_max_body_size, 10 * 1024 * 1024);
prev->client_max_body_size, 1 * 1024 * 1024);
ngx_conf_merge_size_value(conf->client_body_buffer_size,
prev->client_body_buffer_size, 8192);
prev->client_body_buffer_size,
(size_t) 2 * ngx_pagesize);
ngx_conf_merge_msec_value(conf->client_body_timeout,
prev->client_body_timeout, 60000);
ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
Expand Down
9 changes: 9 additions & 0 deletions src/os/unix/ngx_process_cycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,19 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
ngx_err_t err;
ngx_int_t n;
ngx_uint_t i;
struct timeval tv;
ngx_listening_t *ls;
ngx_core_conf_t *ccf;
ngx_connection_t *c;


ngx_gettimeofday(&tv);

ngx_start_msec = (ngx_epoch_msec_t) tv.tv_sec * 1000 + tv.tv_usec / 1000;
ngx_old_elapsed_msec = 0;
ngx_elapsed_msec = 0;


ngx_process = NGX_PROCESS_WORKER;

ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
Expand Down

0 comments on commit 8035fd2

Please sign in to comment.