nginx-0.0.1-2003-12-22-12:40:48 import
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index 9919fa8..2d7f2e9 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -207,6 +207,23 @@
#endif
#if (NGX_DEBUG)
+#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \
+ if (log->log_level & level) \
+ ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1, arg2, arg3, arg4)
+#else
+#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4)
+#endif
+
+#if (NGX_DEBUG)
+#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \
+ if (log->log_level & level) \
+ ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, \
+ arg1, arg2, arg3, arg4, arg5)
+#else
+#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5)
+#endif
+
+#if (NGX_DEBUG)
#define ngx_log_debug6(level, log, err, fmt, \
arg1, arg2, arg3, arg4, arg5, arg6) \
if (log->log_level & level) \
@@ -253,6 +270,22 @@
#endif
#if (NGX_DEBUG)
+#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \
+ if (log->log_level & level) \
+ ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4)
+#else
+#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4)
+#endif
+
+#if (NGX_DEBUG)
+#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \
+ if (log->log_level & level) \
+ ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5)
+#else
+#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5)
+#endif
+
+#if (NGX_DEBUG)
#define ngx_log_debug6(level, log, err, fmt, \
arg1, arg2, arg3, arg4, arg5, arg6) \
if (log->log_level & level) \
diff --git a/src/event/ngx_event_timer.h b/src/event/ngx_event_timer.h
index cb61f36..69de163 100644
--- a/src/event/ngx_event_timer.h
+++ b/src/event/ngx_event_timer.h
@@ -33,15 +33,24 @@
extern ngx_rbtree_t ngx_event_timer_sentinel;
+#define ngx_event_ident(p) ((ngx_connection_t *) (p))->fd
+
ngx_inline static void ngx_event_del_timer(ngx_event_t *ev)
{
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0,
- "event timer del: %d", ev->rbtree_key);
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
+ "event timer del: %d: %d",
+ ngx_event_ident(ev->data), ev->rbtree_key);
ngx_rbtree_delete(&ngx_event_timer_rbtree, &ngx_event_timer_sentinel,
(ngx_rbtree_t *) &ev->rbtree_key);
+#if (NGX_DEBUG)
+ ev->rbtree_left = NULL;
+ ev->rbtree_right = NULL;
+ ev->rbtree_parent = NULL;
+#endif
+
ev->timer_set = 0;
}
@@ -59,8 +68,9 @@
(ngx_elapsed_msec + timer) / NGX_TIMER_RESOLUTION;
#endif
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0,
- "event timer add: %d", ev->rbtree_key);
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
+ "event timer add: %d: %d",
+ ngx_event_ident(ev->data), ev->rbtree_key);
ngx_rbtree_insert(&ngx_event_timer_rbtree, &ngx_event_timer_sentinel,
(ngx_rbtree_t *) &ev->rbtree_key);
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 396e282..9408fc8 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -657,6 +657,24 @@
/* there was error while a header line parsing */
+#if (NGX_LOG_DEBUG)
+ if (rc == NGX_HTTP_PARSE_INVALID_HEADER) {
+ char *p;
+ for (p = r->header_name_start;
+ p < r->header_in->last - 1;
+ p++)
+ {
+ if (*p == CR || *p == LF) {
+ break;
+ }
+ }
+ *p = '\0';
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0,
+ "http invalid header: \"%s\"",
+ r->header_name_start);
+ }
+#endif
+
ngx_http_client_error(r, rc, NGX_HTTP_BAD_REQUEST);
return;
}
@@ -1419,7 +1437,7 @@
return;
}
- if (error) {
+ if (error && r->headers_out.status == 0) {
r->headers_out.status = error;
}
diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c
index c9d3d7a..6ca15fb 100644
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -44,7 +44,7 @@
#if (HAVE_KQUEUE)
if ((ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) && wev->kq_eof) {
- ngx_log_error(NGX_LOG_ERR, c->log, wev->kq_errno,
+ ngx_log_error(NGX_LOG_INFO, c->log, wev->kq_errno,
"kevent() reported about closed connection");
wev->error = 1;
@@ -153,7 +153,7 @@
if (ngx_freebsd_use_tcp_nopush && !c->tcp_nopush) {
c->tcp_nopush = 1;
-ngx_log_debug(c->log, "NOPUSH");
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "tcp_nopush");
if (ngx_tcp_nopush(c->fd) == NGX_ERROR) {
ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno,
@@ -193,9 +193,9 @@
}
if (err == NGX_EAGAIN || err == NGX_EINTR) {
- ngx_log_error(NGX_LOG_INFO, c->log, err,
- "sendfile() sent only " OFF_T_FMT " bytes",
- sent);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, err,
+ "sendfile() sent only " OFF_T_FMT " bytes",
+ sent);
} else {
wev->error = 1;
@@ -205,22 +205,23 @@
}
}
-#if (NGX_DEBUG_WRITE_CHAIN)
- ngx_log_debug(c->log, "sendfile: %d, @%qd %qd:%d" _
- rc _ file->file_pos _ sent _ fsize + hsize);
-#endif
+ ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
+ "sendfile: %d, @" OFF_T_FMT " " OFF_T_FMT ":%d",
+ rc, file->file_pos, sent, fsize + hsize);
} else {
rc = writev(c->fd, header.elts, header.nelts);
if (rc == -1) {
err = ngx_errno;
- if (err == NGX_EAGAIN) {
- ngx_log_error(NGX_LOG_INFO, c->log, err, "writev() EAGAIN");
- } else if (err == NGX_EINTR) {
+ if (err == NGX_EINTR) {
eintr = 1;
- ngx_log_error(NGX_LOG_INFO, c->log, err, "writev() EINTR");
+ }
+
+ if (err == NGX_EAGAIN || err == NGX_EINTR) {
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err,
+ "writev() not ready");
} else {
wev->error = 1;
@@ -231,9 +232,8 @@
sent = rc > 0 ? rc : 0;
-#if (NGX_DEBUG_WRITE_CHAIN)
- ngx_log_debug(c->log, "writev: %qd" _ sent);
-#endif
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
+ "writev: " OFF_T_FMT, sent);
}
c->sent += sent;