mirror of https://github.com/omar-polo/gmid.git
implement fastcgi strip number
This commit is contained in:
parent
4f7492c36e
commit
03d671e2aa
14
fcgi.c
14
fcgi.c
|
@ -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);
|
||||
|
|
|
@ -318,6 +318,10 @@ is interpreted as a hostname or an IP address.
|
|||
can be either a port number or the name of a service enclosed in
|
||||
double quotes.
|
||||
If not specified defaults to 9000.
|
||||
.It Ic strip Ar number
|
||||
Strip
|
||||
.Ar number
|
||||
leading path components from the
|
||||
.El
|
||||
.Pp
|
||||
The FastCGI handler will be given the following variables by default:
|
||||
|
|
1
gmid.h
1
gmid.h
|
@ -183,6 +183,7 @@ struct location {
|
|||
int disable_log;
|
||||
int fcgi;
|
||||
int nofcgi;
|
||||
int fcgi_strip;
|
||||
struct envhead params;
|
||||
|
||||
char dir[PATH_MAX];
|
||||
|
|
Loading…
Reference in New Issue