What is HTTP?
- HTTP is how browsers and servers talk to each other
- Web pages are files displayed in a browser provided by a server
- The way those files get to the browser is HTTP
- HTTP stands for "Hypertext Transfer Protocol"
You are reading this webpage in a browser...
The browser got the webpage from a server...
The webpage is a collection of files...
The files got to the browser using HTTP
HTTP is how files are transfered over the internet
In order to transfer files the browser and the server must be able to communicate. HTTP (which stands for Hypertext Transfer Protocol) defines how that communication takes place.
Once you enter a web address (url) into a browser or click on a link the HTTP process begins.
When the url is called in a typical webpage request this what initially happens...
- The browser requests the html file that is located at that address from the server
- The server then responds by providing the html file to the browser
This is the request / response process of HTTP
The browser makes requests and the server provides responses.
The browser doesn't just say "Give me the file". It uses the specific language provided by HTTP to make the request.
A HTTP request is what the browser uses to request and get the files it needs to show your webpage.
Example HTTP request
Here is an exampe of what a HTTP request might look like when a browser is requesting the page you are reading now.
GET /http.html HTTP/1.1
User-Agent: user-agent: Mozilla/5.0 Chrome/44.0
Accept-Encoding: gzip, deflate
We will be covering what all these things mean in the next lesson.
The main thing to know now is that a HTTP request is how browsers ask for webpage files from your server.
When the browsers sends a HTTP request, it must receive a response from your server.
You are likely already aware of some of the more common response codes. Some common responses are...
- 200 - OK
- 301 - Moved permanently
- 302 - Moved temporarily
- 404 - Not found
These response codes are provided by the server as part of their response to the browsers HTTP request
Example HTTP response
Here is part of the HTTP response given from my server when a browser requests a page...
cache-control: max-age=300, must-revalidate
content-type: text/html; charset=utf-8
date: Sun, 02 Aug 2015 12:15:24 GMT
Intro to HTTP overview
- HTTP is how browsers and servers talk to each other in order to transfer files
- Webpages are a collection of files requested by browsers and provided by your server using HTTP
- HTTP requests are made from the browser to the server
- HTTP responses are provided from the server in response to a browser request