aboutsummaryrefslogtreecommitdiffstats
path: root/src/config/headers.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-30 11:16:55 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-30 11:16:55 +0000
commit1c5f682f4dcbca5afa9dd4a9688bde40efaeb12c (patch)
tree9c5ac88f1c430686d45de44ee36f29fe26be42b1 /src/config/headers.c
parentad88c5ec68b1cfd47017face422132ab8c7b2874 (diff)
downloadtipidee-1c5f682f4dcbca5afa9dd4a9688bde40efaeb12c.tar.gz
Revamp (and hopefully fix) resattr management
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/config/headers.c')
-rw-r--r--src/config/headers.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/config/headers.c b/src/config/headers.c
index 31d3e69..4fcdf7d 100644
--- a/src/config/headers.c
+++ b/src/config/headers.c
@@ -25,11 +25,8 @@ static struct builtinheaders_s const builtinheaders[] =
{ .key = "Allow", .value = 0, .overridable = 0 },
{ .key = "Cache-Control", .value = "private", .overridable = 1 },
{ .key = "Connection", .value = 0, .overridable = 0 },
- { .key = "Content-Length", .value = 0, .overridable = 0 },
{ .key = "Content-Security-Policy", .value = "default-src 'self'; style-src 'self' 'unsafe-inline';", .overridable = 1 },
- { .key = "Content-Type", .value = 0, .overridable = 0 },
{ .key = "Date", .value = 0, .overridable = 0 },
- { .key = "Location", .value = 0, .overridable = 0 },
{ .key = "Referrer-Policy", .value = "no-referrer-when-downgrade", .overridable = 1 },
{ .key = "Server", .value = "tipidee/" TIPIDEE_VERSION, .overridable = 0 },
{ .key = "Status", .value = 0, .overridable = 0 },
@@ -49,7 +46,15 @@ static repo headers = \
int header_allowed (char const *key)
{
- struct builtinheaders_s const *p = BSEARCH(struct builtinheaders_s, key, builtinheaders) ;
+ static char const *const nope[] =
+ {
+ "Content-Length",
+ "Content-Type",
+ "Location"
+ } ;
+ struct builtinheaders_s const *p ;
+ if (BSEARCH(char const *, key, nope)) return 0 ;
+ p = BSEARCH(struct builtinheaders_s, key, builtinheaders) ;
return !p || p->overridable ;
}