0% found this document useful (0 votes)
4 views

Detailed Notes on HTTP

HTTP (HyperText Transfer Protocol) is a stateless application-layer protocol that facilitates the transmission of hypermedia documents between clients and servers, primarily operating on port 80. It follows a request-response cycle and supports both non-persistent and persistent connections, with various methods for resource interaction. DNS (Domain Name System) translates human-readable domain names into IP addresses, functioning as a hierarchical and distributed naming system that enhances internet navigation and resource access.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Detailed Notes on HTTP

HTTP (HyperText Transfer Protocol) is a stateless application-layer protocol that facilitates the transmission of hypermedia documents between clients and servers, primarily operating on port 80. It follows a request-response cycle and supports both non-persistent and persistent connections, with various methods for resource interaction. DNS (Domain Name System) translates human-readable domain names into IP addresses, functioning as a hierarchical and distributed naming system that enhances internet navigation and resource access.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Detailed Notes on HTTP (HyperText Transfer Protocol)

HTTP (HyperText Transfer Protocol) is the backbone of data communication on the World Wide Web.
It is an application-layer protocol designed for transmitting hypermedia documents, such as HTML,
between clients and servers. Its simplicity, flexibility, and ability to support multiple types of content
have made it the most widely used protocol on the web.

Introduction to HTTP

HTTP defines the rules and formats for communication between a client (usually a web browser) and
a server (which hosts websites or other resources). HTTP is stateless by design, meaning each
request-response pair is independent, and the server does not retain information about previous
interactions.

 Port Used: HTTP typically operates on port 80. HTTPS, the secure version of HTTP, operates
on port 443.

 Underlying Transport Protocol: HTTP relies on TCP, a reliable and connection-oriented


protocol, to ensure accurate data transmission.

HTTP Communication Model

1. Request-Response Cycle HTTP follows a straightforward request-response cycle:

o Client Sends a Request: The client (browser or application) sends an HTTP request to
the server, asking for a specific resource or performing an action.

o Server Sends a Response: The server processes the request and sends back an HTTP
response containing the requested resource or an error message.

2. Stateless Protocol

o HTTP is inherently stateless. Each request is treated independently, even if it is part


of a series of requests from the same client. This simplicity makes HTTP efficient but
requires additional mechanisms like cookies to maintain session information.

HTTP Connections

HTTP supports two types of connections: non-persistent and persistent.

1. Non-Persistent Connections

 Each request-response pair uses a new TCP connection.

 After the server sends the response, the connection is closed.

 Advantages: Simple and easy to implement.

 Disadvantages: High overhead due to frequent connection setups and teardowns, leading to
increased latency.

2. Persistent Connections
 A single TCP connection is reused for multiple request-response pairs.

 Introduced in HTTP/1.1 as the default behavior.

 Advantages: Reduces latency and resource usage by avoiding the overhead of setting up new
connections.

 Disadvantages: Requires mechanisms to manage idle connections, such as timeouts.

HTTP Message Structure

HTTP messages are exchanged between the client and server in two formats: request messages and
response messages.

1. HTTP Request Message

An HTTP request message consists of:

 Request Line: Specifies the HTTP method, the resource URL, and the HTTP version. For
example:

 GET /index.html HTTP/1.1

 Header Lines: Provide additional metadata, such as the type of content the client accepts or
authentication credentials. For example:

 Host: www.example.com

 User-Agent: Mozilla/5.0

 Blank Line: Indicates the end of the headers.

 Body (Optional): Used in methods like POST or PUT to send data to the server.

2. HTTP Response Message

An HTTP response message consists of:

 Status Line: Includes the HTTP version, status code, and status phrase. For example:

 HTTP/1.1 200 OK

 Header Lines: Provide metadata about the response, such as the content type and length.
For example:

 Content-Type: text/html

 Content-Length: 2048

 Blank Line: Indicates the end of the headers.

 Body: Contains the requested resource or an error message.

HTTP Methods

HTTP defines several methods, also known as verbs, to specify the desired action:
Method Description

GET Requests a resource from the server.

HEAD Similar to GET but retrieves only the headers.

POST Submits data to the server for processing.

PUT Uploads or replaces a resource on the server.

DELETE Deletes a resource on the server.

OPTIONS Asks for the communication options available.

TRACE Echoes the request for debugging purposes.

Web Documents in HTTP

HTTP facilitates the transfer of various types of documents:

1. Static Documents

o Pre-created and stored on the server.

o Examples: HTML pages, images, and CSS files.

2. Dynamic Documents

o Generated by the server upon request, often using scripts or applications.

o Examples: Search results, live updates.

3. Active Documents

o Contain code that runs on the client side, such as JavaScript or Java applets.

o Examples: Interactive forms, animations.

HTTP Status Codes

HTTP status codes indicate the outcome of a client’s request:

Code Range Description Examples

100-199 Informational responses 101 Switching Protocols

200-299 Successful responses 200 OK, 201 Created

300-399 Redirection messages 301 Moved Permanently, 304 Not Modified

400-499 Client errors 400 Bad Request, 404 Not Found

500-599 Server errors 500 Internal Server Error, 503 Service Unavailable
Features of HTTP

1. Cookies

Cookies help overcome HTTP's stateless nature by storing small amounts of data on the client side.
They are used for:

 Session management (e.g., user logins).

 Personalization (e.g., user preferences).

 Tracking (e.g., shopping carts).

2. Caching

HTTP supports caching to reduce latency and improve performance by storing copies of responses:

 Browser Cache: Stores responses locally on the client’s device.

 Proxy Servers: Act as intermediaries that cache responses for multiple clients.

3. Security

HTTP lacks built-in security. HTTPS addresses this by running HTTP over SSL/TLS, providing:

 Encryption: Secures data in transit.

 Authentication: Verifies server identity.

 Data Integrity: Ensures data is not tampered with.

4. Content Negotiation

Clients can specify preferred content types, languages, and encodings in the request headers. The
server delivers content accordingly, ensuring compatibility.

Versions of HTTP

HTTP/1.0

 Introduced the basic request-response model.

 Defaulted to non-persistent connections.

HTTP/1.1

 Enabled persistent connections by default.

 Added features like chunked transfer encoding for dynamic content.

HTTP/2

 Replaced text-based communication with binary framing.

 Enabled multiplexing to handle multiple streams over a single connection, reducing latency.

HTTP/3

 Replaced TCP with QUIC, improving performance and reducing latency.


 Enhanced security and reliability.

Conclusion

HTTP has evolved significantly since its inception, adapting to the growing demands of the modern
web. From its simple stateless design to its advanced features like persistent connections and
content negotiation, HTTP continues to be the foundation of web communication. Its flexibility and
extensibility ensure its relevance in the ever-changing digital landscape.

Detailed Notes on DNS (Domain Name System)


The Domain Name System (DNS) is a hierarchical and distributed naming system used to resolve
human-readable domain names into IP addresses, enabling the proper routing of internet traffic.
DNS serves as the backbone of the internet, ensuring seamless access to resources by translating
meaningful names into network identifiers.

Introduction to DNS

DNS is an application-layer protocol that maps domain names, such as "www.example.com," to their
corresponding IP addresses (e.g., 192.0.2.1). Since IP addresses are challenging to remember, DNS
simplifies the process for users by allowing them to use easy-to-remember names instead.

 Core Functionality: Name-to-IP address translation and vice versa.

 Port Used: DNS primarily operates on UDP port 53, with TCP port 53 used for specific tasks
like zone transfers.

DNS Structure and Components

DNS is structured as a hierarchical system consisting of several key components and layers.

1. Domain Namespace

The domain namespace is the logical structure of DNS, organized hierarchically like an inverted tree.

 Root Domain: Represented by a dot ("."), it is the top-most level of the DNS hierarchy.

 Top-Level Domains (TLDs): Located below the root domain and include categories such as:

o Generic TLDs (gTLDs): e.g., .com, .org, .net.

o Country Code TLDs (ccTLDs): e.g., .us, .uk, .in.

 Second-Level Domains: Domains registered under TLDs, e.g., "example.com."

 Subdomains: Optional subdivisions under second-level domains, e.g.,


"support.example.com."

2. DNS Zones and Zone Files

 Zones: DNS zones are portions of the DNS namespace managed by a specific organization or
entity. A zone can consist of one domain or multiple subdomains.

 Zone Files: Contain DNS records for a particular zone, specifying mappings and
configurations.

3. DNS Records

DNS records provide information about a domain, including its IP addresses and services. Common
record types include:

Record Type Description

A Maps a domain to an IPv4 address.


Record Type Description

AAAA Maps a domain to an IPv6 address.

CNAME Creates an alias for another domain name.

MX Specifies mail servers for email routing.

NS Identifies authoritative name servers for a domain.

PTR Maps an IP address to a domain name (reverse DNS).

SOA Contains zone-specific metadata (e.g., serial number).

TXT Provides arbitrary text data for a domain (e.g., SPF records).

DNS Resolution Process

DNS resolution is the process of converting a domain name into its corresponding IP address. It
involves several steps and types of DNS servers.

1. Recursive Resolution

In recursive resolution, a DNS resolver handles the entire query process on behalf of the client,
ensuring it receives a final answer.

2. Iterative Resolution

In iterative resolution, the client makes queries to multiple DNS servers, receiving referrals to the
next server until the final answer is obtained.

3. DNS Server Roles

Server Type Role in Resolution

Recursive Resolver Handles client queries and performs recursive lookups if needed.

Root Server Directs queries to the appropriate TLD server.

TLD Server Points to the authoritative name server for a domain.

Authoritative Server Provides the definitive answer for the domain in question.

4. Steps in DNS Resolution

1. Query Sent: The client sends a query to a recursive resolver (e.g., ISP’s DNS server).

2. Root Server Interaction: If the resolver does not have the answer, it queries a root server.

3. TLD Server Interaction: The root server directs the query to the appropriate TLD server.

4. Authoritative Server Interaction: The TLD server points to the domain’s authoritative name
server.

5. Response Received: The authoritative server responds with the requested record (e.g., an IP
address).
Types of DNS Queries

DNS supports three types of queries to optimize the resolution process:

Query Type Description

Recursive Query The resolver takes full responsibility for finding the answer.

Iterative Query The client queries multiple servers, receiving referrals until an answer is found.

Inverse Query Resolves an IP address back to a domain name (reverse DNS).

DNS Caching

To improve performance and reduce query traffic, DNS employs caching mechanisms:

 Local Cache: Stored by the client or operating system for previously resolved queries.

 Recursive Resolver Cache: Stored by resolvers to handle subsequent requests for the same
domain efficiently.

 Time to Live (TTL): Specifies the duration for which a DNS record can be cached before being
refreshed.

DNS Security

DNS was not originally designed with security in mind, making it vulnerable to various threats.
Measures to enhance DNS security include:

1. DNSSEC (DNS Security Extensions)

DNSSEC adds cryptographic signatures to DNS records, ensuring their authenticity and integrity. Key
components include:

 RRSIG Records: Digital signatures for DNS records.

 DNSKEY Records: Public keys used to verify signatures.

 DS Records: Links parent and child zones.

2. Common DNS Threats

 DNS Spoofing/Cache Poisoning: Attackers inject false DNS records into a resolver’s cache.

 DDoS Attacks: Flooding DNS servers with traffic to overwhelm them.

 Pharming: Redirecting users to malicious websites by altering DNS records.

3. Mitigation Techniques

 Using DNSSEC to validate DNS records.

 Configuring resolvers to ignore unauthorized responses.


 Employing rate limiting and redundancy.

DNS Applications and Use Cases

1. Web Browsing: Translating domain names into IP addresses for accessing websites.

2. Email Delivery: Resolving MX records to route emails to the correct mail servers.

3. Content Delivery Networks (CDNs): Using DNS to direct users to the nearest server for faster
content delivery.

4. Reverse DNS (rDNS): Mapping IP addresses back to domain names, often used for logging
and authentication.

Advanced DNS Concepts

1. Dynamic DNS (DDNS)

Dynamic DNS updates DNS records in real-time, allowing changes in IP addresses (common with
DHCP) to be reflected automatically.

2. Split-Horizon DNS

Provides different DNS responses based on the origin of the query (e.g., internal vs. external
networks).

3. Anycast DNS

Uses multiple servers with the same IP address to provide redundancy and reduce latency by
directing queries to the nearest server.

Conclusion

DNS is an indispensable component of the internet, enabling user-friendly domain names and
efficient routing. Despite its foundational simplicity, DNS has evolved to include advanced features
like caching, security (DNSSEC), and dynamic updates, ensuring its scalability and relevance in
modern networking environments.

You might also like