PHP: populating PHP_AUTH_* server variables.
This closes #498 issue on GitHub.
This commit is contained in:
@@ -15,6 +15,13 @@ invalid HTTP responses were generated for some unusual status codes.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="bugfix">
|
||||
<para>
|
||||
PHP_AUTH_USER, PHP_AUTH_PW, and PHP_AUTH_DIGEST server variables were missing
|
||||
in PHP module.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
</changes>
|
||||
|
||||
|
||||
|
||||
@@ -174,6 +174,8 @@ static nxt_http_field_proc_t nxt_h1p_fields[] = {
|
||||
{ nxt_string("Content-Type"), &nxt_http_request_field,
|
||||
offsetof(nxt_http_request_t, content_type) },
|
||||
{ nxt_string("Content-Length"), &nxt_http_request_content_length, 0 },
|
||||
{ nxt_string("Authorization"), &nxt_http_request_field,
|
||||
offsetof(nxt_http_request_t, authorization) },
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ struct nxt_http_request_s {
|
||||
nxt_http_field_t *cookie;
|
||||
nxt_http_field_t *referer;
|
||||
nxt_http_field_t *user_agent;
|
||||
nxt_http_field_t *authorization;
|
||||
nxt_off_t content_length_n;
|
||||
|
||||
nxt_sockaddr_t *remote;
|
||||
|
||||
@@ -1038,6 +1038,17 @@ nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
|
||||
ctx->cookie = nxt_unit_sptr_get(&f->value);
|
||||
}
|
||||
|
||||
if (r->authorization_field != NXT_UNIT_NONE_FIELD) {
|
||||
f = r->fields + r->authorization_field;
|
||||
|
||||
php_handle_auth_data(nxt_unit_sptr_get(&f->value));
|
||||
|
||||
} else {
|
||||
SG(request_info).auth_digest = NULL;
|
||||
SG(request_info).auth_user = NULL;
|
||||
SG(request_info).auth_password = NULL;
|
||||
}
|
||||
|
||||
SG(sapi_headers).http_response_code = 200;
|
||||
|
||||
SG(request_info).path_translated = NULL;
|
||||
|
||||
@@ -5169,6 +5169,7 @@ nxt_router_prepare_msg(nxt_task_t *task, nxt_http_request_t *r,
|
||||
req->content_length_field = NXT_UNIT_NONE_FIELD;
|
||||
req->content_type_field = NXT_UNIT_NONE_FIELD;
|
||||
req->cookie_field = NXT_UNIT_NONE_FIELD;
|
||||
req->authorization_field = NXT_UNIT_NONE_FIELD;
|
||||
|
||||
dst_field = req->fields;
|
||||
|
||||
@@ -5193,6 +5194,9 @@ nxt_router_prepare_msg(nxt_task_t *task, nxt_http_request_t *r,
|
||||
|
||||
} else if (field == r->cookie) {
|
||||
req->cookie_field = dst_field - req->fields;
|
||||
|
||||
} else if (field == r->authorization) {
|
||||
req->authorization_field = dst_field - req->fields;
|
||||
}
|
||||
|
||||
nxt_debug(task, "add field 0x%04Xd, %d, %d, %p : %d %p",
|
||||
|
||||
@@ -31,6 +31,7 @@ struct nxt_unit_request_s {
|
||||
uint32_t content_length_field;
|
||||
uint32_t content_type_field;
|
||||
uint32_t cookie_field;
|
||||
uint32_t authorization_field;
|
||||
|
||||
uint64_t content_length;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user