Professional Documents
Culture Documents
DEPARTMENT OF CSE
FTP
FTP uses the services of TCP.
It needs two TCP connections.
The well-known port 21 is used
for the control connection
and the well-known
port 20 for the data connection.
Creating
the data
connection
Communication
Using the control connection
NVT
FTP FTP
• ASCII or EBCDIC
– Nonprint
– TELNET
• Image
• File Structure
• Record Structure
• Page Structure
Transmission Mode
• Stream mode
• Block mode
• Compressed mode
Command processing
• Access Commands
• File Management
• Data Formatting
• Port defining
• File transfer
• Miscellaneous
Module 3 Transport Layer and Application Layer
Session 3.7
File transfer
Example 1
Example 2
HTTP
Hypertext Transfer Protocol
• URL
– Uniform Resource Locator
– Refers to an existing protocol
• http:, wais:, ftp:, mailto:, gopher:, news:
– Points to a document on a specific server
• URN
– Uniform Resource Name
– Globally unique, persistent identifier
• Independent of location
22
Module 3 Transport Layer and Application Layer
Session 3.7
Uniform Resources
• URI
– Uniform Resource Identifier
– Collection of URL’s and URN’s
23
Module 3 Transport Layer and Application Layer
Session 3.7
URL
25
Module 3 Transport Layer and Application Layer
Session 3.7
URL and HTTP
27
Module 3 Transport Layer and Application Layer
Session 3.7
Web Documents
– html
– ASCII text
– Preformatted
• postscript
– Images
• GIF
• JPEG
– Video
• MPEG
– VRML
– Java
28
Module 3 Transport Layer and Application Layer
Session 3.7
Communication
29
Module 3 Transport Layer and Application Layer
Session 3.7
Communication
31
Module 3 Transport Layer and Application Layer
Session 3.7
Gateways
32
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
33
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
34
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• HTTP request
– Method
– URI
– Protocol version
– Optional other information
– Method [Request URI] HTTP/1.0 <CRLF>
35
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• Method
– Get
• Returns object
– Head
• Returns information about object
– Post
• Sends information to be stored on server or as input
to script
36
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• Method
– Put
• Sends new copy of existing object to server
• Usually not allowed
– Delete
• Deletes object
• Usually not allowed
37
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• Other information
– User Agent
• Kind of browser
– If-Modified-Since
• Returns object only if more recent than given date
• Otherwise returns status code 304
38
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• Other information
– Accept
• Mime types which browser can accept
– Multipurpose Internet Mail Extension
» text/plain
» text/html
» application/postscript
» image/gif
» image/jpeg
» audio/basic
» video/mpeg
» x-world/x-vrml
39
Module 3 Transport Layer and Application Layer
HTTP 1.0
• Other information
– Authorization
• User password
GET /X/Y/Z.HTML HTTP 1.0
User Agent: Prodigy-WB/1.3e
Accept: text/plain
Accept: text/html
Accept: application/postscript
Accept: image/gif
– Accept: */*
40
Session 3.7
HTTP 1.0
• HTTP response
– Status line
• HTTP-version Status-code Reason
• Status-codes 1xx - Informational
– Reserved for future use
41
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• HTTP response
– Status line
• Status-codes 2xx - Success
– The action was successfully received, understood, and
accepted
» 200 OK
» 201 POST command successful
» 202 Request accepted
» 203 GET or HEAD request
fulfilled
» 204 No content
42
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• HTTP response
– Status line
• Status-codes 3xx - Redirection
– Further action must be taken in order to complete request
» 300 Resource found at multiple
locations
» 301 Resource moved permanently
» 302 Resource moved temporarily
» 304 Resource has not modified (since date)
43
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• HTTP response
– Status line
• Status-codes 4xx - Client error
– The request contains bad syntax or cannot be fulfilled
» 400 Bad request from client
» 401 Unauthorized request
» 402 Payment required for request
» 403 Resource access forbidden
» 404 Resource not found
» 405 Method not allowed for resource
» 406 Resource type not acceptable
44
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• HTTP response
– Status line
• Status-codes 5xx - Server error
– The server failed to fulfill an apparently valid request
» 500 Internal server error
» 501 Method not implemented
» 502 Bad gateway or server
overload
» 503 Service unavailable / gateway
timeout
» 504 Secondary gateway / server
timeout
45
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• HTTP response
– Description of information
• Server Type of server
• Date Date and time
• Content-Length Number of bytes
• Content-Type Mime type
• Content-Language English, for example
• Content-Encoding Data compression
• Last-Modified Date when last modified
• Expires Date when file becomes
invalid
46
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0
• Problems
– HTTP is stateless
• Each request requires separate TCP connection
• Server doesn’t remember previous requests
47
Module 3 Transport Layer and Application Layer
Session 3.7
Outline
Background
Structure
Protocols
48
Module 3 Transport Layer and Application Layer
Session 3.7
WWW Background
• 1989-1990 – Tim Berners-Lee invents the World Wide
Web at CERN
– Means for transferring text and graphics simultaneously
– Client/Server data transfer protocol
• Communication via application level protocol
• System ran on top of standard networking infrastructure
– Text mark up language
• Not invented by Bernes-Lee
• Simple and easy to use
• Requires a client application to render text/graphics
49
Module 3 Transport Layer and Application Layer
Session 3.7
WWW History contd.
• 1994 – Mark Andreesen invents MOSAIC at National Center for
Super Computing Applications (NCSA)
– First graphical browser
– Internet’s first “killer app”
– Freely distributed
– Became Netscape Inc.
• 1995 (approx.) – Web traffic becomes dominant
– Exponential growth
– E-commerce
– Web infrastructure companies
– World Wide Web Consortium
• Reference: “Web Protocols and Practice”, Krishnamurthy and
Rexford
50
Module 3 Transport Layer and Application Layer
Session 3.7
WWW Components
• Structural Components
– Clients/browsers – to dominant implementations
– Servers – run on sophisticated hardware
– Caches – many interesting implementations
– Internet – the global infrastructure which facilitates data transfer
• Semantic Components
– Hyper Text Transfer Protocol (HTTP)
– Hyper Text Markup Language (HTML)
• eXtensible Markup Language (XML)
– Uniform Resource Identifiers (URIs)
51
Module 3 Transport Layer and Application Layer
Session 3.7
Quick Aside – Web server use
52
Module 3 Transport Layer and Application Layer
Session 3.7
WWW Structure
• Clients use browser application to send URIs via HTTP to servers
requesting a Web page
• Web pages constructed using HTML (or other markup language)
and consist of text, graphics, sounds plus embedded files
• Servers (or caches) respond with requested Web page
– Or with error message
• Client’s browser renders Web page returned by server
– Page is written using Hyper Text Markup Language (HTML)
– Displaying text, graphics and sound in browser
– Writing data as well
• The entire system runs over standard networking protocols
(TCP/IP, DNS,…)
53
Module 3 Transport Layer and Application Layer
Session 3.7
54
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Basics
• Protocol for client/server communication
– The heart of the Web
– Very simple request/response protocol
• Client sends request message, server replies with response message
– Stateless
– Relies on URI naming mechanism
• Three versions have been used
– 09/1.0 – very close to Berners-Lee’s original
• RFC 1945 (original RFC is now expired)
– 1.1 – developed to enhance performance, caching, compression
• RFC 2068
– 1.0 dominates today but 1.1 is catching up
55
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Request Messages
• GET – retrieve document specified by URL
• PUT – store specified document under given URL
• HEAD – retrieve info. about document specified by URL
• OPTIONS – retrieve information about available options
• POST – give information (eg. annotation) to the server
• DELETE – remove document specified by URL
• TRACE – loopback request message
• CONNECT – for use by caches
56
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Request Format
57
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Response Format
60
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP/1.0 Network Interaction
• Clients make requests to port 80 on servers
– Uses DNS to resolve server name
• Clients make separate TCP connection for each URL
– Some browsers open multiple TCP connections
• Netscape default = 4
• Server returns HTML page
– Many types of servers with a variety of implementations
– Apache is the most widely used
• Freely available in source form
• Client parses page
– Requests embedded objects
61
Module 3 Transport Layer and Application Layer
Session 3.7
62
Session 3.7
63
Session 3.7
HTML Basics
• Hyper-Text Markup Language
– A subset of Standardized General Markup Language (SGML)
– Facilitates a hyper-media environment
• Embedded links to other documents and applications
• Documents use elements to “mark up” or identify sections of text
for different purposes or display characteristics
• Mark up elements are not seen by the user when page is displayed
• Documents are rendered by browsers
• NOTE: Not all documents in the Web are HTML!
• Most people use WYSIWYG editors (MS Word) to generate
HTML
64
Module 3 Transport Layer and Application Layer
Session 3.7
HTML Example
<HTML>
<HEAD>
<TITLE> PB’s HomePage </TITLE>
</HEAD>
<BODY>
<CENTER><IMG SRC = “bad_picture.gif” ALT = “ “><BR></CENTER>
<P><CENTER><H1>UW Computer Science Department</H1></CENTER>
Welcome to my goofy HomePage!
…
<A HREF = http://www.cs.wisc.edu/~pb/mydogs_page.html> Spot’s Page </A>
</BODY>
</HTML>
65
Module 3 Transport Layer and Application Layer