What is the difference between HTTP and a URL as used for a website? How is that related to the layers of HTTP?
A URL is an address used to locate documents. Examples of URLs are:
HTTP is the protocol used to fetch some URLs (the ones that start with
http://) from servers. A simple HTTP request works like this:
- Parse the server name out of the URL (
- Look up the IP address for that server (
Open a socket to that server and write an HTTP request (ending with two new lines):
GET /resource?foo=bar HTTP/1.1 Host: example.com
Wait for the response from the server:
HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: max-age=604800 Content-Type: text/html Date: Tue, 24 Mar 2015 11:00:51 GMT Etag: "359670651" Expires: Tue, 31 Mar 2015 11:00:51 GMT Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT Server: ECS (ewr/15BD) X-Cache: HIT x-ec-custom-error: 1 Content-Length: 1270 <!doctype html> <html> <head> ...
As you can see, a URL is an address and HTTP is a method of talking to a server.
I'm not sure what the HTTP layers you are referring to are.