summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_php_sapi.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2019-02-28 20:20:41 +0300
committerValentin Bartenev <vbart@nginx.com>2019-02-28 20:20:41 +0300
commita5dd0f8aa9b81921ff28c486a39fd46607dbdbd9 (patch)
treeb4977f8e3efab694a10be83d1c09c673452d27a4 /src/nxt_php_sapi.c
parent7ce6f0597543baee4275e8d66567d08f2ddaf48b (diff)
downloadunit-a5dd0f8aa9b81921ff28c486a39fd46607dbdbd9.tar.gz
unit-a5dd0f8aa9b81921ff28c486a39fd46607dbdbd9.tar.bz2
Made QUERY_STRING mandatory.
According to CGI/1.1 RFC 3875: The server MUST set this variable; if the Script-URI does not include a query component, the QUERY_STRING MUST be defined as an empty string (""). Python's PEP 333(3) allows omitting it in WSGI interface; PHP docs force no requirements; PSGI and Rack specifications require it even if empty. When nginx proxies requests over FastCGI, it always provides QUERY_STRING. and some PHP apps have been observed to fail if it is missing (see issue #201 on GitHub). A drawback of this change (besides a small overhead) is that there will be no easy way to tell a missing query string from an empty one (i.e. requests with or without the "?" character); yet, it's negligible compared to the possible benefits of wider application compatibility. This closes #226 issue on GitHub.
Diffstat (limited to 'src/nxt_php_sapi.c')
-rw-r--r--src/nxt_php_sapi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index e36dd20a..80321a85 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -917,10 +917,8 @@ nxt_php_register_variables(zval *track_vars_array TSRMLS_DC)
track_vars_array TSRMLS_CC);
nxt_php_set_sptr(req, "REQUEST_URI", &r->target, r->target_length,
track_vars_array TSRMLS_CC);
- if (r->query.offset) {
- nxt_php_set_sptr(req, "QUERY_STRING", &r->query, r->query_length,
- track_vars_array TSRMLS_CC);
- }
+ nxt_php_set_sptr(req, "QUERY_STRING", &r->query, r->query_length,
+ track_vars_array TSRMLS_CC);
nxt_php_set_sptr(req, "REMOTE_ADDR", &r->remote, r->remote_length,
track_vars_array TSRMLS_CC);