summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_route.c
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-04-09 21:27:12 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-16 12:57:37 +0200
commit7066acb2ce438526fb0d60df443320d1c8366760 (patch)
treeb92a91609a0400c97e6d2ad515cfff93241b13bf /src/nxt_http_route.c
parentbc639b50d18112ec5e24157a2d69beff6231a9fd (diff)
downloadunit-7066acb2ce438526fb0d60df443320d1c8366760.tar.gz
unit-7066acb2ce438526fb0d60df443320d1c8366760.tar.bz2
Supporting empty Location URIs.
An empty string in Location was being handled specially by not sending a Location header. This may occur after variable resolution, so we need to consider this scenario. The obsolete RFC 2616 defined the Location header as consisting of an absolute URI <https://www.rfc-editor.org/rfc/rfc2616#section-14.30>, which cannot be an empty string. However, the current RFC 7231 allows the Location to be a relative URI <https://www.rfc-editor.org/rfc/rfc7231#section-7.1.2>, and a relative URI may be an empty string <https://stackoverflow.com/a/43338457>. Due to these considerations, this patch allows sending an empty Location header without handling this case specially. This behavior will probably be more straightforward to users, too. It also simplifies the code, which is now more readable, fast, and conformant to the current RFC. We're skipping an allocation at request time in a common case such as "action": {"return": 404}
Diffstat (limited to 'src/nxt_http_route.c')
-rw-r--r--src/nxt_http_route.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nxt_http_route.c b/src/nxt_http_route.c
index c2321906..af28400d 100644
--- a/src/nxt_http_route.c
+++ b/src/nxt_http_route.c
@@ -626,7 +626,7 @@ static nxt_conf_map_t nxt_http_route_action_conf[] = {
},
{
nxt_string("location"),
- NXT_CONF_MAP_STR,
+ NXT_CONF_MAP_PTR,
offsetof(nxt_http_action_conf_t, location)
},
{