1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-12-04 14:46:37 -05:00

Disable HTTP response to HTTP GET/POST requests (#66)

This commit is contained in:
Augustin Fabre 2020-03-31 22:38:18 +02:00
parent 7b58f85a7f
commit d03d9b0930
No known key found for this signature in database
GPG Key ID: 99A01AA293FDA435
4 changed files with 7 additions and 2 deletions

View File

@ -58,6 +58,7 @@ much more. It is fully FOSS, and licensed under the BSD 2-Clause license.
-np Disable HAproxy proxy protocol
-nx Disable execution of gophermaps and scripts
-nu Disable personal gopherspaces
-nH Disable HTTP response to HTTP GET/POST requests.
-d Debug output in syslog and /server-status
-v Display version number and build date

View File

@ -475,6 +475,7 @@ void init_state(state *st)
st->opt_proxy = TRUE;
st->opt_exec = TRUE;
st->opt_personal_spaces = TRUE;
st->opt_http_requests = TRUE;
st->debug = FALSE;
/* Load default suffix -> filetype mappings */
@ -720,8 +721,9 @@ get_selector:
}
/* Convert HTTP request to gopher (respond using headerless HTTP/0.9) */
if (sstrncmp(selector, "GET ") == MATCH ||
sstrncmp(selector, "POST ") == MATCH ) {
if (st.opt_http_requests && (
sstrncmp(selector, "GET ") == MATCH ||
sstrncmp(selector, "POST ") == MATCH)) {
if ((c = strchr(selector, ' '))) sstrlcpy(selector, c + 1);
if ((c = strchr(selector, ' '))) *c = '\0';

View File

@ -369,6 +369,7 @@ typedef struct {
char opt_proxy;
char opt_exec;
char opt_personal_spaces;
char opt_http_requests;
char debug;
} state;

View File

@ -157,6 +157,7 @@ void parse_args(state *st, int argc, char *argv[])
if (*optarg == 'p') { st->opt_proxy = FALSE; break; }
if (*optarg == 'x') { st->opt_exec = FALSE; break; }
if (*optarg == 'u') { st->opt_personal_spaces = FALSE; break; }
if (*optarg == 'H') { st->opt_http_requests = FALSE; break; }
break;
case 'd': st->debug = TRUE; break;