summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2020-08-26 06:50:21 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2020-08-26 06:50:21 +0000
commit5b2a6d64a575c781a1a635bad5d6db5ca9b31d1e (patch)
tree4e9a60d6a8156d17a5de97176ce2bb32aa2cf94b /usr.sbin/httpd
parent8decadd71156cd36e4dd443c4b2ed7ec3c0160dd (diff)
Set fastcgi socket default on server and location.
This allows "fastcgi" directly inside of a server directive without giving specifying socket. OK tracey
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r--usr.sbin/httpd/config.c16
-rw-r--r--usr.sbin/httpd/httpd.h5
-rw-r--r--usr.sbin/httpd/parse.y23
3 files changed, 20 insertions, 24 deletions
diff --git a/usr.sbin/httpd/config.c b/usr.sbin/httpd/config.c
index 4136a2b6270..0db7b3d43fe 100644
--- a/usr.sbin/httpd/config.c
+++ b/usr.sbin/httpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.59 2020/08/24 15:49:10 tracey Exp $ */
+/* $OpenBSD: config.c,v 1.60 2020/08/26 06:50:20 florian Exp $ */
/*
* Copyright (c) 2011 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -496,20 +496,6 @@ config_getserver_config(struct httpd *env, struct server *srv,
if ((srv_conf->flags & f) == 0)
srv_conf->flags |= parent->flags & f;
- f = SRVFLAG_SOCKET|SRVFLAG_FCGI;
- if ((srv_conf->flags & f) == SRVFLAG_FCGI) {
- struct sockaddr_un *sun;
- sun = (struct sockaddr_un *) &srv_conf->fastcgi_ss;
-
- memset(sun, 0, sizeof(*sun));
- sun->sun_family = AF_UNIX;
- (void)strlcpy(sun->sun_path, HTTPD_FCGI_SOCKET,
- sizeof(sun->sun_path));
- srv_conf->fastcgi_ss.ss_len =
- sizeof(struct sockaddr_un);
- srv_conf->flags |= f;
- }
-
f = SRVFLAG_ROOT;
if ((srv_conf->flags & f) == 0) {
srv_conf->flags |= parent->flags & f;
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h
index 8d17b67319e..1d5746ac49f 100644
--- a/usr.sbin/httpd/httpd.h
+++ b/usr.sbin/httpd/httpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.h,v 1.150 2020/08/24 15:49:10 tracey Exp $ */
+/* $OpenBSD: httpd.h,v 1.151 2020/08/26 06:50:20 florian Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -376,7 +376,6 @@ SPLAY_HEAD(client_tree, client);
#define SRVFLAG_NO_FCGI 0x00000080
#define SRVFLAG_LOG 0x00000100
#define SRVFLAG_NO_LOG 0x00000200
-#define SRVFLAG_SOCKET 0x00000400
#define SRVFLAG_SYSLOG 0x00000800
#define SRVFLAG_NO_SYSLOG 0x00001000
#define SRVFLAG_TLS 0x00002000
@@ -395,7 +394,7 @@ SPLAY_HEAD(client_tree, client);
#define SRVFLAG_BITS \
"\10\01INDEX\02NO_INDEX\03AUTO_INDEX\04NO_AUTO_INDEX" \
- "\05ROOT\06LOCATION\07FCGI\10NO_FCGI\11LOG\12NO_LOG\13SOCKET" \
+ "\05ROOT\06LOCATION\07FCGI\10NO_FCGI\11LOG\12NO_LOGT" \
"\14SYSLOG\15NO_SYSLOG\16TLS\17ACCESS_LOG\20ERROR_LOG" \
"\21AUTH\22NO_AUTH\23BLOCK\24NO_BLOCK\25LOCATION_MATCH" \
"\26SERVER_MATCH\27SERVER_HSTS\30DEFAULT_TYPE\31PATH\32NO_PATH"
diff --git a/usr.sbin/httpd/parse.y b/usr.sbin/httpd/parse.y
index 0103002b342..6b911ad4f88 100644
--- a/usr.sbin/httpd/parse.y
+++ b/usr.sbin/httpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.116 2020/08/25 13:50:40 tracey Exp $ */
+/* $OpenBSD: parse.y,v 1.117 2020/08/26 06:50:20 florian Exp $ */
/*
* Copyright (c) 2007 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -224,7 +224,8 @@ main : PREFORK NUMBER {
;
server : SERVER optmatch STRING {
- struct server *s;
+ struct server *s;
+ struct sockaddr_un *sun;
if (!loadcfg) {
free($3);
@@ -281,6 +282,12 @@ server : SERVER optmatch STRING {
HTTPD_TLS_ECDHE_CURVES,
sizeof(s->srv_conf.tls_ecdhe_curves));
+ sun = (struct sockaddr_un *)&s->srv_conf.fastcgi_ss;
+ sun->sun_family = AF_UNIX;
+ (void)strlcpy(sun->sun_path, HTTPD_FCGI_SOCKET,
+ sizeof(sun->sun_path));
+ sun->sun_len = sizeof(struct sockaddr_un);
+
s->srv_conf.hsts_max_age = SERVER_HSTS_DEFAULT_AGE;
if (last_server_id == INT_MAX) {
@@ -500,7 +507,8 @@ serveroptsl : LISTEN ON STRING opttls port {
| authenticate
| filter
| LOCATION optmatch STRING {
- struct server *s;
+ struct server *s;
+ struct sockaddr_un *sun;
if (srv->srv_conf.ss.ss_family == AF_UNSPEC) {
yyerror("listen address not specified");
@@ -540,6 +548,12 @@ serveroptsl : LISTEN ON STRING opttls port {
YYERROR;
}
+ sun = (struct sockaddr_un *)&s->srv_conf.fastcgi_ss;
+ sun->sun_family = AF_UNIX;
+ (void)strlcpy(sun->sun_path, HTTPD_FCGI_SOCKET,
+ sizeof(sun->sun_path));
+ sun->sun_len = sizeof(struct sockaddr_un);
+
s->srv_conf.id = ++last_server_id;
/* A location entry uses the parent id */
s->srv_conf.parent_id = srv->srv_conf.id;
@@ -665,7 +679,6 @@ fcgiflags : SOCKET STRING {
srv_conf->fastcgi_ss.ss_len =
sizeof(struct sockaddr_un);
free($2);
- srv_conf->flags |= SRVFLAG_SOCKET;
}
| SOCKET TCP STRING {
if (get_fastcgi_dest(srv_conf, $3, FCGI_DEFAULT_PORT)
@@ -674,7 +687,6 @@ fcgiflags : SOCKET STRING {
YYERROR;
}
free($3);
- srv_conf->flags |= SRVFLAG_SOCKET;
}
| SOCKET TCP STRING fcgiport {
if (get_fastcgi_dest(srv_conf, $3, $4) == -1) {
@@ -684,7 +696,6 @@ fcgiflags : SOCKET STRING {
}
free($3);
free($4);
- srv_conf->flags |= SRVFLAG_SOCKET;
}
| PARAM STRING STRING {
struct fastcgi_param *param;