BIM222 InternetProgramming Week3
BIM222 InternetProgramming Week3
2021
Outline
§ How the Internet Works: An Overview
§ Networking Concepts
§ The Internet
§ Internet Hot Topics
1
16.03.2021
Network
FA:98:C3:27:0B:7D
Switch
MAC Address
45:A6:B3:C7:07:6B
Ethernet
2
16.03.2021
Frame
Switch
MAC Address
45:A6:B3:C7:07:6B
Ethernet
Destination
FA:98:C3:27:0B:7D
Switch
MAC Address
45:A6:B3:C7:07:6B
Ethernet
3
16.03.2021
FA:98:C3:27:0B:7D
Node
Switch
MAC Address
45:A6:B3:C7:07:6B
Ethernet
TCP/IP
Networking Model
Application
Transport
Network
Network
Ethernet
Interface
(Networking Hardware)
4
16.03.2021
Outline
§ How the Internet Works: An Overview
§ Networking Concepts
§ The Internet
§ Internet Hot Topics
The Internet
Internet
5
16.03.2021
Internet Backbone
Internet Backbone
https://time.com/3952373/internet-opte-project/
6
16.03.2021
IP Address
129.51.150.10
Modem
Router TCP/IP
Internet Backbone
Google Web
Server
64.233.171.1
Packet
Source: 129.51.150.10
Destination: 64.233.171.1
Data
7
16.03.2021
Domain Name
www.google.com
IP Address
129.51.150.10
Modem
DNS (Domain Name System)
www.google.com
ISP 64.233.171.1
Router TCP/IP
Firewall
Internet Backbone
Internet Backbone
Google Web
Server
64.233.171.1
8
16.03.2021
TCP/IP
Networking Model
Transport TCP
Network IP
Network
Ethernet
Interface
(Networking Hardware)
TCP/IP
Networking Model
(Networking Hardware)
9
16.03.2021
HTTP Protocol
Web 1:request
Network Web
Client
2:response Server
(Browser)
man-in-the-middle attack
TCP/IP
Networking Model
(Networking Hardware)
10
16.03.2021
HTTP à Port 80
HTTPS à Port 443
Encryption Encryption
Key Key
HTTP Protocol
Web 1:request
Network Web
Client
2:response Server
(Browser)
man-in-the-middle attack
11
16.03.2021
TCP/IP
Networking Model
Data
(Browser/Web App) Protocols/Services
(Networking Hardware)
Outline
§ How the Internet Works: An Overview
§ Networking Concepts
§ The Internet
§ Internet Hot Topics
12
16.03.2021
Outline
§ How the Internet Works: An Overview
§ Networking Concepts
§ The Internet
§ Internet Hot Topics
13
16.03.2021
1:request
14
16.03.2021
HTTP Protocol
§ Used to deliver resources in distributed hypermedia information
systems
§ In order to build and debug web applications, it’s vital to have a good
understanding of how HTTP works
HTTP Resources
§ Hypertext – Text, marked up using HyperText Markup Language
(HTML), possibly styled with CSS, and containing references (i.e.,
hyperlinks) to other resources
15
16.03.2021
HTTP Basics
HTTP has always been a stateless protocol
§ Server not required to retain information related to previous client
requests
§ Each client request is executed independently, without any
knowledge of the client requests that preceded it
§ Difficult for web applications to respond intelligently to user input,
i.e., to create the interactivity that users expect
§ Cookies, sessions, URL encoded parameters and a few other
technologies have been introduced to address this issue
Outline
§ How the Internet Works: An Overview
§ Networking Concepts
§ The Internet
§ Internet Hot Topics
16
16.03.2021
HTTP Request
HTTP – Client Side
1) Request line
2) Request Header
3) Message body
17
16.03.2021
2. HEAD – get the header that a GET request would have obtained, but
without the response body. Since the header contains the last-modified
date of the data, this can be used to check against the local cache copy
3. POST – post/submit data (e.g., from an HTML form) to the web server,
where the data is supplied in the body of the request, and the result may
be the creation of a new resource, or the update of an existing one
18
16.03.2021
19
16.03.2021
§ Note that safe methods, since they don’t change the state of the
server, are idempotent
20
16.03.2021
field_name: field_value
Ex:
Host: www.xyz.com
Connection: keep-alive
Accept: text/plain, image/gif, image/jpeg
Accept-Language: en-us, fr, cn, tr
21
16.03.2021
Ex:
Content-Type: text/html
Content-Length: 3495
22
16.03.2021
Outline
§ How the Internet Works: An Overview
§ Networking Concepts
§ The Internet
§ Internet Hot Topics
HTTP Response
HTTP – Server Side
1) Status line
2) Response Header
3) Message body
23
16.03.2021
24
16.03.2021
§ Header fields give information about the server and how to access the
resource identified by the request URI
field_name: field_value
Ex:
Content-Type: text/html
Content-Length: 35
Connection: keep-alive
Keep-Alive: timeout=15, max=100
25
16.03.2021
26
16.03.2021
Outline
§ How the Internet Works: An Overview
§ Networking Concepts
§ The Internet
§ Internet Hot Topics
27
16.03.2021
HTTP Sessions
Session is used to refer to the time that a user first starts using a web application to
the time they finished using that application
2) The HTTP server, listening on the port, receives the request, process it, and
sends back a response. The response includes a session ID, and the server may
store user information related to this session
3) When the browser makes another request, and includes the session ID, the
server can reference previously stored information and respond accordingly
Cookies
§ The session ID is typically a long randomly generated string sent back to
the browser as a cookie
§ The cookie is stored in the browser, and sent back to the server with every
request
§ Additional data, related to the session itself, can be stored in the cookie
28
16.03.2021
§ A cookie can only store about 4Kb of data – sometimes this is not
enough
29