nginx-0.0.1-2002-12-23-21:22:18 import

This commit is contained in:
Igor Sysoev 2002-12-23 18:22:18 +00:00
parent a6717c4e59
commit 295bb6335d
5 changed files with 51 additions and 25 deletions

View File

@ -67,12 +67,14 @@
#define HAVE_INHERITED_NONBLOCK 1
#endif
#include <sys/stropts.h> /* INFTIM */
#endif /* Solaris */
#include <unistd.h>
#include <stddef.h> /* offsetof */
#include <stddef.h> /* offsetof */
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@ -90,6 +92,11 @@
#ifndef HAVE_POLL
#define HAVE_POLL 1
#include <poll.h>
/*
#ifndef INFTIM
#define INFTIM -1
#endif
*/
#endif
#define ngx_inline inline

View File

@ -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 '%c'" _
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 '%c'" _
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 '%c'" _
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 '%c'" _
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 '%c'" _
} 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 '%c'" _
} 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 '%c'" _
*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'" _ word->len _ word->data);
}
found = 0;
len = 0;
}
}
}

View File

@ -2,6 +2,7 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_types.h>
#include <ngx_errno.h>
#include <ngx_log.h>
#include <ngx_time.h>
#include <ngx_connection.h>
@ -108,6 +109,7 @@ int ngx_poll_del_event(ngx_event_t *ev, int event, u_int flags)
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 *log)
{
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 *log)
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 *log)
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 *log)
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);
}

View File

@ -35,8 +35,18 @@ ngx_event_type_e ngx_event_type = NGX_POLL_EVENT;
ngx_event_type_e ngx_event_type = NGX_KQUEUE_EVENT;
#endif
#else
#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;

View File

@ -313,9 +313,11 @@ static int ngx_http_process_request_line(ngx_http_request_t *r)
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;