nginx-0.0.11-2004-09-23-10:32:00 import

This commit is contained in:
Igor Sysoev 2004-09-23 06:32:00 +00:00
parent 85080d09ad
commit f7abd72716
8 changed files with 407 additions and 444 deletions

View File

@ -21,6 +21,7 @@ ngx_buf_t *ngx_create_temp_buf(ngx_pool_t *pool, size_t size)
b->temporary = 1;
/*
b->file_pos = 0;
b->file_last = 0;
@ -28,7 +29,8 @@ ngx_buf_t *ngx_create_temp_buf(ngx_pool_t *pool, size_t size)
b->shadow = NULL;
b->tag = 0;
*/
*/
return b;
}

View File

@ -44,8 +44,9 @@ void ngx_destroy_pool(ngx_pool_t *pool)
*/
for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
"free: " PTR_FMT, p);
ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
"free: " PTR_FMT ", unused: " SIZE_T_FMT,
p, p->end - p->last);
if (n == NULL) {
break;
@ -71,7 +72,7 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size)
ngx_pool_large_t *large, *last;
if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL
&& size <= (size_t) (pool->end - (char *) pool))
&& size <= (size_t) (pool->end - (char *) pool) - sizeof(ngx_pool_t))
{
for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
m = ngx_align(p->last);
@ -106,7 +107,7 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size)
last = NULL;
if (pool->large) {
for (last = pool->large; /* void */; last = last->next) {
for (last = pool->large; /* void */ ; last = last->next) {
if (last->alloc == NULL) {
large = last;
last = NULL;
@ -150,7 +151,7 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size)
}
void ngx_pfree(ngx_pool_t *pool, void *p)
ngx_int_t ngx_pfree(ngx_pool_t *pool, void *p)
{
ngx_pool_large_t *l;
@ -160,8 +161,12 @@ void ngx_pfree(ngx_pool_t *pool, void *p)
"free: " PTR_FMT, l->alloc);
free(l->alloc);
l->alloc = NULL;
return NGX_OK;
}
}
return NGX_DECLINED;
}

View File

@ -43,7 +43,7 @@ void ngx_destroy_pool(ngx_pool_t *pool);
void *ngx_palloc(ngx_pool_t *pool, size_t size);
void *ngx_pcalloc(ngx_pool_t *pool, size_t size);
void ngx_pfree(ngx_pool_t *pool, void *p);
ngx_int_t ngx_pfree(ngx_pool_t *pool, void *p);
#endif /* _NGX_PALLOC_H_INCLUDED_ */

View File

@ -96,18 +96,11 @@ static ngx_command_t ngx_http_core_commands[] = {
offsetof(ngx_http_core_srv_conf_t, client_header_buffer_size),
NULL },
{ ngx_string("client_large_buffers"),
{ ngx_string("large_client_header_buffers"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE2,
ngx_conf_set_bufs_slot,
NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_core_srv_conf_t, client_large_buffers),
NULL },
{ ngx_string("large_client_header"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_core_srv_conf_t, large_client_header),
offsetof(ngx_http_core_srv_conf_t, large_client_header_buffers),
NULL },
{ ngx_string("restrict_host_names"),
@ -241,6 +234,13 @@ static ngx_command_t ngx_http_core_commands[] = {
0,
NULL },
{ ngx_string("keepalive_buffers"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_core_loc_conf_t, keepalive_buffers),
NULL },
{ ngx_string("lingering_time"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_msec_slot,
@ -1275,7 +1275,6 @@ static void *ngx_http_core_create_srv_conf(ngx_conf_t *cf)
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;
cscf->restrict_host_names = NGX_CONF_UNSET_UINT;
return cscf;
@ -1333,7 +1332,7 @@ 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, 16384);
prev->connection_pool_size, 2048);
ngx_conf_merge_msec_value(conf->post_accept_timeout,
prev->post_accept_timeout, 30000);
ngx_conf_merge_size_value(conf->request_pool_size,
@ -1342,10 +1341,17 @@ static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf,
prev->client_header_timeout, 60000);
ngx_conf_merge_size_value(conf->client_header_buffer_size,
prev->client_header_buffer_size, 1024);
ngx_conf_merge_bufs_value(conf->client_large_buffers,
prev->client_large_buffers, 4, ngx_pagesize);
ngx_conf_merge_value(conf->large_client_header,
prev->large_client_header, 1);
ngx_conf_merge_bufs_value(conf->large_client_header_buffers,
prev->large_client_header_buffers,
4, ngx_pagesize);
if (conf->large_client_header_buffers.size < conf->connection_pool_size) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"the \"large_client_header_buffers\" size must be "
"equal to or bigger than \"connection_pool_size\"");
return NGX_CONF_ERROR;
}
ngx_conf_merge_unsigned_value(conf->restrict_host_names,
prev->restrict_host_names, 0);
@ -1387,9 +1393,9 @@ static void *ngx_http_core_create_loc_conf(ngx_conf_t *cf)
lcf->send_lowat = NGX_CONF_UNSET_SIZE;
lcf->postpone_output = NGX_CONF_UNSET_SIZE;
lcf->limit_rate = NGX_CONF_UNSET_SIZE;
lcf->discarded_buffer_size = NGX_CONF_UNSET_SIZE;
lcf->keepalive_timeout = NGX_CONF_UNSET_MSEC;
lcf->keepalive_header = NGX_CONF_UNSET;
lcf->keepalive_buffers = NGX_CONF_UNSET;
lcf->lingering_time = NGX_CONF_UNSET_MSEC;
lcf->lingering_timeout = NGX_CONF_UNSET_MSEC;
lcf->reset_timedout_connection = NGX_CONF_UNSET;
@ -1474,12 +1480,11 @@ static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf,
ngx_conf_merge_size_value(conf->postpone_output, prev->postpone_output,
1460);
ngx_conf_merge_size_value(conf->limit_rate, prev->limit_rate, 0);
ngx_conf_merge_size_value(conf->discarded_buffer_size,
prev->discarded_buffer_size, 1500);
ngx_conf_merge_msec_value(conf->keepalive_timeout,
prev->keepalive_timeout, 75000);
ngx_conf_merge_sec_value(conf->keepalive_header,
prev->keepalive_header, 0);
ngx_conf_merge_value(conf->keepalive_buffers, prev->keepalive_buffers, 1);
ngx_conf_merge_msec_value(conf->lingering_time,
prev->lingering_time, 30000);
ngx_conf_merge_msec_value(conf->lingering_timeout,

View File

@ -66,14 +66,12 @@ typedef struct {
size_t request_pool_size;
size_t client_header_buffer_size;
ngx_bufs_t client_large_buffers;
ngx_bufs_t large_client_header_buffers;
ngx_msec_t post_accept_timeout;
ngx_msec_t client_header_timeout;
ngx_uint_t restrict_host_names;
ngx_flag_t large_client_header;
} ngx_http_core_srv_conf_t;
@ -153,7 +151,6 @@ struct ngx_http_core_loc_conf_s {
ngx_str_t default_type;
size_t client_max_body_size; /* client_max_body_size */
size_t discarded_buffer_size; /* discarded_buffer_size */
size_t client_body_buffer_size; /* client_body_buffer_size */
size_t send_lowat; /* send_lowat */
size_t postpone_output; /* postpone_output */
@ -162,10 +159,12 @@ struct ngx_http_core_loc_conf_s {
ngx_msec_t client_body_timeout; /* client_body_timeout */
ngx_msec_t send_timeout; /* send_timeout */
ngx_msec_t keepalive_timeout; /* keepalive_timeout */
time_t keepalive_header; /* keepalive_timeout */
ngx_msec_t lingering_time; /* lingering_time */
ngx_msec_t lingering_timeout; /* lingering_timeout */
time_t keepalive_header; /* keepalive_timeout */
ngx_flag_t keepalive_buffers; /* keepalive_buffers */
ngx_flag_t sendfile; /* sendfile */
ngx_flag_t tcp_nopush; /* tcp_nopush */
ngx_flag_t reset_timedout_connection; /* reset_timedout_connection */

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,10 @@
#define _NGX_HTTP_REQUEST_H_INCLUDED_
#define NGX_HTTP_DISCARD_BUFFER_SIZE 4096
#define NGX_HTTP_LINGERING_BUFFER_SIZE 4096
#define NGX_HTTP_VERSION_9 9
#define NGX_HTTP_VERSION_10 1000
#define NGX_HTTP_VERSION_11 1001

View File

@ -66,9 +66,9 @@ void ngx_debug_init()
#if (NGX_DEBUG && !NGX_NO_DEBUG_MALLOC)
#if __FreeBSD_version >= 500014
_malloc_options = "J";
_malloc_options = "JAV";
#else
malloc_options = "J";
malloc_options = "JAV";
#endif
#endif