[go: up one dir, main page]

0% found this document useful (0 votes)
9 views19 pages

Lecture 2 - HTTP Protocols

The document provides an overview of the Hypertext Transfer Protocol (HTTP), detailing its structure, connection types, and request/response mechanisms. It explains the anatomy of a webpage and URL, the differences between non-persistent and persistent HTTP connections, and the importance of authentication and cookies in user-server interactions. Key HTTP methods and response status codes are also outlined, emphasizing the stateless nature of HTTP and how it manages user identification.

Uploaded by

roy.joyanto.joy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views19 pages

Lecture 2 - HTTP Protocols

The document provides an overview of the Hypertext Transfer Protocol (HTTP), detailing its structure, connection types, and request/response mechanisms. It explains the anatomy of a webpage and URL, the differences between non-persistent and persistent HTTP connections, and the importance of authentication and cookies in user-server interactions. Key HTTP methods and response status codes are also outlined, emphasizing the stateless nature of HTTP and how it manages user identification.

Uploaded by

roy.joyanto.joy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

SE321

Lecture 2: Hyper Text


Transfer Protocol
(HTTP)
Md Monir Hossain
Lecturer
Department of Software Engineering
Daffodil International University
Web Requests
Anatomy of a Webpage

 Webpage consists of Objects. Objects can be HTML File,


Images, Media etc.
 HTML File may also includes several referenced objects. Each
object is addressable by a URL.
 URL Looks Like:
www.somewebsite.com/somecategory/pic.jpeg

Host Path
Name Name
Anatomy of a URL
Protocol: Tells the Port: Optional. A
server which web application runs Resources: Name of the
communication on a port in web resource being requested.
protocols will be server and identified Could be an HTML Page, a PHP
used (Here HTTP by that port. Port 80 Scripts, Image, PDF, Music or
Protocol) is the default port anything else. Default is
index.html
http://www.myfavweb.com:80/category/subcategory/product.html

Server: The unique name Path: The path to


of the physical server you the location of the
are looking for. This name resource being
maps to a unique IP request on the
address. Here we can use server
IP address but server name
are easier to remember
HTTP Overview
Client initiates TCP
connection to server over
port 80

 HTTP uses TCP Connection.


 HTTP is Stateless. Protocols Server Accepts
that maintain “state” are HTTP messages
TCP
Connection
complex! exchanged between
browser (HTTP client) and
from Client

Web server (HTTP server)


i. past history (state) must
be maintained

TCP
Connection
Closed
HTTP Connections

Non-Persistent HTTP Persistent HTTP

At most one object is sent Multiple objects can be sent


over a TCP connection over a single TCP Connection

HTTP/1.0 uses Non-Persistent HTTP/1.1 uses persistent


HTTP connection in default mode
NON-PERSISTENT HTTP
Suppose user enters URL: www.someSchool.edu/someDepartment/home.index
(contains text, references to 10 jpeg images)

1a. HTTP client initiates TCP


connection to HTTP server
(process) at
1b. HTTP server at host
www.someSchool.edu waiting
www.someSchool.edu on port
for TCP connection at port 80.
80
2. HTTP client sends HTTP request “accepts” connection, notifying
message (containing URL) into TCP client
connection socket. Message
indicates that client wants object 3. HTTP server receives request
someDepartment/home.index message, forms response
message containing requested
5. HTTP client receives response object, and sends message
message containing html file, into its socket
displays html. Parsing html file,
finds 10 referenced jpeg objects
4. HTTP server closes TCP
connection.

6. Steps 1-5 repeated for each of


10 jpeg objects
RESPONSE TIME MODELING
Definition of RTT: time to
send a small packet to travel
from client to server and back. Initiate
TCP
Connectio
Response time:
 one RTT to initiate TCP RTT n
connection Request
 one RTT for HTTP request File

Transmit
Time to
and first few bytes of HTTP RTT

File
response to return
File
File Transmission Time Received
Total = 2RTT+transmit time
HTTP REQUEST
HTTP GET REQUEST
HTTP GET REQUEST
HTTP POST REQUEST
Ch 3 - 13
HTTP METHOD TYPES

HTTP/1.0 HTTP/1.1

GET GET

POST POST

HEAD HEAD

PUT

DELETE
HTTP RESPONSE MESSAGE

status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection close
Date: Thu, 06 Aug 1998 12:00:15 GMT
header Server: Apache/1.3.0 (Unix)
lines Last-Modified: Mon, 22 Jun 1998 …...
Content-Length: 6821
Content-Type: text/html
data, e.g.,
requested
data data data data data ...
HTML file
HTTP RESPONSE STATUS CODE

200 OK
 request succeeded, requested object later in this message
301 Moved Permanently
 requested object moved, new location specified later in this
message (Location:)
400 Bad Request
 request message not understood by server
404 Not Found
 requested document not found on this server
505 HTTP Version Not Supported
USER-SERVER INTERACTION

HTTP is Stateless
But What If We Want to Identify Our Users?
AUTHENTICATION
Authentication is the process of verifying the identity of a user by
means of a username & password. It is Usually done before
authorization.

Example: Employees in a company are required to authenticate


through the network before accessing their company email.

401 Unauthorized - There's a problem with 401 Unauthorized,


the HTTP status code for authentication errors. And that’s just it:
it’s for authentication, not authorization. Receiving a 401 response
is the server telling you, “you aren’t authenticated–either not
authenticated at all or authenticated incorrectly–but please
reauthenticate and try again.” This is a response generally
returned by your web server, not your web application. It’s also
COOKIES
You are visiting Usual HTTP Request without Cookies Server could not
Amazon website identify the user.
for shopping. Server Replies with Response and a Generates a new
Cookie for this user

You added some Your added product list in HTTP Request Server identifies you
products to using your cookie and
shopping cart. But save your cart list in
you needed to Server Replies with Response
your cookie and.
leave the website Amazon =
because of your 2012
class

You are visiting Usual HTTP Request with Cookies Server identify the
Amazon website user. Using cookies
after 15 days. and updates his
Server Replies with Response and updated
shopping cart.
Shopping Cart
Amazon =
2012

You might also like