Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App
Next Article:
What is Web App
Next article icon

What is HTTP ?

Last Updated : 01 Apr, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

HTTP (Hypertext Transfer Protocol) is a fundamental protocol of the Internet, enabling the transfer of data between a client and a server. It is the foundation of data communication for the World Wide Web.

HTTP provides a standard between a web browser and a web server to establish communication. It is a set of rules for transferring data from one computer to another. Data such as text, images, and other multimedia files are shared on the World Wide Web. Whenever a web user opens their web browser, the user indirectly uses HTTP. It is an application protocol that is used for distributed, collaborative, hypermedia information systems.

HTTP Connection

History of HTTP

  • Tim Berners-Lee and his team at CERN are indeed credited with inventing the original HTTP protocol.
  • HTTP version 0.9 was the initial version introduced in 1991.
  • HTTP version 1.0 followed in 1996 with the introduction of RFC 1945.
  • HTTP version 1.1 was introduced in January 1997 with RFC 2068, later refined in RFC 2616 in June 1999.
  • HTTP version 2.0 was specified in RFC 7540 and published on May 14, 2015.
  • HTTP version 3.0, also known as HTTP/3, is based on the QUIC protocol and is designed to improve web performance. It was renamed as Hyper-Text Transfer Protocol QUIC (HTTP/3) and developed by Google.

Methods of HTTP

  • GET: Used to retrieve data from a specified resource. It should have no side effects and is commonly used for fetching web pages, images, etc.
  • POST: Used to submit data to be processed by a specified resource. It is suitable for form submissions, file uploads, and creating new resources.
  • PUT: Used to update or create a resource on the server. It replaces the entire resource with the data provided in the request body.
  • PATCH: Similar to PUT but used for partial modifications to a resource. It updates specific fields of a resource rather than replacing the entire resource.
  • DELETE: Used to remove a specified resource from the server.
  • HEAD: Similar to GET but retrieves only the response headers, useful for checking resource properties without transferring the full content.
  • OPTIONS: Used to retrieve the communication options available for a resource, including supported methods and headers.
  • TRACE: Used for debugging purposes to echo the received request back to the client, though it's rarely used due to security concerns.
  • CONNECT: Used to establish a tunnel to the server through an HTTP proxy, commonly used for SSL/TLS connections.

HTTP Request/Response:

HTTP is a request-response protocol, which means that for every request sent by a client (typically a web browser), the server responds with a corresponding response. The basic flow of an HTTP request-response cycle is as follows:

  • Client sends an HTTP request: The client (usually a web browser) initiates the process by sending an HTTP request to the server. This request includes a request method (GET, POST, PUT, DELETE, etc.), the target URI (Uniform Resource Identifier, e.g., a URL), headers, and an optional request body.
  • Server processes the request: The server receives the request and processes it based on the requested method and resource. This may involve retrieving data from a database, executing server-side scripts, or performing other operations.
  • Server sends an HTTP response: After processing the request, the server sends an HTTP response back to the client. The response includes a status code (e.g., 200 OK, 404 Not Found), response headers, and an optional response body containing the requested data or content.
  • Client processes the response: The client receives the server's response and processes it accordingly. For example, if the response contains an HTML page, the browser will render and display it. If it's an image or other media file, the browser will display or handle it appropriately.
HTTP Response

HTTP Request Circle

Requested ResourceResource TypeServer Response
HTML PageHTMLServer sends HTML file
Style Sheet (CSS)CSSServer sends CSS file
Image (JPG)Image (JPG)Server sends JPG image
JavaScript CodeJavaScript (JS)Server sends JS file
Data (XML or JSON)DataServer sends XML/JSON data

Overview of HTTP Request and Response Components

ConceptDescription
HTTP Request HeadersText information in key-value pairs sent with every HTTP request, conveying details such as client's browser, requested data, and more.
HTTP Request BodyContains data being submitted to the web server, such as form inputs, authentication details, or other payload data.
HTTP ResponseSent by the server in answer to an HTTP request, consisting of an HTTP status code, response headers, and optional response body.
HTTP Status Codes3-digit codes indicating the outcome of an HTTP request, categorized into 1xx (Informational), 2xx (Success), 3xx (Redirection), 4xx (Client Error), and 5xx (Server Error) blocks.
HTTP Response HeadersProvide important information like data format, language, and content type in the response, helping clients interpret the data correctly.
HTTP Response BodyContains the requested information sent by the server, such as HTML content for webpages, JSON data, or other data based on the client's request.

Features

  • Stateless: Each request is independent, and the server doesn't retain previous interactions' information.
  • Text-Based: Messages are in plain text, making them readable and debuggable.
  • Client-Server Model: Follows a client-server architecture for requesting and serving resources.
  • Request-Response: Operates on a request-response cycle between clients and servers.
  • Request Methods: Supports various methods like GET, POST, PUT, DELETE for different actions on resources.

Advantages

  • Platform independence: Works on any operating system
  • Compatibility: Compatible with various protocols and technologies
  • Efficiency: Optimized for performance
  • Security: Supports encryption for secure data transfer

Disadvantages

  • Lack of security: Vulnerable to attacks like man in the middle
  • Performance issues: Can be slow for large data transfers
  • Statelessness: Requires additional mechanisms for maintaining state

Next Article
What is Web App
author
__a_dedicated_sapient__
Improve
Article Tags :
  • Web Technologies
  • HTML
  • HTTP

Similar Reads

  • What is HTTP/2?
    HTTP/2 is the new version of HTTP, which transfers data over the Web. HTTP/2 is important for transmitting data from client to server over the web. Over time, various developments were made to enhance web protocols' efficiency, performance, and safety. HTTP/2 provides various features to transmit da
    4 min read
  • What is Web App
    A Web Application (Web App) is a software program that runs on a remote server and is accessed through a web browser over the internet. Unlike traditional apps that require installation on your device, web apps work directly from your browser whether it's Chrome, Safari, or Firefox. How do Web Apps
    6 min read
  • HTTP Patch
    The HTTP Patch method is used to request a set of modifications in the request entity to be applied for the resource recognized by the Request-URI. This method plays a vital role in improving interoperability and preventing errors by making partial changes in the resource. The described set of chang
    3 min read
  • What is HTTP2 in Wireshark?
    HTTP1 and HTTP2 are separate versions of web standards, which implies that the former is the original and the latter is a newer version. While there are only a few major changes between them, they have both been developed to address issues within their predecessor. For example, early on in developme
    4 min read
  • HTTP | PUT
    The HTTP PUT request method is used to create a new resource or overwrite a representation of the target resource that is known by the client. Calling this method once is similar to calling it multiple times successively as it has the same effect. Though it is idempotent, we cannot cache its respons
    1 min read
  • What is Port 80?
    Whenever someone tries to access a website and its content then the port 80 is used for that purpose but how does the computer know it needs to use the port 80? and how is data sent to the browsers using this port. For that, we need to understand what is port 80. What is Port 80?Whenever we go to a
    5 min read
  • What is RestFul API?
    APIs play an important role in the communication between different software systems. Traditional methods of doing this were often complicated, slow, and hard to grow. RESTful APIs solve these problems by offering a simple, fast, and scalable way for systems to communicate using standard web protocol
    7 min read
  • What are HTTP Status Codes ?
    HTTP Protocol is used everywhere from the server page to each service communication, deploying service to monitoring service. HTTP codes give an extension of HTTP protocol to debug network problems using curl, telnet able to check server availability, service responses HTTP status code is used for s
    8 min read
  • HTTP Messages
    HTTP messages are the core components of communication in web applications. They enable the exchange of data between clients (like web browsers) and servers. Every time a user navigates to a webpage, the browser sends an HTTP request to the server, which processes it and returns an HTTP response. Un
    4 min read
  • HTTP Statistics in Wireshark
    Cybersecurity become an important component of every sector since organizations started shifting from physical stores to digital markets. Online platforms provide endless capabilities like global markets, better income, more customers etc. Along with This comes the problems of online platforms like
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences