Files
nginx-unit/src
Alejandro Colomar 9bf614cd08 Var: Added $request_uri (as in NGINX).
This supports a new variable $request_uri that contains the path
and the query (See RFC 3986, section 3).  Its contents are percent
encoded.  This is useful for example to redirect HTTP to HTTPS:

{
    "return": "301",
    "location": "https://$host$request_uri"
}

When <http://example.com/foo%23bar?baz> is requested, the server
redirects to <https://example.com/foo%23bar?baz>.

===

Testing:

//diff --git a/src/nxt_http_return.c b/src/nxt_http_return.c
//index 82c9156..adeb3a1 100644
//--- a/src/nxt_http_return.c
//+++ b/src/nxt_http_return.c
//@@ -196,6 +196,7 @@ nxt_http_return_send_ready(nxt_task_t *task,
    void *obj, void *data)
//         field->value = ctx->encoded.start;
//         field->value_length = ctx->encoded.length;
//     }
//+    fprintf(stderr, "ALX: target[%1$i]: <%2$.*1$s>\n",
    (int)r->target.length, r->target.start);
//
//     r->state = &nxt_http_return_send_state;
//

{
	"listeners": {
		"*:81": {
			"pass": "routes/ru"
		}
	},

	"routes": {
		"ru": [{
			"action": {
				"return": 301,
				"location": "$request_uri"
			}
		}]
	}
}

$ curl -i http://localhost:81/*foo%2Abar?baz#arg
HTTP/1.1 301 Moved Permanently
Location: /*foo%2Abar?baz
Server: Unit/1.27.0
Date: Mon, 30 May 2022 16:04:30 GMT
Content-Length: 0

$ sudo cat /usr/local/unit.log | grep ALX
ALX: target[15]: </*foo%2Abar?baz>
2022-05-31 12:40:02 +02:00
..
2022-04-26 12:38:48 +02:00
2022-04-26 12:38:48 +02:00
2022-05-03 12:11:14 +02:00
2020-08-13 02:46:54 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2021-08-03 13:59:27 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2020-05-28 14:57:41 +01:00
2020-05-28 14:57:41 +01:00
2020-03-09 16:28:25 +00:00
2022-05-03 12:11:14 +02:00
2022-04-26 12:38:48 +02:00
2020-09-16 17:52:53 +01:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2018-06-25 16:51:47 +03:00
2022-05-03 12:11:14 +02:00
2021-08-03 13:59:27 +03:00
2022-05-03 12:11:14 +02:00
2017-01-23 19:56:03 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-04-26 12:38:48 +02:00
2022-04-26 12:38:48 +02:00
2017-01-17 20:00:00 +03:00
2019-03-11 17:31:59 +03:00
2022-05-03 12:11:14 +02:00
2019-11-14 16:39:54 +03:00
2022-05-03 12:11:14 +02:00
2021-08-03 13:59:27 +03:00
2017-08-28 10:20:40 +03:00
2019-03-11 17:31:59 +03:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2021-03-24 08:05:07 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-04-26 12:38:48 +02:00
2020-08-13 02:46:54 +03:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-03-09 18:03:27 +03:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-04-26 12:38:48 +02:00
2020-08-13 02:46:54 +03:00
2017-01-17 20:00:00 +03:00
2017-01-17 20:00:00 +03:00
2019-03-11 17:31:59 +03:00
2021-11-24 13:11:48 +03:00
2017-03-14 19:03:49 +03:00
2021-11-24 13:11:48 +03:00
2021-11-24 13:11:48 +03:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2017-01-17 20:00:00 +03:00
2017-01-17 20:00:00 +03:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-27 11:35:11 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-04-26 12:38:48 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2019-03-11 17:31:59 +03:00
2018-06-25 16:51:47 +03:00
2019-03-11 17:31:59 +03:00
2019-11-14 16:39:54 +03:00
2018-08-06 17:27:33 +03:00
2018-08-06 17:27:33 +03:00
2022-04-26 12:38:48 +02:00
2022-05-03 12:11:14 +02:00
2020-03-06 18:28:54 +03:00
2022-05-03 12:11:14 +02:00
2019-10-10 19:42:41 +03:00
2018-02-07 15:34:42 +03:00
2022-05-03 12:11:14 +02:00