diff options
author | Omar Polo <op@omarpolo.com> | 2023-07-23 18:45:05 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-07-23 18:45:05 +0000 |
commit | a1ba9650a9f0cc0d9e70800d71769d32f927b939 (patch) | |
tree | 4ce8a9b5e4cd3aff8a41d4cd67c15f7c07774b17 /server.c | |
parent | f36ba9be59c1b60aff4b9663f49d8656800afa00 (diff) |
revamp fastcgi configuration: make it per-location
this revamps the syntax in the configuration to better match httpd(8)
(and in general be less weird) and to allow per-location fastcgi
configurations.
the bare `param' is now deprecated, but for compatibility it acts
like `fastcgi param' would do now. Same story for `fastcgi <pathÂ>'.
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -243,23 +243,23 @@ vhost_block_return(struct vhost *v, const char *path, int *code, const char **fm return loc->block_code != 0; } -int +struct location * vhost_fastcgi(struct vhost *v, const char *path) { struct location *loc; if (v == NULL || path == NULL) - return -1; + return NULL; loc = TAILQ_FIRST(&v->locations); while ((loc = TAILQ_NEXT(loc, locations)) != NULL) { if (loc->fcgi != -1) if (matches(loc->match, path)) - return loc->fcgi; + return loc; } loc = TAILQ_FIRST(&v->locations); - return loc->fcgi; + return loc->fcgi == -1 ? NULL : loc; } int @@ -705,20 +705,21 @@ fcgi_open_conn(struct fcgi *f) static int apply_fastcgi(struct client *c) { - int id, i = 0; + int i = 0; struct fcgi *f; + struct location *loc; - if ((id = vhost_fastcgi(c->host, c->iri.path)) == -1) + if ((loc = vhost_fastcgi(c->host, c->iri.path)) == NULL) return 0; TAILQ_FOREACH(f, &c->conf->fcgi, fcgi) { - if (i == id) + if (i == loc->fcgi) break; ++i; } if (f == NULL) { - log_warnx("can't find fcgi #%d", id); + log_warnx("can't find fcgi #%d", loc->fcgi); return 0; } @@ -745,7 +746,7 @@ apply_fastcgi(struct client *c) } bufferevent_enable(c->cgibev, EV_READ|EV_WRITE); - fcgi_req(c); + fcgi_req(c, loc); return 1; } |