OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the...
Transcript of OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the...
![Page 1: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/1.jpg)
Produced by
Department of Computing, Maths & PhysicsWaterford Institute of Technologyhttp://www.wit.ie
http://elearning.wit.ie
Higher Diploma in Science in Computer Science
Mobile Application Development
Eamonn de Leastar ([email protected])
![Page 2: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/2.jpg)
OSI, the Internet & the HTTP Protocol
![Page 3: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/3.jpg)
The Internet
3
![Page 4: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/4.jpg)
Underlying nature of the Internet - Protocols & Standards
• Email• SMTP• POP• IMAP
• File Transfer• FTP• SFTP• FTP over SSH
• Login• Telnet• SSH
• Web• HTTP, HTML
• Messaging• XMPP
4
“The irony is that in all its various guises -- commerce, research, and surfing -- the Web is already so much a part of our lives that familiarity has clouded our perception of the Web itself.”
Tim Berners-Lee in Weaving the Web
![Page 5: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/5.jpg)
OSI Model• The OSI model divides the functions of a
protocol into a series of layers - each layer only uses the functions of the layer below, and only exports functionality to the layer above.
• A system that implements protocol behavior consisting of a series of these layers is known as a 'protocol stack' or 'stack'
• The interface between layers dictates the specifications on how one layer interacts with another. These specifications are typically known as Requests for Comments or "RFC"s in the TCP/IP community.
5
![Page 6: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/6.jpg)
OSI Analogy
6
![Page 7: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/7.jpg)
OSI & TCP/IP
• The application-centric layers of the 7-layer model are condensed into a single application layer protocol in the TCP/IP stack
• the TCP/IP protocol stack defines a Network Interface instead of the Data-Link layer of the ISO model, and the Internet Layer of the TCP/IP mode is broadly equivalent to the Network Layer in the ISO model.
7
![Page 8: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/8.jpg)
TCP/IP Protocol Suite
8
• Email• SMTP• POP• IMAP
• File Transfer• FTP• SFTP• FTP over SSH
• Login• Telnet• SSH
• Web• HTTP, HTML
• Messaging• XMPP
![Page 9: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/9.jpg)
TCP/IP Protocol Suite
9
• Email• SMTP• POP• IMAP
• File Transfer• FTP• SFTP• FTP over SSH
• Login• Telnet• SSH
• Web• HTTP, HTML
• Messaging• XMPP
![Page 10: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/10.jpg)
Lifecycle of a Hyperlink
• What happens when:
10
click on a hyperlink
page is completely rendered in a
browser
![Page 11: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/11.jpg)
11
Browser Web Server
![Page 12: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/12.jpg)
12
Browser Web Serverclient server
vle.wit.ie
![Page 13: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/13.jpg)
13
Browser Web Serverclient server
vle.wit.ie
Browser cache/ hosts file/ DNS
server
vle.wit.ie
![Page 14: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/14.jpg)
14
Browser Web Serverclient server
vle.wit.ie
Browser cache/ hosts file/ DNS
server
vle.wit.ie
193.1.193.187
![Page 15: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/15.jpg)
15
Browser Web Serverclient server
vle.wit.ieSYN
TCP: Are you there?
![Page 16: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/16.jpg)
16
Browser Web Serverclient server
vle.wit.ieSYN
TCP: I’m here
SYN-ACK
![Page 17: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/17.jpg)
17
Browser Web Serverclient server
vle.wit.ieSYN
TCP: Acknowledged
SYN-ACK
ACK
![Page 18: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/18.jpg)
18
Browser Web Serverclient server
vle.wit.ieGET /
HTTP: Got this file?
![Page 19: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/19.jpg)
19
Browser Web Serverclient server
vle.wit.ieGET /
HTTP: Yes, here you go
200 OK
index.html
![Page 20: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/20.jpg)
20
Browser Web Serverclient server
vle.wit.ieGET /
HTTP: And these as well?
200 OK
index.html
GET /home.css
GET /home.js
![Page 21: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/21.jpg)
21
Browser Web Serverclient server
vle.wit.ieGET /
HTTP: here you go
200 OK
index.html
GET /home.css
GET /home.js
more content
![Page 22: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/22.jpg)
22
Browser Web Serverclient server
vle.wit.ieFIN
TCP: Finished
![Page 23: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/23.jpg)
23
Browser Web Serverclient server
vle.wit.ieFIN
TCP: Acknowledged
FIN-ACK
![Page 24: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/24.jpg)
Client / Server
24
Http Request
Http Response
Client Server
• Conventionally, client sends an HTTP request
• Server responds with an HTTP response
• AJAX & HTML5 has merged these roles somewhat
![Page 25: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/25.jpg)
HTTP URLs
• HTTP is a request/response standard of a client and a server.• Typically, an HTTP client initiates a request.• Resources to be accessed by HTTP are identified using Uniform Resource
Locaters (URLs).• They contain four distinct parts: the protocol type, the machine name, the
directory path and the file name. • There are several kinds of URLs: file URLs, FTP URLs, and HTTP URLs.
25
![Page 26: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/26.jpg)
HTTP Components
• HTTP Requests and Response are comprised of these components
26
• Request Methods
• Response Status Codes
• Request Headers
• Response Headers
• General Headers
• Entity Headers
• Content (MIME Media Types)
![Page 27: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/27.jpg)
HTTP Request Methods• HTTP defines eight methods (sometimes referred to as "verbs") indicating the
desired action to be performed on the identified resource.
• Two types :
• Safe Methods -no side effects• HEAD: Request for data on resource.
• GET: Request for resource.
• TRACE: Echoes back the request just as it was received on the receiver for debugging.
• OPTIONS: Used to check server capacity
• Unsafe - intended for actions that have side effects• POST: Request for resource by passing parameters
• PUT: Creation or sending of resource
• DELETE: Deletion of resource
• CONNECT: Reserved for use on intermediate servers that can operate as tunnels. 27
![Page 28: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/28.jpg)
Response Status Codes
• Indicate the server’s disposition corresponding to a request
• Combination of a numerical code, and a short description
• Can be grouped in 5 categories:
• 1xx--Informational
• 2xx --Successful
• 3xx--Redirection
• 4xx--Client Error
• 5xx--Server Error
28
![Page 29: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/29.jpg)
• Specific to an HTTP Request
• Carry information about the client, and the type of request
• Facilitates better understanding between client and server
29
HostAccept-LanguageIf-Modified-SinceRefererUser-AgentAuthorizationIf-None-MatchExpectAcceptProxy-AuthorizationIf-RangeFromAccept-CharsetMax-ForwardsIf-Unmodified-SinceTEAccept-EncodingIf-MatchRange
Request Headers
• Specific to an HTTP Response
• Carry information about the server, and the type of response
Response Headers Accept-RangesETagRetry-AfterWWW-AuthenticateAgeLocationServerProxy-AuthenticateVary
![Page 30: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/30.jpg)
General Headers
• Carry information about the HTTP transaction
• Can be a part of request, as well as response
30
Cache-ControlKeep-AlivePragmaViaConnectionUpgradeTrailerWarningTransfer-EncodingDate
Entity Headers• Carry information about the
content
• Mainly a part of HTTP response
AllowContent-LanguageContent-LocationContent-RangeContent-EncodingContent-LengthContent-MD5Content-TypeExpiresLast-Modified
![Page 31: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/31.jpg)
Content
• IANA maintains a list of valid content types
• It is specified by the Content-TypeEntity header
• Categorized in 9 MIME Media types
31
applicationaudioexampleimagemessagemodelmultiparttext
![Page 32: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/32.jpg)
Statelessness
• Because of the Connect, Request, Response, Disconnect nature of HTTP it is said to be a stateless protocol
• i.e. from one web page to the next there is nothing in the protocol that allows a web program to maintain program “state” (like a desktop program).
• “state” can be maintained by various techniques
• E.g: Cookies:
• are text files stored by client browser
• maintain session by storing information
• are non-executable
32
![Page 33: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/33.jpg)
GET Example
33
GET /index.html HTTP/1.1 Host: www.example.com User-Agent: Mozilla/4.5 [en] Accept: image/gif, image/jpeg, text/html Accept-language: en Accept-Charset: iso-8859-1
![Page 34: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/34.jpg)
Request Line
• Request line: contains the requested resource. Consists of
1.Method: name of HTTP method called (GET,POST,etc.).
2.Resource identifier: URL (Uniform Resource Locator) of the requested resource.
3.Protocol version: protocol version requested for the response.
34
GET /index.html HTTP/1.1 Host: www.example.com User-Agent: Mozilla/4.5 [en] Accept: image/gif, image/jpeg, text/html Accept-language: en Accept-Charset: iso-8859-1
![Page 35: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/35.jpg)
Request Header• Contains additional information to
help the server to process the request correctly.
• Examples:• Host:name of requested
server.• User-Agent: name of
browser or program used to access the resource.
• Accept: some text and image formats accepted by the client.
• Accept-Language: languages supported (preferred) by the client, useful for automatically personalising the response.
35
GET /index.html HTTP/1.1 Host: www.example.com User-Agent: Mozilla/4.5 [en] Accept: image/gif, image/jpeg, text/html Accept-language: en Accept-Charset: iso-8859-1
![Page 36: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/36.jpg)
Request Parameters (1)
• A HTTP request can also contain parameters. e.g:
• as a response to a registration form, the selection of a product in an online store, etc.
• These parameters can be passed in two ways:
• As part of the request chain encrypted as part of the URL
• As extra request data
36
![Page 37: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/37.jpg)
Request Parameters: as part of request chain
• To encrypt parameters as part of the URL, they are added to the URL after the name of the resource, separated from the latter by the character ?. • The different parameters are separated from one another by the character &. • Spaces are replaced by +. • Special characters are represented by %xx where xx represents the
hexadecimal ASCII code of the character
37
GET /index.php?name=Mr+Nobody&OK=l HTTP/1.0 Host: www.example.com User-Agent: Mozilla/4.5 [en] Accept: image/gif, image/jpeg, text/html Accept-language: en Accept-Charset: iso-8859-1
http://www.example.com/index.php?name=Mr+Nobody&OK=lurl
request
![Page 38: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/38.jpg)
Extra Request Data
• To pass the parameters as the body of the request, the POST method rather than GET needs to be used.
38
POST /index.php HTTP/1.0 Host: www.example.com User-Agent: Mozilla/4.5 [en] Accept: image/gif, image/jpeg, text/html Accept-language: en Accept-Charset: iso-8859-1
name=Mr+Nobody&OK=l
![Page 39: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/39.jpg)
Response
• Response Code
39
HTTP/1.1 200 OK Date: Mon, 04 Aug 2011 15:19:10 GMT Server: Apache/2.0.40 (Red Hat Linux) Last-Modified: Tue, 25 Mar 2011 08:52:53 GMT Accept-Ranges: bytes Content-Length: 428
<html> <body> <h1>My Dvd List</h1> (more file contents) . . . </body> </html>
• HTML
![Page 40: OSI, the Internet & the HTTP Protocol - GitHub Pages · OSI Model • The OSI model divides the functions of a protocol into a series of layers - each layer only uses the functions](https://reader033.fdocuments.us/reader033/viewer/2022042916/5f57b90895a85877b774b458/html5/thumbnails/40.jpg)
Except where otherwise noted, this content is licensed under a Creative Commons Attribution-NonCommercial 3.0 License.
For more information, please see http://creativecommons.org/licenses/by-nc/3.0/