Mobile app version of vmapp.org
Login or Join
Frith620

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

@Frith620

Posted in: #Http #Url

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Frith620

1 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

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

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

HTTP is the protocol used to fetch some URLs (the ones that start with ) 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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme