|| fputs("wibble wibble\r\nspong", fp) < 0 /* ensure CONTENT_LENGTH
* honored */
|| fflush(fp) < 0)
- fatal(errno, "writing to temporary file");
+ disorder_fatal(errno, "writing to temporary file");
rewind(fp);
xdup2(fileno(fp), 0);
lseek(0, 0/*offset*/, SEEK_SET);
}
static void test_cgi(void) {
- struct dynstr d[1];
setenv("REQUEST_METHOD", "GET", 1);
setenv("QUERY_STRING", "foo=bar&a=b+c&c=x%7ey", 1);
check_string(cgi_sgmlquote("\"&\""), ""&"");
check_string(cgi_sgmlquote("\xC2\xA3"), "£");
- dynstr_init(d);
- cgi_opentag(sink_dynstr(d), "element",
- "foo", "bar",
- "foo", "has space",
- "foo", "has \"quotes\"",
- (char *)NULL);
- dynstr_terminate(d);
- check_string(d->vec, "<element foo=bar foo=\"has space\" foo=\"has "quotes"\">");
-
- dynstr_init(d);
- cgi_opentag(sink_dynstr(d), "element",
- "foo", (char *)NULL,
- (char *)NULL);
- dynstr_terminate(d);
- check_string(d->vec, "<element foo>");
-
- dynstr_init(d);
- cgi_closetag(sink_dynstr(d), "element");
- dynstr_terminate(d);
- check_string(d->vec, "</element>");
-
check_string(cgi_makeurl("http://example.com/", (char *)NULL),
"http://example.com/");
check_string(cgi_makeurl("http://example.com/",