mirror of
https://github.com/nginx/nginx.git
synced 2024-11-30 04:33:49 -06:00
nginx-0.0.1-2003-12-22-12:40:48 import
This commit is contained in:
parent
1cd1e2741a
commit
669e3319ce
@ -206,6 +206,23 @@ void ngx_assert_core(ngx_log_t *log, const char *fmt, ...);
|
||||
#define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3)
|
||||
#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) \
|
||||
@ -252,6 +269,22 @@ void ngx_assert_core(ngx_log_t *log, const char *fmt, ...);
|
||||
#define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3)
|
||||
#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) \
|
||||
|
@ -33,15 +33,24 @@ extern ngx_rbtree_t *ngx_event_timer_rbtree;
|
||||
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_inline static void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
|
||||
(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);
|
||||
|
@ -657,6 +657,24 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
|
||||
|
||||
/* 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 @@ void ngx_http_close_request(ngx_http_request_t *r, int error)
|
||||
return;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
if (error && r->headers_out.status == 0) {
|
||||
r->headers_out.status = error;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
#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 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
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 @@ ngx_log_debug(c->log, "NOPUSH");
|
||||
}
|
||||
|
||||
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 @@ ngx_log_debug(c->log, "NOPUSH");
|
||||
}
|
||||
}
|
||||
|
||||
#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 @@ ngx_log_debug(c->log, "NOPUSH");
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user