mirror of https://github.com/omar-polo/gmid.git
improve fcgi test: send more than one chunk of data
This commit is contained in:
parent
0f7fdd2105
commit
2247b66842
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue