-/* $OpenBSD: config.c,v 1.7 2014/07/30 13:49:48 reyk Exp $ */
+/* $OpenBSD: config.c,v 1.8 2014/07/31 09:34:57 reyk Exp $ */
/*
* Copyright (c) 2011 - 2014 Reyk Floeter <reyk@openbsd.org>
sizeof(srv_conf->docroot));
}
+ f = SRVFLAG_FCGI|SRVFLAG_NO_FCGI;
+ if ((srv_conf->flags & f) == 0)
+ srv_conf->flags |= srv->srv_conf.flags & f;
+
DPRINTF("%s: %s %d received location \"%s\", parent \"%s\"",
__func__, ps->ps_title[privsep_process], ps->ps_instance,
srv_conf->location, srv->srv_conf.name);
-.\" $OpenBSD: httpd.conf.5,v 1.10 2014/07/30 10:05:14 reyk Exp $
+.\" $OpenBSD: httpd.conf.5,v 1.11 2014/07/31 09:34:57 reyk Exp $
.\"
.\" Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 30 2014 $
+.Dd $Mdocdate: July 31 2014 $
.Dt HTTPD.CONF 5
.Os
.Sh NAME
Disable the directory index.
.Nm httpd
will neither display nor generate a directory index.
+.It Oo Ic no Oc Ic fastcgi
+Enable FastCGI instead of serving files.
.It Ic listen on Ar address Ic port Ar number
Set the listen address and port.
.It Ic location Ar path { ... }
-/* $OpenBSD: httpd.h,v 1.20 2014/07/31 09:23:53 florian Exp $ */
+/* $OpenBSD: httpd.h,v 1.21 2014/07/31 09:34:57 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
#define SRVFLAG_NO_AUTO_INDEX 0x08
#define SRVFLAG_DOCROOT 0x10
#define SRVFLAG_LOCATION 0x20
+#define SRVFLAG_FCGI 0x40
+#define SRVFLAG_NO_FCGI 0x80
#define SRVFLAG_BITS \
- "\10\01INDEX\02NO_INDEX\03AUTO_INDEX\04NO_AUTO_INDEX\05LOCATION"
+ "\10\01INDEX\02NO_INDEX\03AUTO_INDEX\04NO_AUTO_INDEX" \
+ "\05LOCATION\06FCGI\07NO_FCGI"
#define TCPFLAG_NODELAY 0x01
#define TCPFLAG_NNODELAY 0x02
-/* $OpenBSD: parse.y,v 1.10 2014/07/30 13:49:48 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.11 2014/07/31 09:34:57 reyk Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
%}
-%token ALL AUTO DIRECTORY INDEX LISTEN LOCATION LOG NO ON PORT PREFORK ROOT
-%token SERVER TYPES UPDATES VERBOSE
+%token ALL AUTO DIRECTORY FCGI INDEX LISTEN LOCATION LOG NO ON PORT
+%token PREFORK ROOT SERVER TYPES UPDATES VERBOSE
%token ERROR INCLUDE
%token <v.string> STRING
%token <v.number> NUMBER
}
| DIRECTORY dirflags
| DIRECTORY '{' dirflags_l '}'
+ | NO FCGI {
+ srv->srv_conf.flags &= ~SRVFLAG_FCGI;
+ srv->srv_conf.flags |= SRVFLAG_NO_FCGI;
+ }
+ | FCGI {
+ srv->srv_conf.flags &= ~SRVFLAG_NO_FCGI;
+ srv->srv_conf.flags |= SRVFLAG_FCGI;
+ }
| LOCATION STRING {
struct server *s;
{ "all", ALL },
{ "auto", AUTO },
{ "directory", DIRECTORY },
+ { "fastcgi", FCGI },
{ "include", INCLUDE },
{ "index", INDEX },
{ "listen", LISTEN },
-/* $OpenBSD: server_http.c,v 1.22 2014/07/31 09:23:53 florian Exp $ */
+/* $OpenBSD: server_http.c,v 1.23 2014/07/31 09:34:57 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
fnmatch(location->location, desc->http_path,
FNM_CASEFOLD) == 0) {
/* Replace host configuration */
- clt->clt_srv_conf = location;
- srv_conf = NULL;
+ clt->clt_srv_conf = srv_conf = location;
break;
}
}
- if (strlen(desc->http_path) > strlen("/cgi-bin/") &&
- strncmp("/cgi-bin/", desc->http_path, strlen("/cgi-bin/")) == 0) {
- if ((ret = server_fcgi(httpd, clt)) == -1)
- return (-1);
- } else if ((ret = server_file(httpd, clt)) == -1)
- return (-1);
+ if (srv_conf->flags & SRVFLAG_FCGI)
+ ret = server_fcgi(httpd, clt);
+ else
+ ret = server_file(httpd, clt);
+ if (ret == -1)
+ return (ret);
server_reset_http(clt);