1. Home
  2. Docs
  3. Web Technology I
  4. Web Essential
  5. Higher Level Protocols-(HTTP, WWW, URL)

Higher Level Protocols-(HTTP, WWW, URL)

  • Request/Response Model: HTTP operates on a request/response model. A client (usually a web browser) sends a request to a server, which then responds with the requested resources (such as HTML pages, images, and videos).
  • Stateless: Each HTTP request is independent; the server does not retain session information between requests.
  • Encryption: Protects data from eavesdropping and tampering.
  • Authentication: Verifies the identity of the server to the client.
  • Data Integrity: Ensures data has not been altered during transmission.
  • SSL/TLS: Uses Secure Sockets Layer (SSL) or Transport Layer Security (TLS) to encrypt the communication between client and server.
image 7
image 8
structure of http request
  • Request Line:

It has the following format:

METHOD PATH HTTP/VERSION

METHOD: The HTTP method to be applied to the resource.

Common methods include:

  • GET: Retrieve data from the server.
  • POST: Send data to the server.
  • PUT: Update data on the server.
  • DELETE: Remove data from the server.
  • HEAD: Retrieve the headers for a resource, without the body.
  • OPTIONS: Describe the communication options for the target resource.
  • PATCH: Apply partial modifications to a resource.

‣ PATH: The URI (Uniform Resource Identifier) specifying the resource on the server.

‣ HTTP/VERSION: The version of the HTTP protocol being used (e.g., HTTP/1.1, HTTP/2).

Example:

GET /index.html HTTP/1.1
  • Headers:
  • Host: The domain name of the server (e.g., Host: www.example.com).
  • User-Agent: Information about the client software (e.g., User-Agent: Mozilla/5.0).
  • Accept: The MIME types the client is willing to accept (e.g., Accept: text/html).
  • Content-Type: The MIME type of the body of the request (used with POST and PUT requests).
  • Authorization: Credentials for authenticating the client with the server.

Example:

Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html
  • Body (Optional):

The body contains the data being sent to the server. It is typically used with POST, PUT, and PATCH requests to send form data, JSON payloads, or file uploads.

Example:

name=John&age=30

An HTTP response message is sent by the server to the client in response to an HTTP request. It includes the status of the request and the requested resource or an error message.

basic structure of an HTTP response
  • Status Line:

The status line includes the HTTP version, a status code, and a reason phrase.

It has the following format:

HTTP/VERSION STATUS_CODE REASON_PHRASE
  • Headers:

Headers provide additional information about the response. Each header is a key-value pair separated by a colon.

Common response headers include:

  • Content-Type: The MIME type of the response body (e.g., Content-Type: text/html).
  • Content-Length: The length of the response body in bytes (e.g., Content-Length: 1234).
  • Set-Cookie: Used to send cookies from the server to the client (e.g., Set-Cookie: sessionId=abc123).
  • Cache-Control: Directives for caching mechanisms (e.g., Cache-Control: no-cache).

Example:

Content-Type: text/html
Content-Length: 1234
Set-Cookie: sessionId=abc123
  • Body (Optional):

The body contains the requested resource or data. It is typically present in successful responses (status codes 200-299) and can include HTML, JSON, XML, images, or other types of data.

Example:

<!DOCTYPE html>
<html>
<head>
  <title>Example Page</title>
</head>
<body>
  <h1>Hello, World!</h1>
</body>
</html>

Here are some key points about the World Wide Web:

  • Creation: The concept of the World Wide Web was developed by Sir Tim Berners-Lee in 1989 while working at CERN (European Organization for Nuclear Research). The first website and web browser were created in 1990.
  • Hypertext and Hyperlinks: The WWW is based on the use of hypertext, which allows documents to contain links to other documents, enabling users to navigate between them easily. Hyperlinks, or simply links, are the clickable elements that connect different web pages.
  • Uniform Resource Locator (URL): Web addresses are identified using URLs, which specify the location of a resource on the internet. A URL typically includes the protocol (such as http:// or https://), the domain name, and the path to the specific resource.
  • Web Browsers: Web browsers are software applications that allow users to access and navigate the World Wide Web. Popular web browsers include Chrome, Firefox, Safari, and Edge.
  • HTTP and HTTPS: The Hypertext Transfer Protocol (HTTP) is the foundation of data communication on the web. Secure communication is ensured through HTTPS (HTTP Secure), which encrypts the data exchanged between the user’s browser and the web server.
  • Websites: A website is a collection of related web pages and multimedia content that are identified by a common domain name. Websites are hosted on web servers and can be accessed by users through their web browsers.
  • Search Engines: Search engines, such as Google, Bing, and Yahoo, allow users to search and discover information on the web. They index and rank websites based on relevance to users’ queries.
  • URL stands for Uniform Resource Locator.
  • It is a web address used to identify and locate resources on the internet.
  • A URL specifies the protocol used to access the resource, the domain or IP address where the resource is hosted, and the path to the specific resource on that server.

The general syntax of a URL is as follows:

protocol://domain:port/path?query#fragment

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *