-3

What is the difference between HTTP and a URL as used for a website? How is that related to the layers of HTTP?

closed as too broad by John Conde Mar 24 '15 at 11:44

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • They're completely dufferent things. Used for dufferent purposes. HTTP is a transfer protocol, URL is a resource locator. – TZHX Mar 24 '15 at 9:34
1

A URL is an address used to locate documents. Examples of URLs are:

  • http://example.com/mypage.html
  • ftp://example.com/download.zip
  • mailto:user@example.com
  • file:///home/user/file.txt
  • tel:1-888-555-5555
  • http://example.com/resource?foo=bar#fragment

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 (example.com)
  • Look up the IP address for that server (93.184.216.34)
  • 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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.