代码拉取完成,页面将自动刷新
同步操作将从 阿宝/threadtask 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
host=${host:-127.0.0.1}
port=${port:-5000}
file=${file:-Makefile}
times=${times:-0}
size=$(stat -c %s "$file")
function request() {
echo -e "\e[33m$1\e[0m" >&2
# connect
exec 8<>/dev/tcp/$host/$port
if [ $? -ne 0 ]; then
echo -e "\e[31mconnect to $host:$port failure\e[0m"
exit 1
fi
# request
echo -ne $2
echo -ne $2 >&8
if [ -n "$4" -a -f "$4" ]; then
cat $4
cat $4 >&8
fi
# response
if [ -z "$3" ]; then
cat <&8
echo
else
sleep $3
fi
# close input and output
exec 8<&-
exec 8>&-
}
function test_cases() {
request DISCON "GET / HTTP/1.0\r\n" 0
request OPTROOT "OPTIONS / HTTP/1.0\r\n\r\n"
request LISTHTML "GET / HTTP/1.0\r\n\r\n"
request LISTJSON "GET /?json HTTP/1.0\r\n\r\n"
request HELLO "GET /hello-json HTTP/1.0\r\n\r\n"
request NULL "GET /null HTTP/1.0\r\n\r\n"
request CHUNKED "GET /chunked HTTP/1.0\r\n\r\n"
request COOKIE "GET /setcookie?name=test&value=123&expires=1&path=/&domain=127.0.0.1&secure=0&httponly=1&samesite=127.0.0.1,localhost HTTP/1.0\r\n\r\n"
request GETREQ "GET /request-info?json HTTP/1.0\r\n\r\n"
request PUTREQ "PUT /request-info?json HTTP/1.0\r\nContent-Length: $size\r\n\r\n" '' $file
request OPTDAV "OPTIONS /dav HTTP/1.0\r\n\r\n"
request PUTDAV "PUT /dav/file.txt HTTP/1.0\r\nContent-Length: $size\r\n\r\n" '' $file
request DOWNLOAD "GET /dav/file.txt HTTP/1.0\r\n\r\n"
request DELETE "DELETE /dav/file.txt HTTP/1.0\r\n\r\n"
}
if [ $times -gt 0 ]; then
while [ $times -gt 0 ]; do
times=$(expr $times - 1)
test_cases
done
else
while true; do
test_cases
done
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。