Router: renamed nxt_http_proxy_create() as nxt_http_proxy_init().
No functional changes.
This commit is contained in:
@@ -348,8 +348,8 @@ nxt_int_t nxt_upstream_find(nxt_upstreams_t *upstreams, nxt_str_t *name,
|
|||||||
nxt_http_action_t *nxt_upstream_proxy_handler(nxt_task_t *task,
|
nxt_http_action_t *nxt_upstream_proxy_handler(nxt_task_t *task,
|
||||||
nxt_http_request_t *r, nxt_upstream_t *upstream);
|
nxt_http_request_t *r, nxt_upstream_t *upstream);
|
||||||
|
|
||||||
|
nxt_int_t nxt_http_proxy_init(nxt_mp_t *mp, nxt_http_action_t *action,
|
||||||
nxt_int_t nxt_http_proxy_create(nxt_mp_t *mp, nxt_http_action_t *action);
|
nxt_http_action_conf_t *acf);
|
||||||
nxt_int_t nxt_http_proxy_date(void *ctx, nxt_http_field_t *field,
|
nxt_int_t nxt_http_proxy_date(void *ctx, nxt_http_field_t *field,
|
||||||
uintptr_t data);
|
uintptr_t data);
|
||||||
nxt_int_t nxt_http_proxy_content_length(void *ctx, nxt_http_field_t *field,
|
nxt_int_t nxt_http_proxy_content_length(void *ctx, nxt_http_field_t *field,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ static void nxt_http_proxy_upstream_ready(nxt_task_t *task,
|
|||||||
nxt_upstream_server_t *us);
|
nxt_upstream_server_t *us);
|
||||||
static void nxt_http_proxy_upstream_error(nxt_task_t *task,
|
static void nxt_http_proxy_upstream_error(nxt_task_t *task,
|
||||||
nxt_upstream_server_t *us);
|
nxt_upstream_server_t *us);
|
||||||
static nxt_http_action_t *nxt_http_proxy_handler(nxt_task_t *task,
|
static nxt_http_action_t *nxt_http_proxy(nxt_task_t *task,
|
||||||
nxt_http_request_t *r, nxt_http_action_t *action);
|
nxt_http_request_t *r, nxt_http_action_t *action);
|
||||||
static void nxt_http_proxy_header_send(nxt_task_t *task, void *obj, void *data);
|
static void nxt_http_proxy_header_send(nxt_task_t *task, void *obj, void *data);
|
||||||
static void nxt_http_proxy_header_sent(nxt_task_t *task, void *obj, void *data);
|
static void nxt_http_proxy_header_sent(nxt_task_t *task, void *obj, void *data);
|
||||||
@@ -50,7 +50,8 @@ static const nxt_upstream_peer_state_t nxt_upstream_proxy_state = {
|
|||||||
|
|
||||||
|
|
||||||
nxt_int_t
|
nxt_int_t
|
||||||
nxt_http_proxy_create(nxt_mp_t *mp, nxt_http_action_t *action)
|
nxt_http_proxy_init(nxt_mp_t *mp, nxt_http_action_t *action,
|
||||||
|
nxt_http_action_conf_t *acf)
|
||||||
{
|
{
|
||||||
nxt_str_t name;
|
nxt_str_t name;
|
||||||
nxt_sockaddr_t *sa;
|
nxt_sockaddr_t *sa;
|
||||||
@@ -58,7 +59,7 @@ nxt_http_proxy_create(nxt_mp_t *mp, nxt_http_action_t *action)
|
|||||||
nxt_upstream_proxy_t *proxy;
|
nxt_upstream_proxy_t *proxy;
|
||||||
|
|
||||||
sa = NULL;
|
sa = NULL;
|
||||||
name = action->name;
|
nxt_conf_get_string(acf->proxy, &name);
|
||||||
|
|
||||||
if (nxt_str_start(&name, "http://", 7)) {
|
if (nxt_str_start(&name, "http://", 7)) {
|
||||||
name.length -= 7;
|
name.length -= 7;
|
||||||
@@ -92,7 +93,7 @@ nxt_http_proxy_create(nxt_mp_t *mp, nxt_http_action_t *action)
|
|||||||
up->type.proxy = proxy;
|
up->type.proxy = proxy;
|
||||||
|
|
||||||
action->u.upstream = up;
|
action->u.upstream = up;
|
||||||
action->handler = nxt_http_proxy_handler;
|
action->handler = nxt_http_proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NXT_OK;
|
return NXT_OK;
|
||||||
@@ -100,10 +101,16 @@ nxt_http_proxy_create(nxt_mp_t *mp, nxt_http_action_t *action)
|
|||||||
|
|
||||||
|
|
||||||
static nxt_http_action_t *
|
static nxt_http_action_t *
|
||||||
nxt_http_proxy_handler(nxt_task_t *task, nxt_http_request_t *r,
|
nxt_http_proxy(nxt_task_t *task, nxt_http_request_t *r,
|
||||||
nxt_http_action_t *action)
|
nxt_http_action_t *action)
|
||||||
{
|
{
|
||||||
return nxt_upstream_proxy_handler(task, r, action->u.upstream);
|
nxt_upstream_t *u;
|
||||||
|
|
||||||
|
u = action->u.upstream;
|
||||||
|
|
||||||
|
nxt_debug(task, "http proxy: \"%V\"", &u->name);
|
||||||
|
|
||||||
|
return nxt_upstream_proxy_handler(task, r, u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -657,7 +657,6 @@ nxt_http_action_init(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
|
|||||||
nxt_mp_t *mp;
|
nxt_mp_t *mp;
|
||||||
nxt_int_t ret;
|
nxt_int_t ret;
|
||||||
nxt_str_t name, *string;
|
nxt_str_t name, *string;
|
||||||
nxt_conf_value_t *conf;
|
|
||||||
nxt_http_action_conf_t acf;
|
nxt_http_action_conf_t acf;
|
||||||
|
|
||||||
nxt_memzero(&acf, sizeof(acf));
|
nxt_memzero(&acf, sizeof(acf));
|
||||||
@@ -681,23 +680,16 @@ nxt_http_action_init(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (acf.proxy != NULL) {
|
if (acf.proxy != NULL) {
|
||||||
conf = acf.proxy;
|
return nxt_http_proxy_init(mp, action, &acf);
|
||||||
|
|
||||||
} else {
|
|
||||||
conf = acf.pass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nxt_conf_get_string(conf, &name);
|
nxt_conf_get_string(acf.pass, &name);
|
||||||
|
|
||||||
string = nxt_str_dup(mp, &action->name, &name);
|
string = nxt_str_dup(mp, &action->name, &name);
|
||||||
if (nxt_slow_path(string == NULL)) {
|
if (nxt_slow_path(string == NULL)) {
|
||||||
return NXT_ERROR;
|
return NXT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acf.proxy != NULL) {
|
|
||||||
return nxt_http_proxy_create(mp, action);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NXT_OK;
|
return NXT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user