[go: up one dir, main page]

0% found this document useful (0 votes)
18 views36 pages

38 HTTP

HTTP (Hypertext Transfer Protocol) is the foundational protocol for transferring web pages over the internet, utilizing TCP on port 80. It is a connectionless, stateless protocol that allows clients to send requests and receive responses without retaining session information. HTTP supports various methods for data retrieval and submission, and it is distinct from FTP in its operational structure and efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views36 pages

38 HTTP

HTTP (Hypertext Transfer Protocol) is the foundational protocol for transferring web pages over the internet, utilizing TCP on port 80. It is a connectionless, stateless protocol that allows clients to send requests and receive responses without retaining session information. HTTP supports various methods for data retrieval and submission, and it is distinct from FTP in its operational structure and efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

HTTP

Dr. S. N. Tripathy
Department of Computer Science, Berhampur University, Berhampur, Odisha
HTTP (Hypertext Transfer Protocol)
• It is the backbone of WWW.
• It is an internet standard that allows the process of transfer of
web pages over the internet.
• It also defines how the web browser will respond to any web
request.
• The web address of all the web pages contains a protocol, domain
name, and path to the web page.
• Most of the web address contains http:// in their URL to show the
HTTP protocol.
• HTTP works similar to the combined functions of FTP and SMTP.
• It also uses Transmission Control Protocol.
HTTP (Hypertext Transfer Protocol)
• This protocol is known as HyperText Transfer Protocol because of its
efficiency that allows us to use in a hypertext environment where there
are rapid jumps from one document to another document.
• HTTP is similar to the FTP as it also transfers the files from one host to
another host. But, HTTP is simpler than FTP as HTTP uses only one
connection, i.e., no control connection to transfer the files.
• HTTP is used to carry the data in the form of MIME-like format.
• HTTP is similar to SMTP as the data is transferred between client and
server. The HTTP differs from the SMTP in the way the messages are
sent from the client to the server and from server to the client. SMTP
messages are stored and forwarded while HTTP messages are
delivered immediately.
So…

HTTP uses the services of TCP on well-


known port 80.
Features of HTTP
• Connectionless Protocol: HTTP is a connectionless protocol. HTTP client
initiates a request and waits for a response from the server. When the
server receives the request, the server processes the request and
sends back the response to the HTTP client after which the client
disconnects the connection. The connection between client and server
exist only during the current request and response time only.
• Media Independent: HTTP protocol is a media independent as data can
be sent as long as both the client and server know how to handle the
data content. It is required for both the client and server to specify the
content type in MIME-type header.
• Stateless: HTTP is a stateless protocol as both the client and server
know each other only during the current request. Due to this nature of
the protocol, both the client and server do not retain the information
between various requests of the web pages.
HTTP transaction

The above figure shows the HTTP transaction between client and server. The client
initiates a transaction by sending a request message to the server. The server replies to
the request message by sending a response message.
Request and response messages
HTTP messages are of two types: request and response. Both the message types follow the
same message format.
Request and response messages
Request Message: The request message is sent by the client that consists of a request
line, headers, and sometimes a body.
Response Message: The response message is sent by the server to the client that consists
of a status line, headers, and sometimes a body.
Request and status lines
Uniform Resource Locator (URL)
• A client that wants to access the document in an internet needs an address
and to facilitate the access of documents, the HTTP uses the concept of
Uniform Resource Locator (URL).
• The Uniform Resource Locator (URL) is a standard way of specifying any kind
of information on the internet.
• The URL defines four parts: method, host computer, port, and path.
Uniform Resource Locator (URL)
• Method: The method is the protocol used to retrieve the document from a
server. For example, HTTP.
• Host: The host is the computer where the information is stored, and the
computer is given an alias name. Web pages are mainly stored in the
computers and the computers are given an alias name that begins with the
characters "www". This field is not mandatory.
• Port: The URL can also contain the port number of the server, but it's an
optional field. If the port number is included, then it must come between the
host and path and it should be separated from the host by a colon.
• Path: Path is the pathname of the file where the information is stored. The
path itself contain slashes that separate the directories from the
subdirectories and files.
Methods
Status codes
Status codes….
Header format
General headers
Request headers
Response headers
Entity headers
Example
This example retrieves a document. We use the GET method to
retrieve an image with the path /usr/bin/image1. The request line
shows the method (GET), the URL, and the HTTP version (1.1). The
header has two lines that show that the client can accept images in
the GIF or JPEG format. The request does not have a body. The
response message contains the status line and four lines of header.
The header lines define the date, server, MIME version, and length of
the document. The body of the document follows the header.
Example….
Example
In this example, the client wants to send data to the
server. We use the POST method. The request line shows
the method (POST), URL, and HTTP version (1.1). There are
four lines of headers. The request body contains the input
information. The response message contains the status
line and four lines of headers. The created document,
which is a CGI document, is included as the body.
Example….
Example
HTTP uses ASCII characters. A client can directly connect to a server
using TELNET, which logs into port 80 (see next slide). The next three
lines show that the connection is successful. We then type three lines.
The first shows the request line (GET method), the second is the
header (defining the host), the third is a blank, terminating the
request. The server response is seven lines starting with the status line.
The blank line at the end terminates the server response. The file of
14,230 lines is received after the blank line (not shown here). The last
line is the output by the client.
Example….
So…

HTTP version 1.1 specifies a persistent


connection by default.
The HyperText Transfer Protocol (1)

HTTP with (a) multiple connections and sequential requests.


(b) A persistent connection and sequential requests.
(c) A persistent connection and pipelined requests.
The HyperText Transfer Protocol (2)

The built-in HTTP request methods.


The HyperText Transfer Protocol (3)

The status code response groups


The HyperText Transfer Protocol (4)

...
Some HTTP message headers.
The HyperText Transfer Protocol (5)

Some HTTP message headers.


The HyperText Transfer Protocol (6)

HTTP caching.
The Mobile Web

Difficulties for mobile phones browsing the web


1. Relatively small screens
2. Limited input capabilities, lengthy input.
3. Network bandwidth is limited
4. Connectivity may be intermittent.
5. Computing power is limited
The Mobile Web

The XHTML Basic modules and tags.


Difference between HTTP and FTP
S.NO. HTTP FTP

1. It stands for HyperText Transfer Protocol. It stands for File Transfer Protocol

It is the set of rules that how web pages are transferred on It is the set of rules that permit the downloading and uploading the
2.
different computers over the internet. files on the computer over the internet.

3. It only supports the data connection. It supports both data connection and control connection

It uses Transmission Control Protocol and runs on TCP port It uses Transmission Control Protocol and runs on TCP port 20 and
4.
80. TCP port 21.

5. The URL using the HTTP protocol will start with HTTP. The URL using the FTP will start with FTP.

6. It does not require authentication. It requires authentication.

7. It is efficient in transferring small files. It is efficient in transferring large files.

The files transferred to the computer over the internet are The files transferred to the computer over the internet are saved to
8.
not saved to the memory. the memory.
Difference between HTTP and FTP
S.NO. HTTP FTP

HTTP is used to provide the web pages to the web FTP is used to upload or download files between client and
9.
browser from the webserver server.

10. It is a stateless protocol. It is not a stateless protocol and it maintains states.

11. It supports an In-band type of band transfer. It supports an Out-of-band type of band transfer.

It uses a Persistent TCP connection for the Control


It can use both types of Persistent and Non-
12. connection and a Non-persistent TCP Connection for Data
persistent TCP connection.
Connection.

13. Its RFCs are 2616, 7230 and 7231. Its RFCs are 959, 765, 1732.

14. It uses one way communication system. It uses two way communication system.

15. HTTP is faster. FTP is slower as compared to HTTP.

You might also like