improve fcgi test: send more than one chunk of data

This commit is contained in:
Omar Polo 2023-07-01 18:38:22 +00:00
parent 0f7fdd2105
commit 2247b66842
2 changed files with 13 additions and 4 deletions

View File

@ -167,9 +167,6 @@ main(int argc, char **argv)
size_t len;
int ch, sock, s;
msg = "20 text/gemini\r\n# hello from fastcgi!\n";
len = strlen(msg);
while ((ch = getopt(argc, argv, "")) != -1)
errx(1, "wrong usage");
argc -= optind;
@ -221,6 +218,16 @@ main(int argc, char **argv)
assert_record(s, FCGI_STDIN);
msg = "20 text/gemini\r\n# hello from fastcgi!\n";
len = strlen(msg);
prepare_header(&hdr, FCGI_STDOUT, 1, len, 0);
must_write(s, &hdr, sizeof(hdr));
must_write(s, msg, len);
msg = "some more content in the page...\n";
len = strlen(msg);
prepare_header(&hdr, FCGI_STDOUT, 1, len, 0);
must_write(s, &hdr, sizeof(hdr));
must_write(s, msg, len);

View File

@ -220,10 +220,12 @@ test_fastcgi() {
setup_simple_test 'prefork 1' 'fastcgi "'$PWD'/fcgi.sock"'
msg=$(printf "# hello from fastcgi!\nsome more content in the page...")
i=0
while [ $i -lt 10 ]; do
fetch /
check_reply "20 text/gemini" "# hello from fastcgi!"
check_reply "20 text/gemini" "$msg"
if [ $? -ne 0 ]; then
kill $fcgi_pid
return 1