# HG changeset patch # User Igor Sysoev # Date 1040667738 0 # Node ID 9fe40e51d4a3bdad61bb4a996c4182645de6ca13 # Parent c14d7232b11f7a37b47156967122736b4cfb83e2 nginx-0.0.1-2002-12-23-21:22:18 import diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h --- a/src/core/ngx_config.h +++ b/src/core/ngx_config.h @@ -67,12 +67,14 @@ #define HAVE_INHERITED_NONBLOCK 1 #endif +#include /* INFTIM */ + #endif /* Solaris */ #include -#include /* offsetof */ +#include /* offsetof */ #include #include #include @@ -90,6 +92,11 @@ #ifndef HAVE_POLL #define HAVE_POLL 1 #include +/* +#ifndef INFTIM +#define INFTIM -1 +#endif +*/ #endif #define ngx_inline inline diff --git a/src/core/ngx_config_file.c b/src/core/ngx_config_file.c --- a/src/core/ngx_config_file.c +++ b/src/core/ngx_config_file.c @@ -179,15 +179,15 @@ int ngx_conf_read_token(ngx_conf_t *cf) found = 0; need_space = 0; last_space = 1; - len = 0; quoted = s_quoted = d_quoted = 0; cf->args->nelts = 0; h = cf->conf_file->hunk; + start = h->pos.mem; ngx_log_debug(cf->log, "TOKEN START"); - for (start = h->pos.mem; /* void */ ; /* void */) { + for ( ;; ) { if (h->pos.mem >= h->last.mem) { if (cf->conf_file->file.offset @@ -215,14 +215,21 @@ ngx_log_debug(cf->log, "TOKEN START"); ch = *h->pos.mem++; +#if 0 ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _ last_space _ need_space _ quoted _ s_quoted _ d_quoted _ ch); +#endif if (ch == LF) { cf->conf_file->line++; } + if (quoted) { + quoted = 0; + continue; + } + if (need_space) { if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) { last_space = 1; @@ -237,16 +244,8 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d ' return NGX_ERROR; } - if (quoted) { - quoted = 0; - continue; - } - - len++; - if (last_space) { if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) { - len = 0; continue; } @@ -254,6 +253,10 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d ' switch (ch) { + case ';': + case '{': + return NGX_OK; + case '\\': quoted = 1; last_space = 0; @@ -261,14 +264,12 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d ' case '"': start++; - len--; d_quoted = 1; last_space = 0; continue; case '\'': start++; - len--; s_quoted = 1; last_space = 0; continue; @@ -285,7 +286,6 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d ' if (d_quoted) { if (ch == '"') { - len--; d_quoted = 0; need_space = 1; found = 1; @@ -293,7 +293,6 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d ' } else if (s_quoted) { if (ch == '\'') { - len--; s_quoted = 0; need_space = 1; found = 1; @@ -301,20 +300,19 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d ' } else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF || ch == ';' || ch == '{') { - len--; last_space = 1; found = 1; } if (found) { ngx_test_null(word, ngx_push_array(cf->args), NGX_ERROR); - ngx_test_null(word->data, ngx_palloc(cf->pool, len + 1), + ngx_test_null(word->data, + ngx_palloc(cf->pool, h->pos.mem - start + 1), NGX_ERROR); - word->len = len; - for (dst = word->data, src = start; + for (dst = word->data, src = start, len = 0; src < h->pos.mem - 1; - /* void */) + len++) { if (*src == '\\') { src++; @@ -322,6 +320,7 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d ' *dst++ = *src++; } *dst = '\0'; + word->len = len; ngx_log_debug(cf->log, "FOUND %d:'%s'" _ word->len _ word->data); @@ -330,7 +329,6 @@ ngx_log_debug(cf->log, "FOUND %d:'%s'" _ } found = 0; - len = 0; } } } diff --git a/src/event/modules/ngx_poll_module.c b/src/event/modules/ngx_poll_module.c --- a/src/event/modules/ngx_poll_module.c +++ b/src/event/modules/ngx_poll_module.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -108,6 +109,7 @@ int ngx_poll_del_event(ngx_event_t *ev, if (e == NULL || e->index == NGX_INVALID_INDEX) { if (ev->index < --nevents) { + event_list[ev->index] = event_list[nevents]; event_index[ev->index] = event_index[nevents]; event_index[ev->index]->index = ev->index; } @@ -125,6 +127,7 @@ int ngx_poll_process_events(ngx_log_t *l { int i, ready, found; u_int timer, delta; + ngx_err_t err; ngx_event_t *ev; ngx_connection_t *c; @@ -202,7 +205,7 @@ int ngx_poll_process_events(ngx_log_t *l if (c->read->oneshot) { ngx_del_timer(c->read); - ngx_select_del_event(c->read, NGX_READ_EVENT, 0); + ngx_poll_del_event(c->read, NGX_READ_EVENT, 0); } if (c->read->event_handler(c->read) == NGX_ERROR) { @@ -216,7 +219,7 @@ int ngx_poll_process_events(ngx_log_t *l if (c->write->oneshot) { ngx_del_timer(c->write); - ngx_select_del_event(c->write, NGX_WRITE_EVENT, 0); + ngx_poll_del_event(c->write, NGX_WRITE_EVENT, 0); } if (c->write->event_handler(c->write) == NGX_ERROR) { @@ -226,7 +229,13 @@ int ngx_poll_process_events(ngx_log_t *l if (event_list[i].revents & (POLLERR|POLLHUP|POLLNVAL)) { found = 1; - ngx_log_error(NGX_LOG_ERR, log, ngx_errno, + + err = 0; + if (event_list[i].revents & POLLNVAL) { + err = EBADF; + } + + ngx_log_error(NGX_LOG_ERR, log, err, "poll() error on %d:%d", event_list[i].fd, event_list[i].revents); } diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c --- a/src/event/ngx_event.c +++ b/src/event/ngx_event.c @@ -35,8 +35,18 @@ ngx_event_type_e ngx_event_type = NG ngx_event_type_e ngx_event_type = NGX_KQUEUE_EVENT; #endif +#elif (HAVE_POLL) + +#if 0 +ngx_event_type_e ngx_event_type = NGX_SELECT_EVENT; #else +ngx_event_type_e ngx_event_type = NGX_POLL_EVENT; +#endif + +#else + ngx_event_type_e ngx_event_type = NGX_SELECT_EVENT; + #endif ngx_event_actions_t ngx_event_actions; diff --git a/src/http/ngx_http_event.c b/src/http/ngx_http_event.c --- a/src/http/ngx_http_event.c +++ b/src/http/ngx_http_event.c @@ -313,9 +313,11 @@ static int ngx_http_process_request_line ngx_cpystrn(r->exten.data, r->uri_ext, r->exten.len + 1); } +#if 0 ngx_log_debug(r->connection->log, "HTTP: %d, %d, %s %s" _ r->method _ r->http_version _ r->uri.data _ r->exten.data); +#endif if (r->http_version == 9) return NGX_OK;