Renamed a couple of members of nxt_unit_request_t.
This is a preparatory patch that renames the 'local' and 'local_length' members of the nxt_unit_request_t structure to 'local_addr' and 'local_addr_length' in preparation for the adding of 'local_port' and 'local_port_length' members. Suggested-by: Zhidao HONG <z.hong@f5.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
This commit is contained in:
committed by
Andrew Clayton
parent
57fc9201cb
commit
b00983369b
@@ -461,8 +461,8 @@ nxt_java_Request_getLocalAddr(JNIEnv *env, jclass cls, jlong req_ptr)
|
||||
|
||||
r = nxt_jlong2ptr(req_ptr);
|
||||
|
||||
return nxt_java_newString(env, nxt_unit_sptr_get(&r->local),
|
||||
r->local_length);
|
||||
return nxt_java_newString(env, nxt_unit_sptr_get(&r->local_addr),
|
||||
r->local_addr_length);
|
||||
}
|
||||
|
||||
|
||||
@@ -474,11 +474,11 @@ nxt_java_Request_getLocalName(JNIEnv *env, jclass cls, jlong req_ptr)
|
||||
|
||||
r = nxt_jlong2ptr(req_ptr);
|
||||
|
||||
local = nxt_unit_sptr_get(&r->local);
|
||||
colon = memchr(local, ':', r->local_length);
|
||||
local = nxt_unit_sptr_get(&r->local_addr);
|
||||
colon = memchr(local, ':', r->local_addr_length);
|
||||
|
||||
if (colon == NULL) {
|
||||
colon = local + r->local_length;
|
||||
colon = local + r->local_addr_length;
|
||||
}
|
||||
|
||||
return nxt_java_newString(env, local, colon - local);
|
||||
@@ -494,20 +494,20 @@ nxt_java_Request_getLocalPort(JNIEnv *env, jclass cls, jlong req_ptr)
|
||||
|
||||
r = nxt_jlong2ptr(req_ptr);
|
||||
|
||||
local = nxt_unit_sptr_get(&r->local);
|
||||
colon = memchr(local, ':', r->local_length);
|
||||
local = nxt_unit_sptr_get(&r->local_addr);
|
||||
colon = memchr(local, ':', r->local_addr_length);
|
||||
|
||||
if (colon == NULL) {
|
||||
return 80;
|
||||
}
|
||||
|
||||
tmp = local[r->local_length];
|
||||
tmp = local[r->local_addr_length];
|
||||
|
||||
local[r->local_length] = '\0';
|
||||
local[r->local_addr_length] = '\0';
|
||||
|
||||
res = strtol(colon + 1, NULL, 10);
|
||||
|
||||
local[r->local_length] = tmp;
|
||||
local[r->local_addr_length] = tmp;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -657,7 +657,8 @@ Unit::create_socket(napi_value server_obj, nxt_unit_request_info_t *req)
|
||||
req_data->sock_ref = wrap(res, req, sock_destroy);
|
||||
|
||||
set_named_property(res, "remoteAddress", r->remote, r->remote_length);
|
||||
set_named_property(res, "localAddress", r->local, r->local_length);
|
||||
set_named_property(res, "localAddress", r->local_addr,
|
||||
r->local_addr_length);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1365,7 +1365,7 @@ nxt_php_register_variables(zval *track_vars_array TSRMLS_DC)
|
||||
|
||||
nxt_php_set_sptr(req, "REMOTE_ADDR", &r->remote, r->remote_length,
|
||||
track_vars_array TSRMLS_CC);
|
||||
nxt_php_set_sptr(req, "SERVER_ADDR", &r->local, r->local_length,
|
||||
nxt_php_set_sptr(req, "SERVER_ADDR", &r->local_addr, r->local_addr_length,
|
||||
track_vars_array TSRMLS_CC);
|
||||
|
||||
nxt_php_set_sptr(req, "SERVER_NAME", &r->server_name, r->server_name_length,
|
||||
|
||||
@@ -5249,8 +5249,8 @@ nxt_router_prepare_msg(nxt_task_t *task, nxt_http_request_t *r,
|
||||
r->remote->address_length);
|
||||
*p++ = '\0';
|
||||
|
||||
req->local_length = r->local->address_length;
|
||||
nxt_unit_sptr_set(&req->local, p);
|
||||
req->local_addr_length = r->local->address_length;
|
||||
nxt_unit_sptr_set(&req->local_addr, p);
|
||||
p = nxt_cpymem(p, nxt_sockaddr_address(r->local), r->local->address_length);
|
||||
*p++ = '\0';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ struct nxt_unit_request_s {
|
||||
uint8_t method_length;
|
||||
uint8_t version_length;
|
||||
uint8_t remote_length;
|
||||
uint8_t local_length;
|
||||
uint8_t local_addr_length;
|
||||
uint8_t tls;
|
||||
uint8_t websocket_handshake;
|
||||
uint8_t app_target;
|
||||
@@ -38,7 +38,7 @@ struct nxt_unit_request_s {
|
||||
nxt_unit_sptr_t method;
|
||||
nxt_unit_sptr_t version;
|
||||
nxt_unit_sptr_t remote;
|
||||
nxt_unit_sptr_t local;
|
||||
nxt_unit_sptr_t local_addr;
|
||||
nxt_unit_sptr_t server_name;
|
||||
nxt_unit_sptr_t target;
|
||||
nxt_unit_sptr_t path;
|
||||
|
||||
@@ -671,7 +671,7 @@ nxt_perl_psgi_env_create(PerlInterpreter *my_perl,
|
||||
RC(nxt_perl_psgi_add_sptr(my_perl, hash_env, NL("REMOTE_ADDR"),
|
||||
&r->remote, r->remote_length));
|
||||
RC(nxt_perl_psgi_add_sptr(my_perl, hash_env, NL("SERVER_ADDR"),
|
||||
&r->local, r->local_length));
|
||||
&r->local_addr, r->local_addr_length));
|
||||
|
||||
RC(nxt_perl_psgi_add_sptr(my_perl, hash_env, NL("SERVER_NAME"),
|
||||
&r->server_name, r->server_name_length));
|
||||
|
||||
@@ -674,7 +674,7 @@ nxt_py_asgi_create_http_scope(nxt_unit_request_info_t *req)
|
||||
SET_ITEM(scope, client, v)
|
||||
Py_DECREF(v);
|
||||
|
||||
v = nxt_py_asgi_create_address(&r->local, r->local_length, 80);
|
||||
v = nxt_py_asgi_create_address(&r->local_addr, r->local_addr_length, 80);
|
||||
if (nxt_slow_path(v == NULL)) {
|
||||
nxt_unit_req_alert(req, "Python failed to create 'server' pair");
|
||||
goto fail;
|
||||
|
||||
@@ -609,8 +609,8 @@ nxt_python_get_environ(nxt_python_ctx_t *pctx)
|
||||
|
||||
RC(nxt_python_add_sptr(pctx, nxt_py_remote_addr_str, &r->remote,
|
||||
r->remote_length));
|
||||
RC(nxt_python_add_sptr(pctx, nxt_py_server_addr_str, &r->local,
|
||||
r->local_length));
|
||||
RC(nxt_python_add_sptr(pctx, nxt_py_server_addr_str, &r->local_addr,
|
||||
r->local_addr_length));
|
||||
|
||||
if (r->tls) {
|
||||
RC(nxt_python_add_obj(pctx, nxt_py_wsgi_uri_scheme_str,
|
||||
|
||||
@@ -747,8 +747,8 @@ nxt_ruby_read_request(nxt_unit_request_info_t *req, VALUE hash_env)
|
||||
r->version_length);
|
||||
nxt_ruby_add_sptr(hash_env, nxt_rb_remote_addr_str, &r->remote,
|
||||
r->remote_length);
|
||||
nxt_ruby_add_sptr(hash_env, nxt_rb_server_addr_str, &r->local,
|
||||
r->local_length);
|
||||
nxt_ruby_add_sptr(hash_env, nxt_rb_server_addr_str, &r->local_addr,
|
||||
r->local_addr_length);
|
||||
nxt_ruby_add_sptr(hash_env, nxt_rb_server_name_str, &r->server_name,
|
||||
r->server_name_length);
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ greeting_app_request_handler(nxt_unit_request_info_t *req)
|
||||
*p++ = '\n';
|
||||
|
||||
p = copy(p, LOCAL_ADDR, nxt_length(LOCAL_ADDR));
|
||||
p = copy(p, nxt_unit_sptr_get(&r->local), r->local_length);
|
||||
p = copy(p, nxt_unit_sptr_get(&r->local_addr), r->local_addr_length);
|
||||
*p++ = '\n';
|
||||
|
||||
p = copy(p, TARGET, nxt_length(TARGET));
|
||||
|
||||
Reference in New Issue
Block a user