nginx-0.0.1-2003-12-08-23:48:12 import
diff --git a/src/core/ngx_array.h b/src/core/ngx_array.h
index d6443d6..9cef9f3 100644
--- a/src/core/ngx_array.h
+++ b/src/core/ngx_array.h
@@ -6,13 +6,13 @@
#include <ngx_core.h>
-typedef struct {
+struct ngx_array_s {
void *elts;
int nelts;
size_t size;
int nalloc;
ngx_pool_t *pool;
-} ngx_array_t;
+};
ngx_array_t *ngx_create_array(ngx_pool_t *p, int n, size_t size);
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
index 97819b6..b2c3d55 100644
--- a/src/core/ngx_core.h
+++ b/src/core/ngx_core.h
@@ -6,6 +6,7 @@
typedef struct ngx_conf_s ngx_conf_t;
typedef struct ngx_cycle_s ngx_cycle_t;
typedef struct ngx_log_s ngx_log_t;
+typedef struct ngx_array_s ngx_array_t;
typedef struct ngx_open_file_s ngx_open_file_t;
typedef struct ngx_command_s ngx_command_t;
diff --git a/src/core/ngx_crc.h b/src/core/ngx_crc.h
index df64889..c6234c3 100644
--- a/src/core/ngx_crc.h
+++ b/src/core/ngx_crc.h
@@ -7,7 +7,7 @@
ngx_inline static uint32_t ngx_crc(char *data, size_t len)
{
uint32_t sum;
-
+
for (sum = 0; len; len--) {
/*
* gcc 2.95.2 x86 and icc 7.1.006 compile that operator
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index 4cbd8fc..3b29bec 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -14,7 +14,7 @@
if (tf->file.fd == NGX_INVALID_FILE) {
rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
tf->persistent);
-
+
if (rc == NGX_ERROR || rc == NGX_AGAIN) {
return rc;
}
diff --git a/src/core/ngx_garbage_collector.h b/src/core/ngx_garbage_collector.h
index 1164484..5bc8471 100644
--- a/src/core/ngx_garbage_collector.h
+++ b/src/core/ngx_garbage_collector.h
@@ -17,7 +17,7 @@
};
-int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
+int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
ngx_dir_t *dir);
diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c
index 2785c39..d6aa0a4 100644
--- a/src/core/ngx_hunk.c
+++ b/src/core/ngx_hunk.c
@@ -108,7 +108,7 @@
if (te->next == NULL) {
te->next = *out;
break;
- }
+ }
}
}
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index 3f578fc..b615c7e 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -22,7 +22,7 @@
static ngx_command_t ngx_errlog_commands[] = {
{ngx_string("error_log"),
- NGX_MAIN_CONF|NGX_CONF_TAKE12,
+ NGX_MAIN_CONF|NGX_CONF_1MORE,
ngx_set_error_log,
0,
0,
@@ -51,6 +51,11 @@
"warn", "notice", "info", "debug"
};
+static const char *debug_levels[] = {
+ "debug", "debug_alloc", "debug_event", "debug_http"
+};
+
+
#if (HAVE_VARIADIC_MACROS)
void ngx_log_error_core(int level, ngx_log_t *log, ngx_err_t err,
const char *fmt, ...)
@@ -262,9 +267,18 @@
}
-ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_str_t *name)
+ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args)
{
ngx_log_t *log;
+ ngx_str_t *value, *name;
+
+ if (args) {
+ value = args->elts;
+ name = &value[1];
+
+ } else {
+ name = NULL;
+ }
ngx_test_null(log, ngx_pcalloc(cycle->pool, sizeof(ngx_log_t)), NULL);
ngx_test_null(log->file, ngx_conf_open_file(cycle, name), NULL);
@@ -279,7 +293,7 @@
static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
- ngx_int_t i;
+ ngx_int_t i, n, d;
ngx_str_t *value;
value = cf->args->elts;
@@ -291,16 +305,43 @@
cf->cycle->log->file->name = value[1];
}
- if (cf->args->nelts == 3) {
- for (i = 1; i <= /* STUB ??? */ NGX_LOG_DEBUG; i++) {
- if (ngx_strcmp(value[2].data, err_levels[i]) == 0) {
- cf->cycle->log->log_level = i;
- break;
+ for (i = 2; i < cf->args->nelts; i++) {
+
+ for (n = 1; n < NGX_LOG_DEBUG; n++) {
+ if (ngx_strcmp(value[i].data, err_levels[n]) == 0) {
+
+ if (cf->cycle->log->log_level != 0) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid log level \"%s\"",
+ value[i].data);
+ return NGX_CONF_ERROR;
+ }
+
+ cf->cycle->log->log_level = n;
+ continue;
}
}
- if (i > NGX_LOG_DEBUG) {
+
+ d = NGX_LOG_DEBUG_FIRST;
+ for (n = 0; n < /* STUB */ 3; n++) {
+ if (ngx_strcmp(value[i].data, debug_levels[n]) == 0) {
+ if (cf->cycle->log->log_level & ~NGX_LOG_DEBUG_ALL) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid log level \"%s\"",
+ value[i].data);
+ return NGX_CONF_ERROR;
+ }
+
+ cf->cycle->log->log_level |= d;
+ d <<= 1;
+ continue;
+ }
+ }
+
+
+ if (cf->cycle->log->log_level == 0) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid log level \"%s\"", value[2].data);
+ "invalid log level \"%s\"", value[i].data);
return NGX_CONF_ERROR;
}
}
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index 59ca1f9..71da9d5 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -16,7 +16,13 @@
#define NGX_LOG_INFO 7
#define NGX_LOG_DEBUG 8
-#define NGX_LOG_DEBUG_HTTP 0x80
+#define NGX_LOG_DEBUG_ALLOC 0x10
+#define NGX_LOG_DEBUG_EVENT 0x20
+#define NGX_LOG_DEBUG_HTTP 0x40
+
+#define NGX_LOG_DEBUG_FIRST NGX_LOG_DEBUG
+#define NGX_LOG_DEBUG_LAST NGX_LOG_DEBUG_HTTP
+#define NGX_LOG_DEBUG_ALL 0xfffffff8
/*
@@ -212,7 +218,7 @@
#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_create_errlog(ngx_cycle_t *cycle, ngx_str_t *name);
+ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args);
extern ngx_module_t ngx_errlog_module;
diff --git a/src/core/ngx_regex.c b/src/core/ngx_regex.c
index 377f998..a5d47d5 100644
--- a/src/core/ngx_regex.c
+++ b/src/core/ngx_regex.c
@@ -30,7 +30,7 @@
re = pcre_compile(pattern->data, (int) options, &errstr, &erroff, NULL);
if (re == NULL) {
- if ((size_t) erroff == pattern->len) {
+ if ((size_t) erroff == pattern->len) {
ngx_snprintf(err->data, err->len - 1,
"pcre_compile() failed: %s in \"%s\"",
errstr, pattern->data);
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index a1ffdce..bc0cb16 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -116,11 +116,11 @@
t %= 86400;
hour = t / 3600;
t %= 3600;
- min = t / 60;
+ min = t / 60;
sec = t % 60;
/* the algorithm based on Gauss's formula */
-
+
days = days - (31 + 28) + 719527;
year = days * 400 / (365 * 400 + 100 - 4 + 1);