diff options
author | Omar Polo <op@omarpolo.com> | 2023-08-08 17:35:11 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-08-08 17:35:11 +0000 |
commit | 03d671e2aa44271e6feb5dc6b1f20f833735d917 (patch) | |
tree | 73779cef04bfa2f7e4e875e30a200f32c102ec9f /fcgi.c | |
parent | 4f7492c36e5ae600b0e0ad2b2d271712d55e34b9 (diff) |
implement fastcgi strip number
Diffstat (limited to 'fcgi.c')
-rw-r--r-- | fcgi.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -374,10 +374,9 @@ void fcgi_req(struct client *c, struct location *loc) { char buf[22], path[GEMINI_URL_LEN]; - char *qs, *pathinfo, *scriptname = NULL; + char *qs, *p, *pathinfo, *scriptname = NULL; size_t l; time_t tim; - int r; struct tm tminfo; struct envlist *p; @@ -390,12 +389,11 @@ fcgi_req(struct client *c, struct location *loc) if (scriptname == NULL) scriptname = ""; - r = snprintf(path, sizeof(path), "/%s", c->iri.path); - if (r < 0 || (size_t)r >= sizeof(c->iri.path)) { - log_warn("snprintf failure?"); - fcgi_error(c->cgibev, EVBUFFER_ERROR, c); - return; - } + p = strip_path(c->iri.path, loc->fcgi_strip); + if (*p != '/') + snprintf(path, sizeof(path), "/%s", p); + else + strlcpy(path, p, sizeof(path)); pathinfo = path; l = strlen(scriptname); |