Let's lift the hood and check out the engine that makes the World Wide Web run.
HTTP is a protocol that allows clients to communicate with web servers, and is a primary underlying infrastructure of the Internet. The two most common HTTP methods are:
GET
POST
When a URL is inputted, the browser sends a GET
request to a web server. When a form is submitted on a website, a POST
request is submitted, and the browser hands off the form data to be handled by the web server.
(There are several more HTTP Methods but GET and POST are used for 99.99%+ of Web traffic.)
Remember, websites live at an IP Address. This is a string of numbers, (ex. 70.42.251.42) that locates a specific computer (or "host") on the Internet. A domain name is simply a translation that provides humans with an easy way to remember where a website lives.
Your nameservers may also contain other information about your domain, such as where your email server lives. For example, if I try to send an email to mark@facebook.com, your email server is going to communicate with the nameserver for facebook.com
and say, "Where does this email server live?".
HTTP: HyperText Transfer Protocol
Essentially, HTTP is a file transfer protocol
Web code can be any language used to create web pages or applications. Common examples of these are
The above languages run inside the web browser (aka "the client side"). On the server side, there is a lot more variation. You may encounter...
Cookie:
) pass state back and forthStep | Client | Server |
---|---|---|
open connection | telnet example.com 80 |
|
request a resource |
GET /index.html HTTP/1.0 ⏎ |
|
request headers |
User-Agent: Dogscape 1.0 ⏎ |
|
blank line | ⏎ | |
response status | HTTP/1.0 200 OK |
|
response headers |
Content-Type: text/html Content-Length: 12340
|
|
blank line | ⏎ | |
response body | <html><body>... |
Content-Type
header allows different file types
Content-Length
header so the client knows how big a file to expecttelnet
is the original program for connecting to other computers on the Internet.
Unfortunately, many modern OSs don't ship with a working version of
telnet
, so you should watch your instructor's terminal, or skip ahead to the next slide.
$ telnet google.com 80
That opens a connection to one of Google's many web servers.
In HTTP, the client starts the conversation, so type this and hit Enter:
GET /
then the server replies with an HTTP response!
If you have a working telnet
, try this yourself. Also try telnet towel.blinkenlights.nl
.
/