From 7066acb2ce438526fb0d60df443320d1c8366760 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 9 Apr 2022 21:27:12 +0200 Subject: 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 , which cannot be an empty string. However, the current RFC 7231 allows the Location to be a relative URI , and a relative URI may be an empty string . 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} --- src/nxt_http.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nxt_http.h') diff --git a/src/nxt_http.h b/src/nxt_http.h index 7cef1345..36bc089d 100644 --- a/src/nxt_http.h +++ b/src/nxt_http.h @@ -206,7 +206,7 @@ typedef struct nxt_http_route_addr_rule_s nxt_http_route_addr_rule_t; typedef struct { nxt_conf_value_t *pass; nxt_conf_value_t *ret; - nxt_str_t location; + nxt_conf_value_t *location; nxt_conf_value_t *proxy; nxt_conf_value_t *share; nxt_str_t chroot; -- cgit