diff options
author | Omar Polo <op@omarpolo.com> | 2023-07-01 18:38:22 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-07-01 18:38:22 +0000 |
commit | 2247b66842be7049e4dbfe099781bd3d2f69fbe9 (patch) | |
tree | 57000afd7395c1529ba5c901b92407dc9b819578 | |
parent | 0f7fdd21050e3795db896b99e542523c84e075d7 (diff) |
improve fcgi test: send more than one chunk of data
-rw-r--r-- | regress/fcgi-test.c | 13 | ||||
-rw-r--r-- | regress/tests.sh | 4 |
2 files changed, 13 insertions, 4 deletions
diff --git a/regress/fcgi-test.c b/regress/fcgi-test.c index fd7cec2..cbfb758 100644 --- a/regress/fcgi-test.c +++ b/regress/fcgi-test.c @@ -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); diff --git a/regress/tests.sh b/regress/tests.sh index 7250979..624b6d5 100644 --- a/regress/tests.sh +++ b/regress/tests.sh @@ -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 |