mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-15 15:26:03 -05:00
Fix tests
This commit is contained in:
parent
f7ef338ab9
commit
c4cd66c088
6 changed files with 16 additions and 8 deletions
|
|
@ -1,10 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
echo sse_server 1>&2
|
||||||
PORT=8082
|
PORT=8082
|
||||||
|
|
||||||
./sse_server.exe -p $PORT &
|
./sse_server.exe -p $PORT &
|
||||||
|
PID=$!
|
||||||
|
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
./sse_client.exe -p $PORT --alarm=1 /count | tr -d '\r' || true
|
./sse_client.exe -p $PORT --alarm=1 /count | tr -d '\r' || true
|
||||||
|
|
||||||
kill %1
|
kill $PID
|
||||||
echo "success"
|
echo "success"
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,6 @@ let date_of_time (f:float) : string =
|
||||||
let serve ~config (dir:string) : _ result =
|
let serve ~config (dir:string) : _ result =
|
||||||
let server =
|
let server =
|
||||||
S.create ~max_connections:config.j
|
S.create ~max_connections:config.j
|
||||||
~max_keep_alive:config.max_keep_alive
|
|
||||||
~addr:config.addr ~port:config.port () in
|
~addr:config.addr ~port:config.port () in
|
||||||
Printf.printf "serve directory %s on http://%(%s%):%d\n%!"
|
Printf.printf "serve directory %s on http://%(%s%):%d\n%!"
|
||||||
dir (if S.is_ipv6 server then "[%s]" else "%s") config.addr config.port;
|
dir (if S.is_ipv6 server then "[%s]" else "%s") config.addr config.port;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
echo download_chunked 1>&2
|
||||||
|
|
||||||
SERVER=$1
|
SERVER=$1
|
||||||
PORT=8084
|
PORT=8084
|
||||||
"$SERVER" . -p $PORT &
|
"$SERVER" . -p $PORT &
|
||||||
|
PID=$!
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
|
|
||||||
curl -N "http://localhost:${PORT}/foo_50" -o data2 \
|
curl -N "http://localhost:${PORT}/foo_50" -o data2 \
|
||||||
-H 'Tranfer-encoding: chunked'
|
-H 'Tranfer-encoding: chunked'
|
||||||
|
|
||||||
kill %1
|
kill $PID
|
||||||
wc data2
|
wc data2
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
echo echo1 1>&2
|
||||||
|
|
||||||
ECHO=$1
|
ECHO=$1
|
||||||
PORT=8085
|
PORT=8085
|
||||||
|
|
||||||
"$ECHO" -p $PORT &
|
"$ECHO" -p $PORT &
|
||||||
|
PID=$!
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
curl -N "http://localhost:${PORT}/echo/?a=b&c=d" -H user-agent:test
|
curl -N "http://localhost:${PORT}/echo/?a=b&c=d" -H user-agent:test
|
||||||
kill %1
|
kill $PID
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
echo see_count 1>&2
|
||||||
|
|
||||||
SSE_SERVER=$1
|
SSE_SERVER=$1
|
||||||
PORT=8086
|
PORT=8086
|
||||||
|
|
||||||
"$SSE_SERVER" -p $PORT &
|
"$SSE_SERVER" -p $PORT &
|
||||||
|
PID=$!
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
|
|
||||||
curl -N "http://localhost:${PORT}/count/10" -H user-agent:test
|
curl -N "http://localhost:${PORT}/count/10" -H user-agent:test
|
||||||
kill %1
|
kill $PID
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
echo upload_chunked 1>&2
|
||||||
|
|
||||||
rm data
|
rm data
|
||||||
|
|
||||||
|
|
@ -6,10 +7,11 @@ SERVER=$1
|
||||||
PORT=8087
|
PORT=8087
|
||||||
|
|
||||||
"$SERVER" . -p $PORT --upload --max-upload 100000000000 &
|
"$SERVER" . -p $PORT --upload --max-upload 100000000000 &
|
||||||
|
PID=$!
|
||||||
|
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
|
|
||||||
cat foo_50 | curl -N -X PUT http://localhost:$PORT/data --data-binary @- -H 'Transfer-Encoding: chunked'
|
cat foo_50 | curl -N -X PUT http://localhost:$PORT/data --data-binary @- -H 'Transfer-Encoding: chunked'
|
||||||
|
|
||||||
kill %1
|
kill $PID
|
||||||
wc data
|
wc data
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue