aboutsummaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-09-09 15:40:48 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-09-09 15:40:48 +0000
commit2e6ba93fa79cadf9ed2256992d7c8c4d512f2b1f (patch)
tree50dd328ad6dbd0d9a22a561f2f335ebfe098f1d0 /src/http
parent0d9da9b6c3c4842eade3034e6e1f3ea140d08d6d (diff)
downloadnginx-2e6ba93fa79cadf9ed2256992d7c8c4d512f2b1f.tar.gz
nginx-2e6ba93fa79cadf9ed2256992d7c8c4d512f2b1f.zip
nginx-0.0.10-2004-09-09-19:40:48 import
Diffstat (limited to 'src/http')
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_handler.c5
-rw-r--r--src/http/ngx_http.c4
-rw-r--r--src/http/ngx_http_parse.c10
-rw-r--r--src/http/ngx_http_request.c15
-rw-r--r--src/http/ngx_http_request.h2
5 files changed, 11 insertions, 25 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index af9760c2e..f057d3c98 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -1227,7 +1227,8 @@ static char *ngx_http_proxy_parse_upstream(ngx_str_t *url,
u->port_text.len = &url->data[i] - u->port_text.data;
if (u->port_text.len > 0) {
- u->port = ngx_atoi(u->port_text.data, u->port_text.len);
+ u->port = (in_port_t) ngx_atoi(u->port_text.data,
+ u->port_text.len);
if (u->port > 0) {
if (u->port == 80) {
@@ -1263,7 +1264,7 @@ static char *ngx_http_proxy_parse_upstream(ngx_str_t *url,
u->port_text.len = &url->data[i] - u->port_text.data;
if (u->port_text.len > 0) {
- u->port = ngx_atoi(u->port_text.data, u->port_text.len);
+ u->port = (in_port_t) ngx_atoi(u->port_text.data, u->port_text.len);
if (u->port > 0) {
u->port = htons(u->port);
return NULL;
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index d02b2503a..391bd1bf8 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -54,10 +54,9 @@ ngx_module_t ngx_http_module = {
static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
+ char *rv;
ngx_uint_t mi, m, s, l, p, a, n;
ngx_uint_t port_found, addr_found, virtual_names;
- char *rv;
- struct sockaddr_in *addr_in;
ngx_conf_t pcf;
ngx_array_t in_ports;
ngx_listening_t *ls;
@@ -514,6 +513,7 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ls->nonblocking = 0;
#endif
#endif
+ ls->addr_ntop = 1;
ls->handler = ngx_http_init_connection;
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
index 8136f31d3..dd2d3749a 100644
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -65,19 +65,19 @@ ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r)
if (r->method_end - m == 3) {
- if (*m == 'G' && *(m + 1) == 'E' && *(m + 2) == 'T') {
+ if (m[0] == 'G' && m[1] == 'E' && m[2] == 'T') {
r->method = NGX_HTTP_GET;
}
} else if (r->method_end - m == 4) {
- if (*m == 'P' && *(m + 1) == 'O'
- && *(m + 2) == 'T' && *(m + 3) == 'T')
+ if (m[0] == 'P' && m[1] == 'O'
+ && m[2] == 'T' && m[3] == 'T')
{
r->method = NGX_HTTP_POST;
- } else if (*m == 'H' && *(m + 1) == 'E'
- && *(m + 2) == 'A' && *(m + 3) == 'D')
+ } else if (m[0] == 'H' && m[1] == 'E'
+ && m[2] == 'A' && m[3] == 'D')
{
r->method = NGX_HTTP_HEAD;
}
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index dcf53d746..a1081af12 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -97,21 +97,6 @@ void ngx_http_init_connection(ngx_connection_t *c)
ngx_event_t *rev;
ngx_http_log_ctx_t *ctx;
- c->addr_text.data = ngx_palloc(c->pool, c->listening->addr_text_max_len);
- if (c->addr_text.data == NULL) {
- ngx_http_close_connection(c);
- return;
- }
-
- c->addr_text.len = ngx_sock_ntop(c->listening->family, c->sockaddr,
- c->addr_text.data,
- c->listening->addr_text_max_len);
-
- if (c->addr_text.len == 0) {
- ngx_http_close_connection(c);
- return;
- }
-
if (!(ctx = ngx_pcalloc(c->pool, sizeof(ngx_http_log_ctx_t)))) {
ngx_http_close_connection(c);
return;
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index abd52bc5e..cc0cbbf5e 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -311,7 +311,7 @@ struct ngx_http_request_s {
ngx_uint_t headers_n;
/* used to parse HTTP headers */
- ngx_int_t state;
+ ngx_uint_t state;
u_char *uri_start;
u_char *uri_end;
u_char *uri_ext;