Lecture Week03
Lecture Week03
03: HTTP
Dr. Hamed Hamzeh
06/02/2025
Introduction to HTTP
Hyper Text
Transfer Protocol
• HTTP, which stands for Hypertext
Transfer Protocol, was created by Sir
Tim Berners-Lee, a British computer
scientist.
• He developed HTTP while working at
CERN (European Organization for
Nuclear Research) in 1989, as part of
the foundation for the World Wide
Web.
• HTTP is the protocol that enables
communication and the transfer of
data on the World Wide Web.
HTTP History
HTTP/2
HTTP/1.0 •Binary framing for concurrent streams.
•Allowed different data types. •Header compression and multiplexing.
•Enabled multiple objects over a single TCP •Backward-compatible with HTTP/1.1.
connection. •Significant performance enhancements.
1996 2015
Position of HTTP in the OSI Model
The OSI (Open Systems Interconnection) model is a conceptual framework
that standardizes the functions of a communication system into seven
abstraction layers.
The Application Layer deals with high-level protocols, user interfaces, and network-
aware applications.
Key Points: HTTP is responsible for communication between applications, specifically web
browsers, and servers.
Basics of HTTP Request
HTTP Methods:
Purpose:
Usage: These methods provide additional functionality and flexibility in various scenarios.
Basics of HTTP Response
Status Codes:
Explanation:
100 Continue:
• The server has received the initial part of the request and is
ready to proceed.
• Similar to 302 but explicitly indicates that the request method should not change.
Client Error Codes
400 Bad Request: The server 401 Unauthorized: The request 404 Not Found: The requested
cannot understand the request requires user authentication. resource could not be found on
due to a client error. the server.
5xx Server Error Codes
https://www.example.com
Example: indicates a secure
connection.
Maintaining user/server state: cookies
aside
What cookies can be used for: cookies and privacy:
▪ authorization ▪ cookies permit sites to
▪ shopping carts learn a lot about you on
their site.
▪ recommendations
▪ third party persistent
▪ user session state (Web e-mail) cookies (tracking cookies)
allow common identity
(cookie value) to be
Challenge: How to keep state: tracked across multiple
▪ protocol endpoints: maintain state at
web sites
sender/receiver over multiple transactions
▪ cookies: HTTP messages carry state
Web caches (proxy servers)
Goal: satisfy client request without involving origin server
▪ user configures browser to point
to a Web cache proxy
▪ browser sends all HTTP requests server
to cache client
origin
• if object in cache: cache server
A (Address) Record: This record type maps a domain name to an IPv4 address. It provides the IP address associated
with a hostname.
AAAA (IPv6 Address) Record: This record type maps a domain name to an IPv6 address. It provides the IPv6 address
associated with a hostname.
CNAME (Canonical Name) Record: This record type provides an alias or canonical name for a domain. It allows a
domain name to be associated with another domain name.
MX (Mail Exchanger) Record: This record type specifies the mail servers responsible for accepting incoming emails for
a domain. It provides information about the email servers that should be used to send emails to a particular domain
DNS (Name Server) Record: This record type specifies the authoritative name servers for a domain. It provides
information about the servers responsible for handling DNS queries for a particular domain.
HTTP/2
Key Features
of HTTP/2
Requests can be assigned
Prioritization: priority levels to optimize
resource loading.
Example:
• Faster page load times and improved
user experience.
Server and Browser Support:
• Ensure that both servers and clients support
HTTP/2.
Configuration:
Considerations • Update server configurations to enable
HTTP/2.
for Migrating
to HTTP/2 Testing:
• Thoroughly test the website/application for
compatibility.
Example:
• Verifying that both the server and the client
support HTTP/2.
Introduction to HTTP/3:
Example:
It includes classes and interfaces for working with URLs, sockets, and
network connections.
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpExchange;
• Limited Scalability:
• Handling multiple clients concurrently becomes challenging.
• Performance may degrade as the number of clients increases.
• Blocking Nature:
• The server blocks while waiting for a client request to be processed.
• If one client takes a long time, other clients have to wait.
• Handling Multiple Clients Simultaneously:
• In traditional single-threaded socket programming, handling
one client at a time may lead to scalability issues.
• Multithreading enables concurrent processing of multiple client
requests.
• Each client connection is assigned its own thread, allowing
parallel execution.
Multithreading • Improving Performance and Responsiveness:
in Sockets • Parallel Execution:
• Multithreading allows the server to process multiple client
requests concurrently, significantly improving throughput.
• Tasks that would otherwise block the server can be
parallelized.
• Reduced Latency:
• With multithreading, the server can respond to clients
more quickly, reducing the overall latency of the system.
• Clients experience improved responsiveness and faster
service.