From 7b31a6386d6f80a3dd79af7d56bbf48b6eb7a264 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Sun, 24 Jan 2021 10:24:34 +0000 Subject: [PATCH] test CGI with big files --- regress/Makefile | 2 +- regress/runtime | 7 +++++++ regress/serve-bigfile | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 regress/serve-bigfile diff --git a/regress/Makefile b/regress/Makefile index a7b693c..195cb0d 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -33,7 +33,7 @@ testdata: fill-file ./sha testdata/bigfile testdata/bigfile.sha printf "# hello world\n" > testdata/index.gmi ./sha testdata/index.gmi testdata/index.gmi.sha - cp hello slow err invalid testdata/ + cp hello slow err invalid serve-bigfile testdata/ mkdir testdata/dir cp testdata/index.gmi testdata/dir/foo.gmi diff --git a/regress/runtime b/regress/runtime index 6e62029..6456746 100755 --- a/regress/runtime +++ b/regress/runtime @@ -171,6 +171,13 @@ echo OK GET /err with cgi eq "$(raw /invalid | wc -c | xargs)" 2048 "Unexpected body for /invalid" echo OK GET /invalid with cgi +# try a big file +eq "$(head /serve-bigfile)" "20 application/octet-stream" "Unexpected head for /serve-bigfile" +get /bigfile > bigfile +./sha bigfile bigfile.sha +eq "$(cat bigfile.sha)" "$(cat testdata/bigfile.sha)" "Unexpected sha for /serve-bigfile" +echo OK GET /serve-bigfile with cgi + check "should be running" quit diff --git a/regress/serve-bigfile b/regress/serve-bigfile new file mode 100644 index 0000000..56fb488 --- /dev/null +++ b/regress/serve-bigfile @@ -0,0 +1,5 @@ +#!/bin/sh + +printf "20 application/octet-stream\r\n" + +exec cat bigfile