Last active
June 25, 2024 08:53
-
-
Save CMCDragonkai/b7c19f30f9d15691a66da3094f2e597b to your computer and use it in GitHub Desktop.
Socat: HTTP Server that Terminates Early (useful for testing downstream service robustness)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# change the sleep time appropriately | |
# this server is persistent | |
# mix and match with Content-Length and having larger and less content then | |
# is actually produced | |
# as well as malformed Chunked Encoding | |
socat \ | |
-v -d -d \ | |
TCP-LISTEN:1234,crlf,reuseaddr,fork \ | |
SYSTEM:" | |
echo HTTP/1.1 200 OK; | |
echo Content-Type\: text/plain; | |
echo; | |
curl 'http://mirror.internode.on.net/pub/test/1000meg.test' & | |
sleep 4s && kill %1 && exit 1; | |
" | |
# alternatively just use http://pathod.net/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment