mirror of https://github.com/nealey/eris.git
Add (failing) CGI test, break some broken env code
This commit is contained in:
parent
ef5bf33e3e
commit
e991c1f24f
16
eris.c
16
eris.c
|
@ -75,9 +75,9 @@ int portappend = 0;
|
|||
/* Variables that persist between requests */
|
||||
int cwd;
|
||||
int keepalive = 0;
|
||||
char *remote_ip = NULL;
|
||||
char *remote_port = NULL;
|
||||
char *remote_ident = NULL;
|
||||
char remote_ip[60] = {0};
|
||||
char remote_port[10] = {0};
|
||||
char remote_ident[80] = {0};
|
||||
|
||||
/*
|
||||
* Things that are really super convenient to have globally.
|
||||
|
@ -205,6 +205,7 @@ get_ucspi_env()
|
|||
if (ucspi) {
|
||||
int protolen = strlen(ucspi);
|
||||
char buf[80];
|
||||
char *p;
|
||||
|
||||
if (protolen > 20) {
|
||||
return;
|
||||
|
@ -212,13 +213,16 @@ get_ucspi_env()
|
|||
strcpy(buf, ucspi);
|
||||
|
||||
strcpy(buf + protolen, "REMOTEIP");
|
||||
remote_ip = getenv(buf);
|
||||
p = getenv(buf);
|
||||
strncpy(remote_ip, p, sizeof remote_ip);
|
||||
|
||||
strcpy(buf + protolen, "REMOTEPORT");
|
||||
remote_port = getenv(buf);
|
||||
p = getenv(buf);
|
||||
strncpy(remote_port, p, sizeof remote_port);
|
||||
|
||||
strcpy(buf + protolen, "REMOTEINFO");
|
||||
remote_ident = getenv(buf);
|
||||
p = getenv(buf);
|
||||
strncpy(remote_ident, p, sizeof remote_ident);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
test.sh
4
test.sh
|
@ -166,8 +166,10 @@ printf 'POST /a.cgi HTTP/1.0\r\nContent-Type: moo\r\nContent-Length: 3\r\n\r\nar
|
|||
$HTTPD_CGI 2>/dev/null | d | grep -Eq '%CONTENT_LENGTH=.?3.?%CONTENT_TYPE=.?moo.?%' && pass || fail
|
||||
|
||||
title "PATH_INFO"
|
||||
printf 'GET /a.cgi/merf HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | grep -q '^PATH_INFO=/merf$' && pass || fail
|
||||
printf 'GET /a.cgi/merf HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | grep -Eq '^PATH_INFO=.?/merf.?$' && pass || fail
|
||||
|
||||
title "SERVER_PROTOCOL"
|
||||
printf 'GET /a.cgi HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | d | grep -Eq '%SERVER_PROTOCOL=.?HTTP/1.0[^#%]?%[^#%]' && pass || fail
|
||||
|
||||
|
||||
H "fnord bugs"
|
||||
|
|
Loading…
Reference in New Issue