Merge pull request 'remove any query_string before chdir' (#4) from phoebos/vger:query_string_slashes into master
Reviewed-on: #4
This commit is contained in:
commit
8efcdb7512
17
main.c
17
main.c
|
@ -436,6 +436,16 @@ main(int argc, char **argv)
|
|||
estrlcat(tmp, dir, sizeof(tmp));
|
||||
estrlcpy(dir, tmp, sizeof(dir));
|
||||
}
|
||||
|
||||
/* remove a query string before percent decoding */
|
||||
/* look for "?" if any to set query for cgi, remove it */
|
||||
pos = strchr(dir, '?');
|
||||
if (pos != NULL) {
|
||||
estrlcpy(query, pos + 1, sizeof(query));
|
||||
uridecode(query);
|
||||
pos[0] = '\0';
|
||||
}
|
||||
|
||||
/* percent decode */
|
||||
uridecode(dir);
|
||||
|
||||
|
@ -479,13 +489,8 @@ main(int argc, char **argv)
|
|||
esetenv("SERVER_PROTOCOL", "GEMINI", 1);
|
||||
esetenv("SERVER_SOFTWARE", "vger/1", 1);
|
||||
|
||||
/* look for "?" if any to set query for cgi, remove it */
|
||||
pos = strchr(file, '?');
|
||||
if (pos != NULL) {
|
||||
estrlcpy(query, pos + 1, sizeof(query));
|
||||
if (*query)
|
||||
esetenv("QUERY_STRING", query, 1);
|
||||
pos[0] = '\0';
|
||||
}
|
||||
/* look for an extension to find PATH_INFO */
|
||||
pos = strrchr(file, '.');
|
||||
if (pos != NULL) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user