HeyHttp is a .NET C# console application that you can use to test your HTTP clients. It consists of:
- A very light HTTP server.
- A simple HTTPS server.
- Other networking protocols, such as HTTP CONNECT and WebSocket.
hey.kiewic.com is a public server running multiple instances of HeyHttp, each with different configurations, for example:
http://hey.kiewic.com/is a plain HTTP endpoint.https://hey.kiewic.com/is an HTTPS endpoint.https://hey.kiewic.com:8080/is an HTTPS endpoint that requires a client certificate.https://hey.kiewic.com:8081/is an HTTPS endpoint with an expired certificate (NET::ERR_CERT_DATE_INVALID).https://hey.foo.kiewic.com/is an HTTPS endpoint with a certificate for a different domain name (ERR_CERT_COMMON_NAME_INVALID).
The source code is available on https://github.com/kiewic/heyhttp
CAUTION!
All the servers and clients included in this project are partially implemented.
Some features you can try are:
http://hey.kiewic.com/?delay=5000to introduce a 5 seconds delay before starting to send a response.http://hey.kiewic.com/?slow=1000to receive a response slowly, e.g., this configuration sends a package every 1000 milliseconds.http://hey.kiewic.com/?length=10240to receive a response of 10240 bytes.http://hey.kiewic.com/?bufferLength=1024to receive a response in chunks of 1024 bytes.http://hey.kiewic.com/?idleLength=2048to indefinitely block the response thread until the client is disconnected whenbufferLength * N >= idleLength.http://hey.kiewic.com/?pause=1to pause the writing of a response until the ENTER key is pressed.
You can mix options, for example:
http://hey.kiewic.com/?slow=1000&bufferLength=1000&length=1000000
More options you can also mix:
http://hey.kiewic.com/?cache=1to include headers in the response so content can be cached.http://hey.kiewic.com/?nocache=1to include headers in the response that will prevent the content from being cached.http://hey.kiewic.com/?chunked=1to receive a response with chunked transfer coding, i.e., usingTransfer-Encoding: chunkedhttp://hey.kiewic.com/?gzip=1to receive a response with GZIP coding, i.e.,Transfer-Encoding: gzip.http://hey.kiewic.com/?setcookie=1to receive a response with multipleSet-Cookieheaders.http://hey.kiewic.com/?etag=1234to receive a response with anETag: 1234header and anAccept-Rangesheader.http://hey.kiewic.com/?lastModified=1to receive a response with aLast-Modifiedheader and anAccept-Rangesheader.http://hey.kiewic.com/?filename=something.extto receive a response with aContent-Disposition: attachment; filename=something.extheader, so a client knows the response can be stored in the file system using the suggested name.http://hey.kiewic.com/?status=400to receive a response with a400 Not Foundstatus.http://hey.kiewic.com/?redirect=http%3A%2F%2Fexample.comto receive a301 Moved Permanentlyresponse and aLocation: http://example.comheader.http://hey.kiewic.com/?retry=1to receive a503 Service Unavailableresponse with aRetry-After: 5header.http://hey.kiewic.com/?basic=1to receive a401 Unauthorizedresponse with aWWW-Authenticate Basicheader.http://hey.kiewic.com/?digest=1to receive a401 Unauthorizedresponse with aWWW-Authenticate Digestheader.http://hey.kiewic.com/?negotiate=1to receive a401 Unauthorizedresponse with aWWW-Authenticate Negotiateheader.http://hey.kiewic.com/?ntlm=1to receive a401 Unauthorizedresponse with aWWW-Authenticate NTLMheader.http://hey.kiewic.com/?user=footo set the expected user name. If the request user name does not match foo, the response status is401 Unauthorized.http://hey.kiewic.com/?password=barto set the expected password. If the request password does not match bar, the response status is401 Unauthorized.
It is common to use user and password options at the same time, for example:
http://hey.kiewic.com/?basic=1&user=foo&password=bar
Some more possible options:
http://hey.kiewic.com/?name=Foo&value=Barto receive a response with aFoo: Barheader.http://hey.kiewic.com/?custom=1to add three random custom headers.http://hey.kiewic.com/?trace=1to receive the request headers back, as the content of the response.https://hey.kiewic.com/me.jsonto recieve a JSON example response.
To start the HTTP server, run HeyHttp.exe in the command prompt as:
HeyHttp.exe http server
To start the HTTPS server run the command:
HeyHttp.exe https server
To ask for a client certificate when a response is received run the command:
HeyHttp.exe https server -ClientCertificate
To select a server certificate run the command (for example):
HeyHttp.exe https server -Thumbprint "07261b17e0d71247b185234335c6126bc2796b6b"
More features:
- Press
CTRL + Cto kill all the current connections. - Press
CTRL + BREAKto kill the process. - HeyHttp.exe supports
Keep-Aliveconnections. - HeyHttp.exe supports
RangeandContent-Rangerequest headers. - It serves files from the file system, e.g.,
http://hey.kiewic.com/bar/foo.txtreturns the file at.\bin\Debug\wwwroot\bar\foo.txt. - Do you want transport layer logs? Use LogLevel.TransportLayer. Application level logs? Use LogLevel.ApplicationLayer.
- HeyHttp.exe supports dual-mode sockets.
- HeyHttp is written in C#! It is easy for C# developers to modify it and add new features.
- HeyHttp is written with raw sockets! Developers can introduce failures or delays at any point in the protocol stack, e.g., write a malformed response for diagnostic purposes.
Well, there are two easy ways to get started.
Download the binary and run it like this:
HeyHttp.exe http server
Or, if you want to use it as a client, like this:
HeyHttp.exe http client http://bing.com
Or, if you want to use it as a TCP server, like this:
HeyHttp.exe tcp server
Or, if you want to read other command line options, like this:
HeyHttp.exe /?
- Create a Git enlistment:
git clone https://github.com/kiewic/heyhttp - Open the HeyHttp.sln solution.
- Build (Ctrl + Shift + B)
- Start Debugging (F5)
The HeyHttp mission is to provide servers and clients for testing, capable of reproduce scenarios that hardly occur in normal conditions using conventional servers and clients.
Everything is written with raw sockets, so it is possible to modify the protocols at any step.
- WebSocket server.
- TCP server.
- TCP client.
- UDP receiver.
- UDP sender.
- SSL server.
- SSL client.
- HTTP proxy.
- HTTP CONNECT tunnel.
Have you ever wonder why a website is or it is not caching? Is a website being redirected? Is a website setting cookies? This HTTP client is the easiest way to find out the answers.
To start the HTTP client type:
HeyHttp.exe http client http://my.msn.com
Add an extra header:
http client http://hey.kiewic.com/?ntlm=1 -H "Authorization: NTLM TlRMTVNTUAABAAAAA7IAAAoACgApAAAACQAJACAAAABMSUdIVENJVFlVUlNBLU1JTk9S"
Use a different HTTP method:
http client http://hey.kiewic.com/?ntlm=1 -X HEAD
To start the UDP receiver type:
HeyHttp.exe udp receiver [port]
To start the UDP sender type:
HeyHttp.exe udp sender [hostname] [port] [message]
On receiver mode, it listens for UDP packets in the given port.
On sender mode, it sends a package with the given message to the given hostname and port.
To start the SSL server type:
HeyHttp.exe ssl server
To configure the server certificate, please read the instructions in the Certificates.md file.
To start the HTTP proxy server type:
HeyHttp.exe proxy server
To skip proxy authentication type:
HeyHttp.exe proxy server -NoAuthentication
To configure a proxy:
- Open "Internet Properties", i.e., inetcpl.cpl
- Click "Connections" tab.
- Click "LAN settings" button.
- Check "Use a proxy server for your LAN ...".
- Type "localhost" in the "Address" field.
- Type "3333" (or whatever port number you are planning to use) in the "Port" field.
- Click "Ok" button twice.
Features:
- Supports SSL connections through HTTP CONNECT Tunneling.
