mirror of https://github.com/omar-polo/gmid.git
add an implicit fastcgi parameter: GEMINI_SEARCH_STRING
it’s the QUERY_STRING decoded if it’s a search-string (i.e. not a key-value pair.) It’s useful for scripts to avoid percent-decoding the querystring in the most common case of a query, because in Gemini querystrings key-value paired are not common. Idea from a discussion with Allen Sobot.
This commit is contained in:
parent
77718c121f
commit
97b306cbee
9
fcgi.c
9
fcgi.c
|
@ -344,6 +344,7 @@ void
|
||||||
fcgi_req(struct client *c)
|
fcgi_req(struct client *c)
|
||||||
{
|
{
|
||||||
char addr[NI_MAXHOST], buf[22];
|
char addr[NI_MAXHOST], buf[22];
|
||||||
|
char *qs;
|
||||||
int e;
|
int e;
|
||||||
time_t tim;
|
time_t tim;
|
||||||
struct tm tminfo;
|
struct tm tminfo;
|
||||||
|
@ -368,6 +369,14 @@ fcgi_req(struct client *c)
|
||||||
fcgi_send_param(c->cgibev, "SERVER_PROTOCOL", "GEMINI");
|
fcgi_send_param(c->cgibev, "SERVER_PROTOCOL", "GEMINI");
|
||||||
fcgi_send_param(c->cgibev, "SERVER_SOFTWARE", GMID_VERSION);
|
fcgi_send_param(c->cgibev, "SERVER_SOFTWARE", GMID_VERSION);
|
||||||
|
|
||||||
|
if (*c->iri.query != '\0' &&
|
||||||
|
strchr(c->iri.query, '=') == NULL &&
|
||||||
|
(qs = strdup(c->iri.query)) != NULL) {
|
||||||
|
pct_decode_str(qs);
|
||||||
|
fcgi_send_param(c->cgibev, "GEMINI_SEARCH_STRING", qs);
|
||||||
|
free(qs);
|
||||||
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH(p, &c->host->params, envs) {
|
TAILQ_FOREACH(p, &c->host->params, envs) {
|
||||||
fcgi_send_param(c->cgibev, p->name, p->value);
|
fcgi_send_param(c->cgibev, p->name, p->value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,6 +286,12 @@ Full path to the FastCGI script being executed.
|
||||||
The full IRI of the request.
|
The full IRI of the request.
|
||||||
.It Ev GEMINI_URL_PATH
|
.It Ev GEMINI_URL_PATH
|
||||||
The path of the request.
|
The path of the request.
|
||||||
|
.It Ev GEMINI_SEARCH_STRING
|
||||||
|
The decoded
|
||||||
|
.Ev QUERY_STRING
|
||||||
|
if defined in the request and if it doesn't contain any unencoded
|
||||||
|
.Sq =
|
||||||
|
characters, otherwise unset.
|
||||||
.It Ev PATH_INFO
|
.It Ev PATH_INFO
|
||||||
The portion of the requested path that is derived from the the IRI
|
The portion of the requested path that is derived from the the IRI
|
||||||
path hierarchy following the part that identifies the script itself.
|
path hierarchy following the part that identifies the script itself.
|
||||||
|
|
Loading…
Reference in New Issue