SlideShare a Scribd company logo
Web Engineering
HTTP Protocol
Anup Majumder
Lecturer, CSE, DIU
Internet and Web
HTML tells the browser how to present the
content to the user.
Web and HyperText Transfer Protocol (HTTP)
First some jargon
 Web page consists of objects
 Object can be HTML file, JPEG image, Java applet,
audio file,…
 Web page consists of base HTML-file which includes
several referenced objects
 Each object is addressable by a URL
 Example URL:
www.someschool.edu/someDept/pic.gif
host name
path name
URL
HTTP overview
HTTP: hypertext transfer
protocol
 Web’s application layer
protocol
 client/server model
 client: browser that
requests, receives,
“displays” Web objects
 server: Web server sends
objects in response to
requests
 HTTP 1.0: RFC 1945
 HTTP 1.1: RFC 2068
PC running
Explorer
Server
running
Apache Web
server
Mac running
Navigator
Ports
 The TCP port numbers
from 0 to 1023 are reserved
for well-known services.
 Don’t use these ports for
your own custom server
programs!
HTTP overview (continued)
Uses TCP:
 client initiates TCP connection
(creates socket) to server, port
80
 server accepts TCP
connection from client
 HTTP messages (application-
layer protocol messages)
exchanged between browser
(HTTP client) and Web server
(HTTP server)
 TCP connection closed
HTTP is “stateless”
 server maintains no
information about past
client requests
Protocols that maintain “state”
are complex!
 past history (state) must be
maintained
 if server/client crashes, their
views of “state” may be
inconsistent, must be
reconciled
aside
HTTP connections
Nonpersistent HTTP
 At most one object is
sent over a TCP
connection.
 HTTP/1.0 uses
nonpersistent HTTP
Persistent HTTP
 Multiple objects can be
sent over single TCP
connection between
client and server.
 HTTP/1.1 uses
persistent connections in
default mode
Nonpersistent HTTP
Suppose user enters URL
www.someSchool.edu/someDepartment/home.index
1a. HTTP client initiates TCP
connection to HTTP server
(process) at
www.someSchool.edu on port 80
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection
socket. Message indicates that
client wants object
someDepartment/home.index
1b. HTTP server at host
www.someSchool.edu waiting
for TCP connection at port 80.
“accepts” connection, notifying
client
3. HTTP server receives request
message, forms response
message containing requested
object, and sends message into
its socket
time
(contains text,
references to
10
jpeg images)
Nonpersistent HTTP (cont.)
5. HTTP client receives response
message containing html file,
displays html. Parsing html file,
finds 10 referenced jpeg objects
6. Steps 1-5 repeated for each of
10 jpeg objects
4. HTTP server closes TCP
connection.
time
Response time modeling
Definition of RRT: time to
send a small packet to
travel from client to server
and back.
Response time:
 one RTT to initiate TCP
connection
 one RTT for HTTP
request and first few bytes
of HTTP response to
return
 file transmission time
total = 2RTT+transmit time
time to
transmit
file
initiate TCP
connection
RTT
request
file
RTT
file
received
time time
Persistent HTTP
Nonpersistent HTTP issues:
 requires 2 RTTs per object
 OS must work and allocate
host resources for each TCP
connection
 but browsers often open
parallel TCP connections to
fetch referenced objects
Persistent HTTP
 server leaves connection
open after sending response
 subsequent HTTP messages
between same client/server
are sent over connection
Persistent without pipelining:
 client issues new request
only when previous response
has been received
 one RTT for each referenced
object
Persistent with pipelining:
 default in HTTP/1.1
 client sends requests as
soon as it encounters a
referenced object
 as little as one RTT for all the
referenced objects
HTTP request message
 two types of HTTP messages: request, response
 HTTP request message:
 ASCII (human-readable format)
GET /somedir/page.html HTTP/1.1
Host: www.someschool.edu
User-agent: Mozilla/4.0
Connection: close
Accept-language:fr
(extra carriage return, line feed)
request line
(GET, POST,
HEAD commands)
header
lines
Carriage return,
line feed
indicates end
of message
HTTP request message
Anatomy of an HTTP GET
request
Anatomy of an HTTP GET
requestCh 3 - 18
Anatomy of an HTTP POST
request
Anatomy of an HTTP POST
requestCh 3 - 20
HTTP request message: general format
GET /somedir/page.html HTTP/1.1
Host: www.someschool.edu
User-agent: Mozilla/4.0
Connection: close
Accept-language:fr
(extra carriage return, line feed)
HTTP request message: general format
Now let's look at the header lines in the example. The header line HOST: www.someschool.edu specifies the host on which the
object resides. You night think that this header line is unnecessary, as there is already a TCP connection in place to the host. But,
as we'll see in Section 2.2.6, the information provided by the host header line is required by Web proxy caches. By including
theConnection:close header line, the browser is telling the server that it doesn't want to use persistent connections; it wants the
server to close the connection after sending the requested object. Thus the browser that generated this request message
implements HTTP/1.1 but it doesn't want to bother with persistent connections. The User-agent: header line specifies the user
agent, that is, the browser type that is making the request to the server . Here the user agent is Mozilla/4.0, a Netscape browser.
This header line is useful because the server can actually send different versions of the same object to different types of user
agents. (Each of the versions is addressed by the same URL.) Finally, the Accept-language: header indicates that the user prefers
to receive a French version of the object, if such an object exists on the server; otherwise, the server should send its default
version.
The Entity Body is not used with the GET method, but is used with the POST method. The HTTP client uses the POST method
when the user fills out a form
Method types
HTTP/1.0
 GET
 POST
 HEAD
 asks server to leave
requested object out of
response
HTTP/1.1
 GET, POST, HEAD
 PUT
 uploads file in entity body
to path specified in URL
field
 DELETE
 deletes file specified in the
URL field
HTTP response message
HTTP/1.1 200 OK
Connection close
Date: Thu, 06 Aug 1998 12:00:15 GMT
Server: Apache/1.3.0 (Unix)
Last-Modified: Mon, 22 Jun 1998 …...
Content-Length: 6821
Content-Type: text/html
data data data data data ...
status line
(protocol
status code
status phrase)
header
lines
data, e.g.,
requested
HTML file
HTTP response status codes
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
In first line in server->client response message.
A few sample codes:
User-Server Interaction: Authorization and
Cookies
 HTTP server is stateless – simplifies server design
 Sometime server needs to identify user
 Two mechanism for identification:
1. Authorization & 2. CooKies
Authorization :
1) Provide username and password to access documents on server
2) Status code 401: Authorization Required
User-server state: cookies
Many major Web sites use
cookies
Four components:
1) cookie header line in the
HTTP response message
2) cookie header line in
HTTP request message
3) cookie file kept on user’s
host and managed by
user’s browser
4) back-end database at Web
site
Example:
 Susan access Internet
always from same PC
 She visits a specific e-
commerce site for first time
 When initial HTTP
requests arrives at site,
site creates a unique ID
and creates an entry in
backend database for ID
Cookies: keeping “state” (cont.)
client server
usual http request msg
usual http response +
Set-cookie: 1678
usual http request msg
cookie: 1678
usual http response msg
usual http request msg
cookie: 1678
usual http response msg
cookie-
specific
action
cookie-
spectific
action
server
creates ID
1678 for user
Cookie file
amazon: 1678
ebay: 8734
Cookie file
ebay: 8734
Cookie file
amazon: 1678
ebay: 8734
one week later:
Cookies (continued)
What cookies can bring:
 authorization
 shopping carts
 recommendations
 user session state (Web
e-mail)
Cookies and privacy:
 cookies permit sites to learn a lot about you
 you may supply name and e-mail to sites
 search engines use redirection & cookies to
learn yet more
 advertising companies obtain info across sites
aside
Thank you

More Related Content

What's hot

HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)
Gurjot Singh
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
FabMinds
 
Http and its Applications
Http and its ApplicationsHttp and its Applications
Http and its Applications
Nayan Dagliya
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
sanjoysanyal
 
Http protocol
Http protocolHttp protocol
Http protocol
Arpita Naik
 
Http
HttpHttp
Lec 7(HTTP Protocol)
Lec 7(HTTP Protocol)Lec 7(HTTP Protocol)
Lec 7(HTTP Protocol)
maamir farooq
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
Sahil Agarwal
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocol
Vinh Nguyen
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
selvakumar_b1985
 
Http headers
Http headersHttp headers
Http headers
Judy Ngure
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
Chamnap Chhorn
 
Dns
DnsDns
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
N.Jagadish Kumar
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
Ujjayanta Bhaumik
 
Protocolo HTTP
Protocolo HTTPProtocolo HTTP
Protocolo HTTP
Jaime Vigueras
 
Ftp
FtpFtp
REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
Halil Burak Cetinkaya
 
Domain name system
Domain name systemDomain name system
Domain name system
Diwaker Pant
 
Internet control message protocol
Internet control message protocolInternet control message protocol
Internet control message protocol
asimnawaz54
 

What's hot (20)

HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
 
Http and its Applications
Http and its ApplicationsHttp and its Applications
Http and its Applications
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
 
Http protocol
Http protocolHttp protocol
Http protocol
 
Http
HttpHttp
Http
 
Lec 7(HTTP Protocol)
Lec 7(HTTP Protocol)Lec 7(HTTP Protocol)
Lec 7(HTTP Protocol)
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocol
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
 
Http headers
Http headersHttp headers
Http headers
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
 
Dns
DnsDns
Dns
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
 
Protocolo HTTP
Protocolo HTTPProtocolo HTTP
Protocolo HTTP
 
Ftp
FtpFtp
Ftp
 
REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
 
Domain name system
Domain name systemDomain name system
Domain name system
 
Internet control message protocol
Internet control message protocolInternet control message protocol
Internet control message protocol
 

Similar to Http-protocol

Appl layer
Appl layerAppl layer
Appl layer
rajanikant
 
Ch2 the application layer protocols_http_3
Ch2 the application layer protocols_http_3Ch2 the application layer protocols_http_3
Ch2 the application layer protocols_http_3
Syed Ariful Islam Emon
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
Cathie101
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
Cathie101
 
HTTP
HTTPHTTP
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
ZahouAmel1
 
Lec 6(Application Layer)
Lec 6(Application Layer)Lec 6(Application Layer)
Lec 6(Application Layer)
maamir farooq
 
009577496.pdf
009577496.pdf009577496.pdf
009577496.pdf
EidTahir
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptx
ssuseraf60311
 
Http
HttpHttp
Web technology
Web technologyWeb technology
Web technology
Anuj Singh Rajput
 
Computer networks module 5 content covered in this ppt
Computer networks module 5 content covered in this pptComputer networks module 5 content covered in this ppt
Computer networks module 5 content covered in this ppt
vinuthak18
 
Web Server Python Assignment You will develop a web server that ha.pdf
Web Server Python Assignment You will develop a web server that ha.pdfWeb Server Python Assignment You will develop a web server that ha.pdf
Web Server Python Assignment You will develop a web server that ha.pdf
amirajsharma
 
applayerslides.ppt
applayerslides.pptapplayerslides.ppt
applayerslides.ppt
SatishBangal3
 
Distributed web based systems
Distributed web based systemsDistributed web based systems
Distributed web based systems
Reza Gh
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
hussulinux
 
Write in Python please Web Server Python Assignment You will dev.pdf
Write in Python please Web Server Python Assignment You will dev.pdfWrite in Python please Web Server Python Assignment You will dev.pdf
Write in Python please Web Server Python Assignment You will dev.pdf
albert20021
 
www and http services
www and http serviceswww and http services
www and http services
Jenica Salmorin
 
http presentation 1.pptx
http presentation 1.pptxhttp presentation 1.pptx
http presentation 1.pptx
DeepakKumar408406
 
HTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
HTTPProtocol HTTPProtocol.pptHTTPProtocol.pptHTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
HTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
VietAnhNguyen337355
 

Similar to Http-protocol (20)

Appl layer
Appl layerAppl layer
Appl layer
 
Ch2 the application layer protocols_http_3
Ch2 the application layer protocols_http_3Ch2 the application layer protocols_http_3
Ch2 the application layer protocols_http_3
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
 
HTTP
HTTPHTTP
HTTP
 
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
 
Lec 6(Application Layer)
Lec 6(Application Layer)Lec 6(Application Layer)
Lec 6(Application Layer)
 
009577496.pdf
009577496.pdf009577496.pdf
009577496.pdf
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptx
 
Http
HttpHttp
Http
 
Web technology
Web technologyWeb technology
Web technology
 
Computer networks module 5 content covered in this ppt
Computer networks module 5 content covered in this pptComputer networks module 5 content covered in this ppt
Computer networks module 5 content covered in this ppt
 
Web Server Python Assignment You will develop a web server that ha.pdf
Web Server Python Assignment You will develop a web server that ha.pdfWeb Server Python Assignment You will develop a web server that ha.pdf
Web Server Python Assignment You will develop a web server that ha.pdf
 
applayerslides.ppt
applayerslides.pptapplayerslides.ppt
applayerslides.ppt
 
Distributed web based systems
Distributed web based systemsDistributed web based systems
Distributed web based systems
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
 
Write in Python please Web Server Python Assignment You will dev.pdf
Write in Python please Web Server Python Assignment You will dev.pdfWrite in Python please Web Server Python Assignment You will dev.pdf
Write in Python please Web Server Python Assignment You will dev.pdf
 
www and http services
www and http serviceswww and http services
www and http services
 
http presentation 1.pptx
http presentation 1.pptxhttp presentation 1.pptx
http presentation 1.pptx
 
HTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
HTTPProtocol HTTPProtocol.pptHTTPProtocol.pptHTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
HTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
 

More from Toushik Paul

A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the information
Toushik Paul
 
3D Display
3D Display3D Display
3D Display
Toushik Paul
 
Diagnosis of lung cancer prediction system using data mining Classification T...
Diagnosis of lung cancer predictionsystem using data mining Classification T...Diagnosis of lung cancer predictionsystem using data mining Classification T...
Diagnosis of lung cancer prediction system using data mining Classification T...
Toushik Paul
 
How to remove shortcut virus from pendrive bangla
How to remove shortcut virus from pendrive bangla How to remove shortcut virus from pendrive bangla
How to remove shortcut virus from pendrive bangla
Toushik Paul
 
Gas & smoke detector Report
Gas & smoke detector ReportGas & smoke detector Report
Gas & smoke detector Report
Toushik Paul
 
Gas & smoke detector
Gas & smoke detectorGas & smoke detector
Gas & smoke detector
Toushik Paul
 

More from Toushik Paul (6)

A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the information
 
3D Display
3D Display3D Display
3D Display
 
Diagnosis of lung cancer prediction system using data mining Classification T...
Diagnosis of lung cancer predictionsystem using data mining Classification T...Diagnosis of lung cancer predictionsystem using data mining Classification T...
Diagnosis of lung cancer prediction system using data mining Classification T...
 
How to remove shortcut virus from pendrive bangla
How to remove shortcut virus from pendrive bangla How to remove shortcut virus from pendrive bangla
How to remove shortcut virus from pendrive bangla
 
Gas & smoke detector Report
Gas & smoke detector ReportGas & smoke detector Report
Gas & smoke detector Report
 
Gas & smoke detector
Gas & smoke detectorGas & smoke detector
Gas & smoke detector
 

Recently uploaded

学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 

Recently uploaded (20)

学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 

Http-protocol

  • 1. Web Engineering HTTP Protocol Anup Majumder Lecturer, CSE, DIU
  • 3.
  • 4. HTML tells the browser how to present the content to the user.
  • 5. Web and HyperText Transfer Protocol (HTTP) First some jargon  Web page consists of objects  Object can be HTML file, JPEG image, Java applet, audio file,…  Web page consists of base HTML-file which includes several referenced objects  Each object is addressable by a URL  Example URL: www.someschool.edu/someDept/pic.gif host name path name
  • 6. URL
  • 7. HTTP overview HTTP: hypertext transfer protocol  Web’s application layer protocol  client/server model  client: browser that requests, receives, “displays” Web objects  server: Web server sends objects in response to requests  HTTP 1.0: RFC 1945  HTTP 1.1: RFC 2068 PC running Explorer Server running Apache Web server Mac running Navigator
  • 8. Ports  The TCP port numbers from 0 to 1023 are reserved for well-known services.  Don’t use these ports for your own custom server programs!
  • 9. HTTP overview (continued) Uses TCP:  client initiates TCP connection (creates socket) to server, port 80  server accepts TCP connection from client  HTTP messages (application- layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)  TCP connection closed HTTP is “stateless”  server maintains no information about past client requests Protocols that maintain “state” are complex!  past history (state) must be maintained  if server/client crashes, their views of “state” may be inconsistent, must be reconciled aside
  • 10. HTTP connections Nonpersistent HTTP  At most one object is sent over a TCP connection.  HTTP/1.0 uses nonpersistent HTTP Persistent HTTP  Multiple objects can be sent over single TCP connection between client and server.  HTTP/1.1 uses persistent connections in default mode
  • 11. Nonpersistent HTTP Suppose user enters URL www.someSchool.edu/someDepartment/home.index 1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80 2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index 1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client 3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket time (contains text, references to 10 jpeg images)
  • 12. Nonpersistent HTTP (cont.) 5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects 6. Steps 1-5 repeated for each of 10 jpeg objects 4. HTTP server closes TCP connection. time
  • 13. Response time modeling Definition of RRT: time to send a small packet to travel from client to server and back. Response time:  one RTT to initiate TCP connection  one RTT for HTTP request and first few bytes of HTTP response to return  file transmission time total = 2RTT+transmit time time to transmit file initiate TCP connection RTT request file RTT file received time time
  • 14. Persistent HTTP Nonpersistent HTTP issues:  requires 2 RTTs per object  OS must work and allocate host resources for each TCP connection  but browsers often open parallel TCP connections to fetch referenced objects Persistent HTTP  server leaves connection open after sending response  subsequent HTTP messages between same client/server are sent over connection Persistent without pipelining:  client issues new request only when previous response has been received  one RTT for each referenced object Persistent with pipelining:  default in HTTP/1.1  client sends requests as soon as it encounters a referenced object  as little as one RTT for all the referenced objects
  • 15. HTTP request message  two types of HTTP messages: request, response  HTTP request message:  ASCII (human-readable format) GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr (extra carriage return, line feed) request line (GET, POST, HEAD commands) header lines Carriage return, line feed indicates end of message
  • 17. Anatomy of an HTTP GET request
  • 18. Anatomy of an HTTP GET requestCh 3 - 18
  • 19. Anatomy of an HTTP POST request
  • 20. Anatomy of an HTTP POST requestCh 3 - 20
  • 21. HTTP request message: general format GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr (extra carriage return, line feed)
  • 22. HTTP request message: general format Now let's look at the header lines in the example. The header line HOST: www.someschool.edu specifies the host on which the object resides. You night think that this header line is unnecessary, as there is already a TCP connection in place to the host. But, as we'll see in Section 2.2.6, the information provided by the host header line is required by Web proxy caches. By including theConnection:close header line, the browser is telling the server that it doesn't want to use persistent connections; it wants the server to close the connection after sending the requested object. Thus the browser that generated this request message implements HTTP/1.1 but it doesn't want to bother with persistent connections. The User-agent: header line specifies the user agent, that is, the browser type that is making the request to the server . Here the user agent is Mozilla/4.0, a Netscape browser. This header line is useful because the server can actually send different versions of the same object to different types of user agents. (Each of the versions is addressed by the same URL.) Finally, the Accept-language: header indicates that the user prefers to receive a French version of the object, if such an object exists on the server; otherwise, the server should send its default version. The Entity Body is not used with the GET method, but is used with the POST method. The HTTP client uses the POST method when the user fills out a form
  • 23. Method types HTTP/1.0  GET  POST  HEAD  asks server to leave requested object out of response HTTP/1.1  GET, POST, HEAD  PUT  uploads file in entity body to path specified in URL field  DELETE  deletes file specified in the URL field
  • 24. HTTP response message HTTP/1.1 200 OK Connection close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ... status line (protocol status code status phrase) header lines data, e.g., requested HTML file
  • 25. HTTP response status codes 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 In first line in server->client response message. A few sample codes:
  • 26. User-Server Interaction: Authorization and Cookies  HTTP server is stateless – simplifies server design  Sometime server needs to identify user  Two mechanism for identification: 1. Authorization & 2. CooKies Authorization : 1) Provide username and password to access documents on server 2) Status code 401: Authorization Required
  • 27. User-server state: cookies Many major Web sites use cookies Four components: 1) cookie header line in the HTTP response message 2) cookie header line in HTTP request message 3) cookie file kept on user’s host and managed by user’s browser 4) back-end database at Web site Example:  Susan access Internet always from same PC  She visits a specific e- commerce site for first time  When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID
  • 28. Cookies: keeping “state” (cont.) client server usual http request msg usual http response + Set-cookie: 1678 usual http request msg cookie: 1678 usual http response msg usual http request msg cookie: 1678 usual http response msg cookie- specific action cookie- spectific action server creates ID 1678 for user Cookie file amazon: 1678 ebay: 8734 Cookie file ebay: 8734 Cookie file amazon: 1678 ebay: 8734 one week later:
  • 29. Cookies (continued) What cookies can bring:  authorization  shopping carts  recommendations  user session state (Web e-mail) Cookies and privacy:  cookies permit sites to learn a lot about you  you may supply name and e-mail to sites  search engines use redirection & cookies to learn yet more  advertising companies obtain info across sites aside