Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
usr.sbin/httpd: inherit gzip-static in locations
To:
OpenBSD tech <tech@openbsd.org>
Cc:
job@openbsd.org
Date:
Sat, 09 May 2026 20:51:42 +0200

Download raw body.

Thread
tech@,

Location configuration inherited most server level options but dropped
gzip-static, so requests matching a location skipped static gzip lookup even
when the parent server enabled it.

Add an explicit no gzip-static state and inherit the gzip flag pair only
when the location has not set either form, preserving location specific
overrides.

Reported by: job@

Ok?

Index: config.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/httpd/config.c,v
diff -u -p -r1.69 config.c
--- config.c	2 Mar 2026 19:24:58 -0000	1.69
+++ config.c	8 May 2026 21:30:39 -0000
@@ -563,6 +563,10 @@ config_getserver_config(struct httpd *en
 		if ((srv_conf->flags & f) == 0)
 			srv_conf->flags |= parent->flags & f;
 
+		f = SRVFLAG_GZIP_STATIC|SRVFLAG_NO_GZIP_STATIC;
+		if ((srv_conf->flags & f) == 0)
+			srv_conf->flags |= parent->flags & f;
+
 		f = SRVFLAG_LOG|SRVFLAG_NO_LOG;
 		if ((srv_conf->flags & f) == 0) {
 			srv_conf->flags |= parent->flags & f;
Index: httpd.h
===================================================================
RCS file: /home/cvs/src/usr.sbin/httpd/httpd.h,v
diff -u -p -r1.169 httpd.h
--- httpd.h	2 Mar 2026 19:24:58 -0000	1.169
+++ httpd.h	8 May 2026 21:33:22 -0000
@@ -390,6 +390,7 @@ SPLAY_HEAD(client_tree, client);
 #define SRVFLAG_NO_PATH_REWRITE	0x02000000
 #define SRVFLAG_GZIP_STATIC	0x04000000
 #define SRVFLAG_NO_BANNER	0x08000000
+#define SRVFLAG_NO_GZIP_STATIC	0x10000000
 #define SRVFLAG_LOCATION_FOUND	0x40000000
 #define SRVFLAG_LOCATION_NOT_FOUND 0x80000000
 
@@ -399,8 +400,8 @@ SPLAY_HEAD(client_tree, client);
 	"\14SYSLOG\15NO_SYSLOG\16TLS\17ACCESS_LOG\20ERROR_LOG"		\
 	"\21AUTH\22NO_AUTH\23BLOCK\24NO_BLOCK\25LOCATION_MATCH"		\
 	"\26SERVER_MATCH\27SERVER_HSTS\30DEFAULT_TYPE\31PATH_REWRITE"	\
-	"\32NO_PATH_REWRITE\34NO_BANNER\33GZIP_STATIC\37LOCATION_FOUND"	\
-	"\40LOCATION_NOT_FOUND"
+	"\32NO_PATH_REWRITE\34NO_BANNER\33GZIP_STATIC"			\
+	"\35NO_GZIP_STATIC\37LOCATION_FOUND\40LOCATION_NOT_FOUND"
 
 #define TCPFLAG_NODELAY		0x01
 #define TCPFLAG_NNODELAY	0x02
Index: parse.y
===================================================================
RCS file: /home/cvs/src/usr.sbin/httpd/parse.y,v
diff -u -p -r1.131 parse.y
--- parse.y	2 Mar 2026 19:24:58 -0000	1.131
+++ parse.y	8 May 2026 21:30:39 -0000
@@ -1244,9 +1244,11 @@ fcgiport	: NUMBER		{
 
 gzip_static	: NO GZIPSTATIC		{
 			srv->srv_conf.flags &= ~SRVFLAG_GZIP_STATIC;
+			srv->srv_conf.flags |= SRVFLAG_NO_GZIP_STATIC;
 		}
 		| GZIPSTATIC		{
 			srv->srv_conf.flags |= SRVFLAG_GZIP_STATIC;
+			srv->srv_conf.flags &= ~SRVFLAG_NO_GZIP_STATIC;
 		}
 		;
 

-- 
wbr, Kirill