- HTTP means Hypertext Transfer Protocol.
- HTTP version 0.9 was invented by Tim Berners-Lee in 1989. It was designed to request
hypertext (text with links, but no images or other multimedia) pages from a server.
- Tim Berners-Lee also invented the HTML markup language.
- HTTP version 1.0 was introduced in May 1996. It could handle not only simple text documents,
but a variety of file formats using the Multipurpose Internet Mail
Extentions (MIME) standard.
- The current version of HTTP is 2.0. It was released in 2015, and is used by
over 50% of current websites.
- HTTP version 3.0 is the proposed successor to HTTP/2.0. It is already in use by
some servers.
- Here are the steps for obtaining a webpage from a server:
- The browser goes to the DNS server, and finds the real address of the
server where the website lives. The real IP address of
studentweb.cdm.depaul.edu
is
216.220.181.34
- The browser sends an HTTP request message to the server, asking it to
send a copy of the webpage to the client. This message, and all other data sent between the client and the
server, is sent across your internet connection using TCP/IP.
- If the server approves the client's request, the server sends the client
a "200 OK" message, which means "You can look at that website.
Here it is." The server then starts sending the website's files to the browser as a
series of small chunks called data packets.
- The browser assembles the small chunks into a complete web page and
displays it to you.
- In the early days, raw HTTP commands could be issued like this:
GET /test.txt http/1.0
The response would look something like this:
HTTP/1.1 302 Found
Date: Thu, 19 Feb 2021 02:50:55 GMT
Server: Apache/2.0.53 HP-UX-Apache-based_Web_Server (Unix) PHP/4.3.8
Last-Modified: Tue, 27 Oct 2015 14:39:09 GMT
ETag: "16896-61d-408dd700"
Accept-Ranges:Bytes
Content-Length: 18
Connection: close
Content-Type: text/html
Content: This is a test.
- Currently, we do not request web pages directly through HTTP; a
browser issues the HTTP commands for us.
- Actually, most modern browsers do not use traditional HTTP, they use HTTPS instead (HTTP Secure).
The difference is that HTTPS encrypts the data exchanged by the browser and the server. The result
is that HTTPS is more secure than HTTP.
- Here is a DOS PowerShell session that invokes the HTTP GET
command.:
PS C:\Users\sjost> Invoke-WebRequest facweb.cdm.depaul.edu/sjost/test.txt
StatusCode : 200
StatusDescription : OK
Content : This is a test.
RawContent : HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 18
Content-Type: text/plain
Date: Fri, 19 Feb 2021 20:50:26 GMT
ETag: "6590583dc510d11:0"
Last-Modified: Tue, 27 Oct 2015 14:39:09 GMT
Serve...
Forms : {}
Headers : {[Accept-Ranges, bytes], [Content-Length, 18],
[Content-Type, text/plain], [Date, Fri,
19 Feb 2021 20:50:26 GMT]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 18
- If you use a Mac, which runs the Unix operating system, try using
curl instead of Powershell:
> curl -v http://facweb.cdm.depaul.edu/sjost/test.txt
You should get output something like this:
* Trying 216.220.181.39:80...
* TCP_NODELAY set
* Connected to facweb.cdm.depaul.edu (216.220.181.39) port 80 (#0)
> GET /sjost/test.txt HTTP/1.1
> Host: facweb.cdm.depaul.edu
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/plain
< Last-Modified: Tue, 27 Oct 2015 14:39:09 GMT
< Accept-Ranges: bytes
< ETag: "6590583dc510d11:0"
< Server: Microsoft-IIS/10.0
< X-Powered-By: ASP.NET
< Date: Mon, 02 Oct 2023 00:25:08 GMT
< Content-Length: 18
- Some common HTTP commands
- GET -- Requests a specified document. A header is returned with document
meta-information followed by the actual document. This is the most
commonly used HTTP command.
- HEAD -- Asks for the header that would be sent in response to a GET request,
but without the document. Used for testing.
- POST -- Submits user data (often user supplied data on an HTML form) to be
processed by the server.
- PUT -- Uploads the specified file.
- DELETE -- Deletes a file on the server (rairly used).
- TRACE -- Echoes back the specified request so the client can see what
intermediate servers are adding or removing from the request.
- OPTIONS -- Returns the HTTP methods that the server supports. Used for testing.
- CONNECT -- Used to connect to a proxy that can change to being an SSL
(Secure Socket Layers) tunnel.