nginx-0.0.1-2003-10-17-00:19:16 import
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index 1bf2bd9..9ec9325 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -79,7 +79,7 @@
 
 int ngx_http_index_handler(ngx_http_request_t *r)
 {
-    int                        i, rc, test_dir, path_not_found;
+    int                        rc;
     char                      *name, *file;
     ngx_str_t                  redirect, *index;
     ngx_err_t                  err;
@@ -132,7 +132,7 @@
 
         fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN);
 
-        if (fd == NGX_AGAIN) {
+        if (fd == (ngx_fd_t) NGX_AGAIN) {
             return NGX_AGAIN;
         }
 
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c
index b8aa8d4..8b414d7 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -4,7 +4,188 @@
 #include <ngx_http.h>
 
 
-int ngx_http_static_handler(ngx_http_request_t *r)
+static int ngx_http_static_handler(ngx_http_request_t *r);
+static int ngx_http_static_init(ngx_cycle_t *cycle);
+
+
+static ngx_command_t  ngx_http_static_commands[] = {
+
+    ngx_null_command
+};
+
+
+
+ngx_http_module_t  ngx_http_static_module_ctx = {
+    NULL,                                  /* create main configuration */
+    NULL,                                  /* init main configuration */
+    
+    NULL,                                  /* create server configuration */
+    NULL,                                  /* merge server configuration */
+    
+    NULL,                                  /* create location configuration */
+    NULL                                   /* merge location configuration */
+};  
+
+
+ngx_module_t  ngx_http_static_module = {
+    NGX_MODULE,
+    &ngx_http_static_module_ctx,           /* module context */
+    ngx_http_static_commands,              /* module directives */
+    NGX_HTTP_MODULE,                       /* module type */
+    ngx_http_static_init,                  /* init module */
+    NULL                                   /* init child */
+};
+
+
+int ngx_http_static_translate_handler(ngx_http_request_t *r)
+{
+    char                      *location, *last;
+    ngx_err_t                  err;
+    ngx_table_elt_t           *h;
+    ngx_http_core_loc_conf_t  *clcf;
+
+    if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
+        return NGX_HTTP_NOT_ALLOWED;
+    }
+
+    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+    if (r->uri.data[r->uri.len - 1] == '/') {
+        if (r->path.data == NULL) {
+            ngx_test_null(r->path.data,
+                          ngx_palloc(r->pool,
+                                     clcf->doc_root.len + r->uri.len),
+                          NGX_HTTP_INTERNAL_SERVER_ERROR);
+
+            ngx_cpystrn(ngx_cpymem(r->path.data, clcf->doc_root.data,
+                                   clcf->doc_root.len),
+                        r->uri.data, r->uri.len + 1);
+
+        } else {
+            r->path.data[r->path.len] = '\0';
+        }
+
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "directory index of \"%s\" is forbidden", r->path.data);
+
+        return NGX_HTTP_FORBIDDEN;
+    }
+
+    /* "+ 2" is for trailing '/' in redirect and '\0' */
+    ngx_test_null(r->file.name.data,
+                  ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2),
+                  NGX_HTTP_INTERNAL_SERVER_ERROR);
+
+    location = ngx_cpymem(r->file.name.data, clcf->doc_root.data,
+                          clcf->doc_root.len),
+
+    last = ngx_cpystrn(location, r->uri.data, r->uri.len + 1);
+
+ngx_log_debug(r->connection->log, "HTTP filename: '%s'" _ r->file.name.data);
+
+#if (WIN9X)
+
+    /*
+     * There is no way to open a file or a directory in Win9X with
+     * one syscall: Win9X has no FILE_FLAG_BACKUP_SEMANTICS flag.
+     * so we need to check its type before the opening
+     */
+
+    r->file.info.dwFileAttributes = GetFileAttributes(r->file.name.data);
+    if (r->file.info.dwFileAttributes == INVALID_FILE_ATTRIBUTES) {
+        err = ngx_errno;
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, err,
+                      ngx_file_type_n " \"%s\" failed", r->file.name.data);
+
+        if (err == NGX_ENOENT || err == NGX_ENOTDIR) {
+            return NGX_HTTP_NOT_FOUND;
+
+        } else if (err == NGX_EACCES) {
+            return NGX_HTTP_FORBIDDEN;
+
+        } else {
+            return NGX_HTTP_INTERNAL_SERVER_ERROR;
+        }
+    }
+
+#else
+
+    if (r->file.fd == NGX_INVALID_FILE) {
+        r->file.fd = ngx_open_file(r->file.name.data,
+                                   NGX_FILE_RDONLY, NGX_FILE_OPEN);
+    }
+
+    if (r->file.fd == NGX_INVALID_FILE) {
+        err = ngx_errno;
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno,
+                      ngx_open_file_n " \"%s\" failed", r->file.name.data);
+
+        if (err == NGX_ENOENT || err == NGX_ENOTDIR) {
+            return NGX_HTTP_NOT_FOUND;
+
+        } else if (err == NGX_EACCES) {
+            return NGX_HTTP_FORBIDDEN;
+
+        } else {
+            return NGX_HTTP_INTERNAL_SERVER_ERROR;
+        }
+    }
+
+ngx_log_debug(r->connection->log, "FILE: %d" _ r->file.fd);
+
+    if (!r->file.info_valid) {
+        if (ngx_stat_fd(r->file.fd, &r->file.info) == NGX_FILE_ERROR) {
+            ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
+                          ngx_stat_fd_n " \"%s\" failed", r->file.name.data);
+
+            if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) {
+                ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
+                              ngx_close_file_n " \"%s\" failed",
+                              r->file.name.data);
+            }
+
+            r->file.fd = NGX_INVALID_FILE;
+
+            return NGX_HTTP_INTERNAL_SERVER_ERROR;
+        }
+
+        r->file.info_valid = 1;
+    }
+#endif
+
+    if (ngx_is_dir(r->file.info)) {
+ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data);
+
+#if !(WIN9X)
+        if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) {
+            ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
+                          ngx_close_file_n " \"%s\" failed", r->file.name.data);
+        }
+
+        r->file.fd = NGX_INVALID_FILE;
+#endif
+
+        ngx_test_null(h, ngx_push_table(r->headers_out.headers),
+                      NGX_HTTP_INTERNAL_SERVER_ERROR);
+
+        *last++ = '/';
+        *last = '\0';
+        h->key.len = 8;
+        h->key.data = "Location" ;
+        h->value.len = last - location;
+        h->value.data = location;
+        r->headers_out.location = h;
+
+        return NGX_HTTP_MOVED_PERMANENTLY;
+    }
+
+    r->content_handler = ngx_http_static_handler;
+
+    return NGX_OK;
+}
+
+
+static int ngx_http_static_handler(ngx_http_request_t *r)
 {
     int                        rc, key, i;
     ngx_log_e                  level;
@@ -20,10 +201,6 @@
         return rc;
     }
 
-    if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
-        return NGX_HTTP_NOT_ALLOWED;
-    }
-
     ctx = r->connection->log->data;
     ctx->action = "sending response";
 
@@ -142,3 +319,22 @@
 
     return ngx_http_output_filter(r, h);
 }
+
+
+static int ngx_http_static_init(ngx_cycle_t *cycle)
+{
+    ngx_http_handler_pt        *h;
+    ngx_http_conf_ctx_t        *ctx;
+    ngx_http_core_main_conf_t  *cmcf;
+    
+    ctx = (ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index];
+    cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
+    
+    ngx_test_null(h, ngx_push_array(
+                             &cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers),
+                  NGX_ERROR);
+    *h = ngx_http_static_translate_handler;
+
+    return NGX_OK;
+}
+
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index b21eac4..58ce51a 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -17,7 +17,8 @@
 static void ngx_http_proxy_process_upstream_headers(ngx_event_t *rev);
 static ssize_t ngx_http_proxy_read_upstream_header(ngx_http_proxy_ctx_t *);
 static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p);
-static void ngx_http_proxy_process_upstream_body(ngx_event_t *rev);
+static void ngx_http_proxy_process_upstream(ngx_event_t *rev);
+static void ngx_http_proxy_process_downstream(ngx_event_t *wev);
 
 static int ngx_http_proxy_parse_status_line(ngx_http_proxy_ctx_t *p);
 static void ngx_http_proxy_next_upstream(ngx_http_proxy_ctx_t *p);
@@ -27,8 +28,21 @@
 static int ngx_http_proxy_init(ngx_cycle_t *cycle);
 static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf);
 
+static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd,
+                                     void *conf);
+static char *ngx_http_proxy_parse_upstream(ngx_str_t *url,
+                                           ngx_http_proxy_upstream_t *u);
+
 
 static ngx_command_t ngx_http_proxy_commands[] = {
+
+    {ngx_string("proxy_pass"),
+     NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+     ngx_http_proxy_set_pass,
+     NGX_HTTP_LOC_CONF_OFFSET,
+     0,
+     NULL},
+
     ngx_null_command
 };
 
@@ -54,7 +68,7 @@
     &ngx_http_proxy_module_ctx,            /* module context */
     ngx_http_proxy_commands,               /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
-    ngx_http_proxy_init,                   /* init module */
+    NULL,                                  /* init module */
     NULL                                   /* init child */
 };
 
@@ -99,22 +113,9 @@
 
 
 
-static int ngx_http_proxy_translate_handler(ngx_http_request_t *r)
-{
-#if 0
-    r->handler = ngx_http_proxy_handler;
-    return NGX_OK;
-#else
-    return NGX_DECLINED;
-#endif
-}
-
-
 static int ngx_http_proxy_handler(ngx_http_request_t *r)
 {
-    int                         rc;
-    ngx_http_proxy_ctx_t       *p;
-    ngx_http_proxy_loc_conf_t  *lcf;
+    ngx_http_proxy_ctx_t  *p;
 
     ngx_http_create_ctx(r, p, ngx_http_proxy_module,
                         sizeof(ngx_http_proxy_ctx_t),
@@ -126,6 +127,8 @@
 
     p->request = r;
     p->method = r->method;
+
+    /* TODO: from lcf->upstream */
     p->uri.data = "/";
     p->uri.len = 1;
     p->location_len = 1;
@@ -144,7 +147,7 @@
 
     ngx_http_proxy_send_request(p);
 
-    return NGX_OK;
+    return NGX_DONE;
 }
 
 
@@ -580,7 +583,6 @@
 
 static ssize_t ngx_http_proxy_read_upstream_header(ngx_http_proxy_ctx_t *p)
 {
-    int           event;
     ssize_t       n;
     ngx_event_t  *rev;
 
@@ -589,7 +591,10 @@
     n = p->header_in->last - p->header_in->pos;
 
     if (n > 0) {
+#if 0
+        /* TODO THINK */
         rev->ready = 0;
+#endif
         return n;
     }
 
@@ -700,11 +705,12 @@
         return;
     }
 
+    ep->input_filter = ngx_event_proxy_copy_input_filter;
     ep->output_filter = (ngx_event_proxy_output_filter_pt)
                                                         ngx_http_output_filter;
-    ep->output_data = r;
-    ep->block_size = p->lcf->block_size;
-    ep->max_block_size = p->lcf->max_block_size;
+    ep->output_ctx = r;
+    ep->bufs = p->lcf->bufs;
+    ep->max_busy_len = p->lcf->max_busy_len;
     ep->upstream = p->upstream.connection;
     ep->downstream = r->connection;
     ep->pool = r->pool;
@@ -742,16 +748,18 @@
     lcx->action = "reading an upstream";
 #endif
 
-    ngx_event_proxy_read_upstream(ep);
-
     p->upstream.connection->read->event_handler =
-                                          ngx_http_proxy_process_upstream_body;
+                                               ngx_http_proxy_process_upstream;
+    r->connection->write->event_handler =
+                                             ngx_http_proxy_process_downstream;
+
+    ngx_http_proxy_process_upstream(p->upstream.connection->read);
 
     return;
 }
 
 
-static void ngx_http_proxy_process_upstream_body(ngx_event_t *rev)
+static void ngx_http_proxy_process_upstream(ngx_event_t *rev)
 {
     ngx_connection_t      *c;
     ngx_http_proxy_ctx_t  *p;
@@ -759,25 +767,58 @@
     c = rev->data;
     p = c->data;
 
-    ngx_log_debug(rev->log, "http proxy process upstream body");
+    ngx_log_debug(rev->log, "http proxy process upstream");
 
     if (rev->timedout) {
-        ngx_http_proxy_close_connection(p->upstream.connection);
+        ngx_http_proxy_close_connection(c);
         p->upstream.connection = NULL;
         return;
     }
 
-    ngx_event_proxy_read_upstream(p->event_proxy);
-
-    if (p->event_proxy->upstream_eof) {
-        ngx_http_proxy_close_connection(p->upstream.connection);
-        p->upstream.connection = NULL;
+    if (ngx_event_proxy_read_upstream(p->event_proxy) == NGX_ABORT) {
+        ngx_http_proxy_finalize_request(p, 0);
         return;
     }
 
-    if (p->event_proxy->upstream_error) {
-        ngx_http_proxy_close_connection(p->upstream.connection);
-        p->upstream.connection = NULL;
+    if (p->event_proxy->upstream_eof
+        || p->event_proxy->upstream_error
+        || p->event_proxy->upstream_done)
+    {
+        ngx_http_proxy_finalize_request(p, ngx_http_send_last(p->request));
+        return;
+    }
+
+    return;
+}
+
+
+static void ngx_http_proxy_process_downstream(ngx_event_t *wev)
+{
+    ngx_connection_t      *c;
+    ngx_http_proxy_ctx_t  *p;
+
+    c = wev->data;
+    p = c->data;
+
+    ngx_log_debug(wev->log, "http proxy process downstream");
+
+    if (wev->timedout) {
+        ngx_http_close_connection(c);
+        return;
+    }
+
+    if (ngx_event_proxy_write_to_downstream(p->event_proxy) == NGX_ABORT) {
+        ngx_http_proxy_finalize_request(p, 0);
+        return;
+    }
+
+    if (p->event_proxy->downstream_done) {
+        ngx_http_proxy_finalize_request(p, 0);
+        return;
+    }
+
+    if (p->event_proxy->downstream_error) {
+        ngx_http_close_connection(c);
         return;
     }
 
@@ -1076,25 +1117,6 @@
 }
 
 
-static int ngx_http_proxy_init(ngx_cycle_t *cycle)
-{
-    ngx_http_handler_pt        *h;
-    ngx_http_conf_ctx_t        *ctx;
-    ngx_http_core_main_conf_t  *cmcf;
-
-    ctx = (ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index];
-    cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
-
-    ngx_test_null(h, ngx_push_array(
-                             &cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers),
-                  NGX_ERROR);
-
-    *h = ngx_http_proxy_translate_handler;
-
-    return NGX_OK;
-}
-
-
 static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
 {
     int                         i;
@@ -1121,8 +1143,9 @@
     conf->header_size = 4096;
     conf->read_timeout = 30000;
 
-    conf->block_size = 4096;
-    conf->max_block_size = 4096 * 3;
+    conf->bufs.num = 10;
+    conf->bufs.size = 4096;
+    conf->max_busy_len = 8192 + 4096;
     conf->max_temp_file_size = 4096 * 5;
     conf->temp_file_write_size = 4096 * 2;
 
@@ -1147,3 +1170,206 @@
 
     return conf;
 }
+
+
+static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd,
+                                     void *conf)
+{
+    ngx_http_proxy_loc_conf_t *lcf = conf;
+
+    int                        i, len;
+    char                      *err, *host;
+    ngx_str_t                 *value;
+    struct hostent            *h;
+    u_int32_t                  addr;
+    ngx_http_conf_ctx_t       *ctx;
+    ngx_http_core_loc_conf_t  *clcf;
+
+
+    value = cf->args->elts;
+
+    if (ngx_strncasecmp(value[1].data, "http://", 7) != 0) {
+        return "invalid URL prefix";
+    }
+
+    ngx_test_null(lcf->upstream,
+                  ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_upstream_t)),
+                  NGX_CONF_ERROR);
+
+    value[1].data += 7;
+    value[1].len -= 7;
+
+    err = ngx_http_proxy_parse_upstream(&value[1], lcf->upstream);
+
+    if (err) {
+        return err;
+    }
+
+    ngx_test_null(host, ngx_palloc(cf->pool, lcf->upstream->host.len + 1),
+                  NGX_CONF_ERROR);
+    ngx_cpystrn(host, lcf->upstream->host.data, lcf->upstream->host.len + 1);
+
+    addr = inet_addr(host);
+
+    if (addr == INADDR_NONE) {
+        h = gethostbyname(host);
+
+        if (h == NULL || h->h_addr_list[0] == NULL) {
+            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "host %s not found", host);
+            return NGX_CONF_ERROR;
+        }
+
+        for (i = 0; h->h_addr_list[i] != NULL; i++) { /* void */ }
+
+        /* MP: ngx_shared_palloc() */
+
+        ngx_test_null(lcf->peers,
+                      ngx_pcalloc(cf->pool,
+                                  sizeof(ngx_peers_t)
+                                  + sizeof(ngx_peer_t) * (i - 1)),
+                      NGX_CONF_ERROR);
+
+        lcf->peers->number = i;
+
+        for (i = 0; h->h_addr_list[i] != NULL; i++) {
+            lcf->peers->peers[i].host.data = host;
+            lcf->peers->peers[i].host.len = lcf->upstream->host.len;
+            lcf->peers->peers[i].addr = *(u_int32_t *)(h->h_addr_list[i]);
+            lcf->peers->peers[i].port = lcf->upstream->port;
+
+            len = INET_ADDRSTRLEN + lcf->upstream->port_text.len + 1;
+            ngx_test_null(lcf->peers->peers[i].addr_port_text.data,
+                          ngx_palloc(cf->pool, len),
+                          NGX_CONF_ERROR);
+
+            len = ngx_inet_ntop(AF_INET,
+                                (char *) &lcf->peers->peers[i].addr,
+                                lcf->peers->peers[i].addr_port_text.data,
+                                len);
+
+            lcf->peers->peers[i].addr_port_text.data[len++] = ':';
+
+            ngx_cpystrn(lcf->peers->peers[i].addr_port_text.data + len,
+                        lcf->upstream->port_text.data,
+                        lcf->upstream->port_text.len + 1);
+
+            lcf->peers->peers[i].addr_port_text.len =
+                                        len + lcf->upstream->port_text.len + 1;
+        }
+
+    } else {
+
+        /* MP: ngx_shared_palloc() */
+
+        ngx_test_null(lcf->peers, ngx_pcalloc(cf->pool, sizeof(ngx_peers_t)),
+                      NGX_CONF_ERROR);
+
+        lcf->peers->number = 1;
+
+        lcf->peers->peers[0].host.data = host;
+        lcf->peers->peers[0].host.len = lcf->upstream->host.len;
+        lcf->peers->peers[0].addr = addr;
+        lcf->peers->peers[0].port = lcf->upstream->port;
+
+        len = lcf->upstream->host.len + lcf->upstream->port_text.len + 1;
+
+        ngx_test_null(lcf->peers->peers[0].addr_port_text.data,
+                      ngx_palloc(cf->pool, len + 1),
+                      NGX_CONF_ERROR);
+
+        len = lcf->upstream->host.len;
+
+        ngx_memcpy(lcf->peers->peers[0].addr_port_text.data,
+                   lcf->upstream->host.data, len);
+
+        lcf->peers->peers[0].addr_port_text.data[len++] = ':';
+
+        ngx_cpystrn(lcf->peers->peers[0].addr_port_text.data + len,
+                    lcf->upstream->port_text.data,
+                    lcf->upstream->port_text.len + 1);
+    }
+
+    ctx = cf->ctx;
+    clcf = ctx->loc_conf[ngx_http_core_module.ctx_index];
+    lcf->upstream->location = &clcf->name;
+    clcf->handler = ngx_http_proxy_handler;
+
+    return NULL;
+}
+
+static char *ngx_http_proxy_parse_upstream(ngx_str_t *url,
+                                           ngx_http_proxy_upstream_t *u)
+{
+    size_t  i;
+
+    if (url->data[0] == ':' || url->data[0] == '/') {
+        return "invalid upstream URL";
+    }
+
+    u->host.data = url->data;
+    u->host_header.data = url->data;
+
+    for (i = 1; i < url->len; i++) {
+        if (url->data[i] == ':') {
+            u->port_text.data = &url->data[i] + 1;
+            u->host.len = i;
+        }
+
+        if (url->data[i] == '/') {
+            u->uri.data = &url->data[i];
+            u->uri.len = url->len - i;
+            u->host_header.len = i;
+
+            if (u->host.len == 0) {
+                u->host.len = i;
+            }
+
+            if (u->port_text.data == NULL) {
+                u->port = htons(80);
+                u->port_text.len = 2;
+                u->port_text.data = "80";
+                return NULL;
+            }
+
+            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);
+                if (u->port > 0) {
+                    u->port = htons((u_short) u->port);
+                    return NULL;
+                }
+            }
+
+            return "invalid port in upstream URL";
+        }
+    }
+
+    if (u->host.len == 0) {
+        u->host.len = i;
+    }
+
+    u->host_header.len = i;
+
+    u->uri.data = "/";
+    u->uri.len = 1;
+
+    if (u->port_text.data == NULL) {
+        u->port = htons(80);
+        u->port_text.len = 2;
+        u->port_text.data = "80";
+        return NULL;
+    }
+
+    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);
+        if (u->port > 0) {
+            u->port = htons((u_short) u->port);
+            return NULL;
+        }
+    }
+
+    return "invalid port in upstream URL";
+}
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.h b/src/http/modules/proxy/ngx_http_proxy_handler.h
index 5212eb2..795373a 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.h
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.h
@@ -9,21 +9,33 @@
 
 
 typedef struct {
-    ngx_msec_t    connect_timeout;
-    ngx_msec_t    send_timeout;
-    ssize_t       header_size;
-    ngx_msec_t    read_timeout;
+    ngx_str_t   host;
+    ngx_str_t   uri;
+    ngx_str_t  *location;
+    ngx_str_t   host_header;
+    ngx_str_t   port_text;
+    int         port;
+} ngx_http_proxy_upstream_t;
+
+
+typedef struct {
+    ngx_msec_t                  connect_timeout;
+    ngx_msec_t                  send_timeout;
+    ssize_t                     header_size;
+    ngx_msec_t                  read_timeout;
+
+    ngx_bufs_t                  bufs;
 
     /* STUB */
-    int           block_size;
-    int           max_block_size;
-    int           max_temp_file_size;
-    int           temp_file_write_size;
+    int                         max_busy_len;
+    int                         max_temp_file_size;
+    int                         temp_file_write_size;
     /* */
 
-    ngx_path_t   *temp_path;
+    ngx_path_t                 *temp_path;
 
-    ngx_peers_t  *peers;
+    ngx_http_proxy_upstream_t  *upstream;
+    ngx_peers_t                *peers;
 } ngx_http_proxy_loc_conf_t;