Docsity

HTTP, Cookies, FTP, and SMTP: Networking Protocols and State Persistence, Study notes of Computer Systems Networking and Telecommunications

Partial preview of the text

Download HTTP, Cookies, FTP, and SMTP: Networking Protocols and State Persistence and more Study notes Computer Systems Networking and Telecommunications in PDF only on Docsity!

  • NetworkedApplication: Cookies,FTP, SMTP, POP
    • CS 242: Computer NetworksWeek 04: Monday, 09/24/07Daniel BilarWellesley CollegeFall

Goals today 

Progress reports



Review from last time



HTTP protocol request and response messages



Connection persistence: HTTP 1.0 vs HTTP 1.



Appreciate the smart edge in action with state persistence in HTTPvia Cookies



Get a tour of the File Transfer Protocol



Separate command and data channels



..and a tour of email



Three parts of SMTP



Difference between SMTP (push) and POP3 (pull) protocol



Some enhancements like MIME



Realize that cookies (HTTP), MIME (email) can be seenas ‘smart edge’ enhancements

Some slides and pictures gratefully acknowledged from Kurose, Shull,

Tannenbaum

Review: HTTP Transport and state Uses layer 4 transport

protocol TCP:

Client initiates TCP connection(creates socket) to server, port 80

Server accepts TCP connectionfrom 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 noinformation aboutpast client requests

Protocols that maintain

“state” are complex!



Past history (state)must be maintained



We’ll see this shortlywith cookies

aside

Review: HTTP Request 

Two types of HTTP messages:

request

,

response

HTTP request message:

GET /somedir/page.html HTTP/1.1Host: www.someschool.eduUser-agent: Mozilla/4.0Connection: closeAccept-language:fr (extra carriage return, line feed)

request line

(GET, POST,

HEAD commands)

header

lines

Carriage return,

line feed

indicates end

of message

Review: HTTP/1.0 - Nonpersistent

1a.

Client initiates a TCP connec-tion to

www.someSchool.edu

on port 80.

Client sends HTTP request for /someDepartment/home.index to TCP socket set up in

1a.

Server at host www.someSchool.edu

accepts

connection and acknowledges.

Server receives messagethrough socket, finds,encapsulates, and sendsobject in HTTP response.

Client receives responsemessage. TCP connectionterminates. Clientextracts file, examinesHTML, and requests otherobjects.

Server instructs TCP socketto initiate TCP connectiontear-down (but first waits tohear from client first to seethe message got there intact).

First four steps are repeatedfor each referenced object.

Review: Non-Persistent HTTP Definition of RTT:

time to send a

small packet to travel fromclient to server and back.

Response time: 

one RTT to initiate TCPconnection



one RTT for HTTP request andfirst few bytes of HTTPresponse to return



file transmission time

total = 2RTT+transmit time Question is:Can we speed things up?

time totransmitfile

initiate TCPconnection

RTT

requestfile

RTT

filereceived

time

time

Benefits of Persistent HTTP Nonpersistent HTTP issues: 

requires 2 RTTs per object



OS overhead for

each

TCP

connection



browsers often open parallelTCP connections to fetchreferenced objects

Persistent HTTP 

server leaves connection openafter sending response



subsequent HTTP messagesbetween same client/serversent over open connection

Persistent

without

pipelining:



client issues new requestonly when previous responsehas been received



one RTT for each referencedobject

Persistent

with

pipelining:



default in HTTP/1.



client sends requests as soonas it encounters a referencedobject



as little as one RTT for allthe referenced objects

Can you think of drawbacks?

Maintaining State 

HTTP is

stateless

, but sometimes the server wants to

remember bits of the conversation



Why would this be useful? Where have you encountered this inyour life?



In Computerese, remembering the past is called“maintaining state”



Cookies can be used to create a ‘user session’ layer on topof the stateless HTTP



This can be viewed as example of ‘smart edge’ philosophy



Other tracking methods from the server include hiddenform fields, IP addresses, basic authorization but wewon’t go into these (yet)

Cookies: Keeping State (cont.)

client

server

usual http response msg usual http response msg

cookie file

one week later:

usual http request msg

cookie: 1678

cookie- specific

action

access

ebay 8734

usual http request msg

Amazon server

creates ID

1678 for user

create

entry

usual http response

Set-cookie: 1678

ebay 8734amazon 1678

usual http request msg

cookie: 1678

cookie- specific

action

access

ebay 8734amazon 1678

backenddatabase

Cookies as a distributed database

Cookies – Convenience vs privacy

What cookies do for you: 

Authorization



Shopping carts



Recommendations



User session state (Webe-mail)

What cookies do for

them (and your privacy):

Cookies permit sitesto learn a lot aboutyou (like what?)

aside



What all this electronic tracking ability means to ourcherished right to privacy

(The

Monitored

and the

Searchable

“The Architecture of Privacy” (Lessig, 1998) at http://cyber.law.harvard.edu/works/lessig/architecture_priv.pdf

Cookies and privacy

FTP: separate control, data connections

FTP client contacts FTPserver at port 21, TCP istransport protocol

Client authorized overcontrol connection

client browses remotedirectory by sendingcommands over controlconnection.

when server receives filetransfer command, serveropens

nd

TCP connection

(for file) to client

after transferring one file,server closes dataconnection.

FTP

client

FTP

server

TCP control connection

port 21

TCP data connection

port 20



Server opens another TCPdata connection totransfer another file



Control connection:

“out

of band”



FTP server maintains“state”: current directory,earlier authentication

FTP and HTTP 

FTP, like HTTP, runs on top of TCP.

However, unlike HTTP, FTP uses two parallelTCP connections to transfer a file, a

control

connection

and a

data connection

. We say FTP

sends its control information

out-of band.

Also unlike HTTP, FTP maintains state



In particular, FTP remembers the currentdirectory and earlier authentication.