Skip to content

Instantly share code, notes, and snippets.

@trane
Last active October 19, 2015 16:18
Show Gist options
  • Select an option

  • Save trane/99ef215be7f3a69e69e8 to your computer and use it in GitHub Desktop.

Select an option

Save trane/99ef215be7f3a69e69e8 to your computer and use it in GitHub Desktop.
# the Request protocol is simple:
#
# [Method] [Path] [Version]
# Host: [Hostname]
# <new line>
# [Body]
# <new lines>
#
# here is an example of GET (which has an empty body, because GET usually means retrieve something from the server):
GET / HTTP/1.1
Host: localhost
# here is an example of POST (which has a non-empty body, because POST usually means "add/modify" something on the server):
POST / HTTP/1.1
Host: localhost
hello=Hello&world=World
# this will start up a simple http server on localhost (your computer)
# try this on the command line, using python3
$ python -m http.server 8000
# connect to it
$ telnet localhost 8000
# type the following, and hit your enter/return key
GET / HTTP/1.1
Host: localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment