Add (failing) CGI test, break some broken env code

This commit is contained in:
Neale Pickett 2012-03-09 10:51:29 -07:00
parent ef5bf33e3e
commit e991c1f24f
2 changed files with 13 additions and 7 deletions

16
eris.c
View File

@ -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);
}
}

View File

@ -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"