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;
|
size_t len;
|
||||||
int ch, sock, s;
|
int ch, sock, s;
|
||||||
|
|
||||||
msg = "20 text/gemini\r\n# hello from fastcgi!\n";
|
|
||||||
len = strlen(msg);
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "")) != -1)
|
while ((ch = getopt(argc, argv, "")) != -1)
|
||||||
errx(1, "wrong usage");
|
errx(1, "wrong usage");
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
|
@ -221,6 +218,16 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
assert_record(s, FCGI_STDIN);
|
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);
|
prepare_header(&hdr, FCGI_STDOUT, 1, len, 0);
|
||||||
must_write(s, &hdr, sizeof(hdr));
|
must_write(s, &hdr, sizeof(hdr));
|
||||||
must_write(s, msg, len);
|
must_write(s, msg, len);
|
||||||
|
|
|
@ -220,10 +220,12 @@ test_fastcgi() {
|
||||||
|
|
||||||
setup_simple_test 'prefork 1' 'fastcgi "'$PWD'/fcgi.sock"'
|
setup_simple_test 'prefork 1' 'fastcgi "'$PWD'/fcgi.sock"'
|
||||||
|
|
||||||
|
msg=$(printf "# hello from fastcgi!\nsome more content in the page...")
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt 10 ]; do
|
while [ $i -lt 10 ]; do
|
||||||
fetch /
|
fetch /
|
||||||
check_reply "20 text/gemini" "# hello from fastcgi!"
|
check_reply "20 text/gemini" "$msg"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
kill $fcgi_pid
|
kill $fcgi_pid
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in New Issue