Presentation is loading. Please wait.

Presentation is loading. Please wait.

World Wide Web r Most Web pages consist of: m base HTML page, and m several referenced objects addressed by a URL r URL has two components: host name and.

Similar presentations


Presentation on theme: "World Wide Web r Most Web pages consist of: m base HTML page, and m several referenced objects addressed by a URL r URL has two components: host name and."— Presentation transcript:

1 World Wide Web r Most Web pages consist of: m base HTML page, and m several referenced objects addressed by a URL r URL has two components: host name and path name: r Client for Web is called a browser: m MS Internet Explorer m Netscape Communicator r Server for Web is called Web server: m Apache m MS Internet Information Server http://www.sci.tamucc.edu/stweb/academics/index.html

2 Hyper Text Transport Protocol (HTTP) r Web’s application layer protocol r client/server model m client: browser that requests Web objects m Web server sends objects in response to requests r Versions of http m http1.0: RFC 1945 m http1.1: RFC 2068 m https: RFC 2660 client Web server http request http response

3 HTTP (contd..) r TCP provides transport service m Client (browser) initiates TCP connection to server running on port 80 m server accepts TCP connection from client m http messages exchanged between client and server (to request, send, and receive Web pages) m TCP connection is closed at end r http is stateless m Server maintains no information about past client requests m Each request is handled independent of each other m If http client receives response message containing html file, containing 10 referenced jpeg objects, the client has to request for each of 10 jpeg objects

4 Non-persistent and Persistent Connections Non-persistent r HTTP/1.0 r Each request is served over a new connection r Each object transfer suffers from slow start Persistent r Default for HTTP/1.1 r Client sends requests for all referenced objects as soon as it receives base HTML. r All requests are served on the same TCP connection But most 1.0 browsers use parallel TCP connections.

5 HTTP Message Format r two types of http messages: request, response r http request message: m ASCII (human-readable format) GET /somedir/page.html HTTP/1.0 User-agent: Mozilla/4.0 Accept: text/html, image/gif,image/jpeg Accept-language:en-us (extra carriage return, line feed) request line (GET, POST, HEAD commands) header lines Carriage return, line feed indicates end of message

6 HTTP Request Message: General Format

7 HTTP Message Format: Response HTTP/1.0 200 OK Date: Wed, 16 Nov 2005 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 14 Nov 2005 …... 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

8 HTTP Response Status Codes 200 OK m request succeeded, requested object later in this message 301 Moved Permanently m requested object moved, new location specified later in this message (Location:) 400 Bad Request m request message not understood by server 404 Not Found m requested document not found on this server 505 HTTP Version Not Supported

9 Sample HTTP Session Using Telnet as Client 1. Telnet to your favorite Web server: telnet falcon.tamucc.edu 80 2. Type in a GET http request: GET /~admiss/sailweb/index.html (hit carriage return twice) 3. Look at response message sent by the server. 4. You may modify any TCP-based client program given in the class to do the same

10 Authentication Authentication goal: control access to server documents r Stateless: client must present authorization in each request r Authorization: typically name, password m authorization: header line in request m if no authorization presented, server refuses access, sends WWW authenticate: header line in response client server usual http request msg 401: authorization req. WWW authenticate: usual http request msg + Authorization:line usual http response msg usual http request msg + Authorization:line usual http response msg time Browser caches name & password so that user does not have to repeatedly enter them.

11 Cookies r Server sends “cookie” to client in response msg Set-cookie: 1678453 r Client presents cookie in later requests cookie: 1678453 r Server matches presented- cookie with server-stored info m authentication m remembering user preferences, previous choices client server usual http request msg usual http response + Set-cookie: # usual http request msg cookie: # usual http response msg usual http request msg cookie: # usual http response msg cookie- spectific action cookie- spectific action

12 Conditional GET r Goal: don’t send object if client has up-to-date stored (cached) version r Client: specify date of cached copy in http request If-modified-since: r Server: response contains no object if cached copy up-to-date: HTTP/1.0 304 Not Modified client server http request msg If-modified-since: http response HTTP/1.0 304 Not Modified object not modified http request msg If-modified-since: http response HTTP/1.1 200 OK … object modified

13 Proxy Server: Web Caching r Client sends all http requests to proxy server r If object at proxy server, proxy server immediately returns object in http response r else requests object from origin server, then returns http response to client Goal: satisfy client request without involving origin server client Proxy server client http request http response http request http response http request http response origin server origin server

14 Benefits of Web Caching r Faster response m Cache “closer” to client r Less traffic to distant servers

15 File Transfer Protocol (FTP) r Transfer file to/from remote host r two parallel TCP connections opened: one for control exchange another for data exchange r ftp: RFC 959 r ftp server m Port 21 for exchange commands, responses between client, and server (control) m Port 20 for file data to/from server (data) r ftp server maintains “state”: current directory, earlier authentication FTP client FTP server TCP control connection port 21 TCP data connection port 20

16 FTP Commands and Responses Sample commands: r Sent as ASCII text over control channel r USER username r PASS password r LIST return list of file in current directory r RETR filename retrieves (gets) file r STOR filename stores (puts) file onto remote host Sample return codes r Status code and phrase (as in http) r 331 Username OK, password required r 125 data connection already open; transfer starting r 425 Can’t open data connection r 452 Error writing file

17 Electronic Mail Three major components: r user agents r mail servers r simple mail transfer protocol: smtp User Agent r “mail reader” r composing, editing, reading mail messages r e.g., Eudora, Outlook, elm, Netscape Messenger r outgoing, incoming messages stored on server user mailbox outgoing message queue mail server user agent user agent user agent mail server user agent user agent mail server user agent SMTP

18 Mail Servers r mailbox contains incoming messages (yet to be read) for user r message queue of outgoing (to be sent) mail messages r smtp protocol between mail servers to send email messages m client: sending mail server m “server”: receiving mail server mail server user agent user agent user agent mail server user agent user agent mail server user agent SMTP

19 Simple Mail Transfer Protocol (SMTP) [RFC 821] r Uses tcp r Transfer email msg m From client to server, port 25 m From sending server to receiving server r Command/response interaction m Commands: ASCII text m Response: status code and phrase r Messages must be in 7-bit ASCII

20 Sample SMTP Session Server: 220 penguin.tamucc.edu Client: HELO admin Server: 250 Hello admin, pleased to meet you Client: MAIL FROM: Server: 250 admin@falcon.tamucc.edu... Sender ok Client: RCPT TO: Server: 250 network@falcon.tamucc.edu... Recipient ok Client: DATA Server: 354 Enter mail, end with "." on a line by itself Client: How are you? Client: Please ignore this test email. Client:. Server: 250 Message accepted for delivery Client: QUIT Server: 221 penguin.tamucc.edu closing connection

21 Try for Yourself r telnet penguin.tamucc.edu 25 r see 220 reply from server r enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands

22 SMTP: Final Words r SMTP uses persistent connections r SMTP requires that message (header & body) be in 7-bit ASCII r Certain character strings are not permitted in message (e.g., CRLF.CRLF). Thus message has to be encoded (usually into either base-64 or quoted printable) r SMTP server uses CRLF.CRLF to determine end of message

23 Mail Message Format (RFC 822) r RFC 822: standard for text message format in an email r header lines, e.g., m To: m From: m Subject: different from smtp commands! r body m the “message”, ASCII characters only header body blank line

24 Message Format: Multimedia Extensions r MIME: multimedia mail extension, RFC 2045, 2056 r Additional lines in msg header declare MIME content type From: admin@sci.tamucc.edu To: network@sci.tamucc.edu Subject: Picture of tamucc MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data....................................base64 encoded data multimedia data type, subtype, parameter declaration method used to encode data MIME version encoded data

25 MIME Types Content-Type: type/subtype; parameters Text r example subtypes: plain, html Image r example subtypes: jpeg, gif Audio r example subtypes: basic (8-bit mu-law encoded), 32kadpcm (32 kbps coding) Video r example subtypes: mpeg, quicktime Application r other data that must be processed by reader before “viewable” r example subtypes: msword, octet-stream

26 Multipart Type From: admin@sci.tamucc.edu To: network@sci.tamucc.edu Subject: Picture of tamucc MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=98766789 --98766789 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Hello, Please find a picture of tamucc. --98766789 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data....................................base64 encoded data --98766789--

27 Mail Access Protocols r SMTP: delivery/storage to receiver’s server r Mail access protocol: retrieval from server m POP: Post Office Protocol [RFC 1939] authorization (agent server) and download m IMAP: Internet Mail Access Protocol [RFC 1730] more features (more complex) manipulation of stored msgs on server m HTTP: Hotmail, Yahoo! Mail, etc. user agent sender’s mail server user agent SMTP POP3 or IMAP receiver’s mail server

28 POP3 Protocol authorization phase r client commands: m user: declare username m pass: password r server responses m +OK m -ERR transaction phase, client: r list: list message numbers r retr: retrieve message by number r dele: delete r quit Client: list Server: 1 498 Server: 2 912 Server:. Client: retr 1 Server: Server:. Client: dele 1 Client: retr 2 Server: Server:. Client: dele 2 Client: quit Server: +OK POP3 server signing off Server: +OK POP3 server ready Client: user admin Server: +OK Client: pass xxxxxx Server: +OK user successfully logged on


Download ppt "World Wide Web r Most Web pages consist of: m base HTML page, and m several referenced objects addressed by a URL r URL has two components: host name and."

Similar presentations


Ads by Google