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

HTTP& FTP

Uploaded by

akshaiparthugari
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)
22 views19 pages

HTTP& FTP

Uploaded by

akshaiparthugari
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

Chapter 2: outline

2.1 principles of
network
applications
 app architectures
 app requirements
2.2 Web and HTTP
2.3 FTP
2.4 electronic mail
 SMTP, POP3,
IMAP
2.5 DNS

Application Layer 2-1


Web and HTTP
First, a review…
 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,
www.someschool.edu/someDept/pic.gif
e.g.,
host name path name

Application Layer 2-2


HTTP overview
HTTP: hypertext
transfer protocol HT
 Web’s application TP
req
layer protocol PC running HT
ues
t
Firefox browser TPr
 client/server model esp
ons
 client: browser e
that requests, t
receives, (using u es
req server
HTTP protocol) T P nse
HT po running
and “displays” P res
Apache Web
Web objects HT
T
server
 server: Web
server sends iphone running
(using HTTP Safari browser
protocol) objects
in response to
requests
Application Layer 2-3
HTTP overview

uses TCP: HTTP is


 client initiates TCP “stateless”
connection (creates  server maintains
socket) to server, no information
port 80 about past client
requests
 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
Application Layer 2-4
HTTP connections

non-persistent HTTP persistent HTTP


 at most one object sent
 multiple
over TCP
objects
connection can be sent over
single TCP
 connection then closed
connection
 downloading multiple objects required
multiple connections between client,
server

Application Layer 2-5


Non-persistent HTTP
suppose user enters URL: (contains text,
www.someSchool.edu/someDepartment/home.index references to 10
jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
(process) at 1b. HTTP server at host
www.someSchool.edu on www.someSchool.edu
port 80 waiting for TCP
connection at port 80.
2. HTTP client sends HTTP “accepts” connection,
request message notifying client
(containing URL) into TCP 3. HTTP server receives
connection socket. request message, forms
Message indicates that response message
client wants object containing requested
someDepartment/home.i object, and sends
time ndex message into its socket
Application Layer 2-6
Non-persistent HTTP (cont.)

4. HTTP server closes TCP


connection.
5. HTTP client receives
response message
containing html file,
displays html. Parsing html
file, finds 10 referenced jpeg
objects
time
6. Steps 1-5 repeated for
each of 10 jpeg objects

Application Layer 2-7


Non-persistent HTTP: response
time
RTT (definition): time for
a small packet to
travel from client to
server and back initiate TCP
HTTP response time: connection
 one RTT to initiate TCP RTT
connection request
file
 one RTT for HTTP
time to
RTT
request and first few transmit
file
bytes of HTTP file
response to return received
 file transmission time
 non-persistent HTTP time time
response time =

2RTT+ file Application Layer 2-8


Persistent HTTP

non-persistent HTTP persistent HTTP:


issues:  server leaves
 requires 2 RTTs per connection open
object after sending
 OS overhead for each response
TCP connection  subsequent HTTP
 browsers often open messages between
parallel TCP same client/server
connections to fetch sent over open
referenced objects connection
 client sends requests
as soon as it
encounters a
referenced object
 as little as one RTT
for all the referenced
Application Layer 2-9
HTTP request message

 two types of HTTP messages: request,


response
 HTTP request message:
 ASCII (human-readable format) carriage return character
line-feed character
request line
(GET, POST, GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
headerAccept-Language: en-us,en;q=0.5\r\n
linesAccept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
carriage return, Keep-Alive: 115\r\n
line feed at start Connection: keep-alive\r\n
\r\n
of line indicates
end of header lines
Application Layer 2-10
HTTP request message: general
format

method sp URL sp version cr lf request


line
header field name value cr lf
header
~
~ ~
~ lines

header field name value cr lf


cr lf

~
~ entity body ~
~ body

GET /index.html HTTP/1.1\r\n

Application Layer 2-11


HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK\r\n
status phrase) Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
header ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
lines Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-8859-1\
r\n
\r\n
data, e.g., data data data data data ...
requested
HTML file
Application Layer 2-12
HTTP response status codes
 status code appears in 1st line in server-to-
client response message.
 some sample codes:
200 OK
 request succeeded, requested object later in this msg
301 Moved Permanently
 requested object moved, new location specified later in
this msg (Location:)
400 Bad Request
 request msg not understood by server
404 Not Found
 requested document not found on this server
505 HTTP Version Not Supported

Application Layer 2-13


Web caches (proxy server)
goal: satisfy client request without involving
origin
 user server
sets browser:
Web accesses via
cache
proxy
 browser sends all HT
TP
req server u est
req
HTTP requests to HT
client TP
ues
t H TTP
o nse
res p origin
cache pon P res
se T server
HT
 object in cache: ues
t
cache returns req e
TT P o ns
p
object H res
T TP
 else cache H

requests object client origin


from origin server, server
then returns
object to client
Application Layer 2-14
More about Web caching
 cache acts as why Web caching?
both client and  reduce response
server time for client
 server for original
requesting client
request
 client to origin server  reduce traffic on an
 typically cache is institution’s access
installed by ISP link
(university,  Internet dense with
company, caches: enables
residential ISP) “poor” content
providers to
effectively deliver
content (so too
Application Layer 2-15
Chapter 2: outline
2.1 principles of
network
applications
 app architectures
 app requirements
2.2 Web and HTTP
2.3 FTP
2.4 electronic mail
 SMTP, POP3,
IMAP
2.5 DNS

Application Layer 2-16


FTP: the file transfer protocol
file transfer
FTP FTP FTP
user client server
interface
user
at host remote file
local file system
system

 transfer file to/from remote host


 client/server model
 client: side that initiates transfer (either
to/from remote)
 server: remote host
 ftp: RFC 959
 ftp server: port 21
Application Layer 2-17
FTP: separate control, data
connections
TCP control connection,
 FTP client contacts FTP server port 21
server at port 21, using
TCP
TCP data connection,
 client authorized over FTP server port 20 FTP
control connection client server
 client browses remote
directory, sends  server opens another
commands over control TCP data connection to
connection transfer another file
 when server receives  control connection:
file transfer command, “out of band”
server opens 2nd TCP  FTP server maintains
data connection (for file) “state”: current
to client directory, earlier
 after transferring one authentication
file, server closes data Application Layer 2-18
FTP commands, responses
sample commands: sample return
 sent as ASCII text codes
over control channel  status code and
 USER username phrase (as in HTTP)
 PASS password  331 Username OK,
 LIST return list of file password required
 125 data
in current directory
 connection
RETR filename already open;
retrieves (gets) file transfer starting
 STOR filename  425 Can’t open
stores (puts) file onto data connection
remote host  452 Error writing
file
Application Layer 2-19

You might also like