3: Application Protocols: HTTP

Slides:



Advertisements
Similar presentations
HyperText Transfer Protocol (HTTP)
Advertisements

Application Layer-11 CSE401N: Computer Networks Lecture-4 Application Layer Overview HTTP.
Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP  FTP  SMTP / POP3 / IMAP  Focus on client-server.
2: Application Layer1 Chapter 2: Application Layer Our goals: r conceptual, implementation aspects of network application protocols m transport-layer service.
Chapter 2: Application Layer
HyperText Transfer Protocol (HTTP) Computer Networks Computer Networks Spring 2012 Spring 2012.
9/16/2003-9/18/2003 The Application Layer and Java Programming September 16-18, 2003.
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July.
Week 11: Application Layer1 Week 11: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
Web, HTTP and Web Caching
2: Application Layer1 Chapter 2: Application Layer Our goals: r conceptual, implementation aspects of network application protocols m transport-layer service.
Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP  FTP  SMTP / POP3 / IMAP  Focus on client-server.
1 K. Salah Module 2.1: Application Layer Application-level protocols provide high-level services –Web and HTTP –DNS –Electronic mail –Remote login –FTP.
Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP  FTP  SMTP / POP3 / IMAP  Focus on client-server.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
EEC-484/584 Computer Networks Lecture 4 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
2: Application Layer World Wide Web (WWW). Introduction 1-2 Internet protocol stack (recap) r application: supporting network applications m FTP,
1 Application Layer Lecture 4 Imran Ahmed University of Management & Technology.
CS 3830 Day 7 Introduction : Application Layer 2 Processes communicating Process: program running within a host. r within same host, two processes.
FTP (File Transfer Protocol) & Telnet
Mail (smtp), VoIP (sip, rtp)
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
2: Application Layer1 CS 4244: Internet Software Development Dr. Eli Tilevich.
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
20-1 Last time □ NAT □ Application layer ♦ Intro ♦ Web / HTTP.
2: Application Layer1 Internet apps: their protocols and transport protocols Application remote terminal access Web file transfer streaming multimedia.
Week 11: Application Layer1 Web and HTTP First some jargon r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,…
Introduction 1 Lecture 6 Application Layer (HTTP) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science & Engineering.
2: Application Layer1 Web and HTTP First some jargon Web page consists of base HTML-file which includes several referenced objects Object can be HTML file,
1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW p Waleed Ejaz
Sockets process sends/receives messages to/from its socket
1 HTTP EECS 325/425, Fall 2005 September Chapter 2: Application layer r 2.1 Principles of network applications m app architectures m app requirements.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.
Lecture 23 Application Layer ELEN E6761: Communication Networks Instructor: Javad Ghaderi Slides adapted from “Computer Networking: A Top Down Approach”
Application Layer 2-1 Lecture 4: Web and HTTP. Web and HTTP First, a review… web page consists of objects object can be HTML file, JPEG image, Java applet,
Important r There will be NO CLASS on Friday 1/30/2015! r Please mark you calendars 1.
2: Application Layer 1 Chapter 2: Application layer r 2.1 Principles of network applications  app architectures  app requirements r 2.2 Web and HTTP.
Advance Computer Networks Lecture#05 Instructor: Engr. Muhammad Mateen Yaqoob.
3: Application Protocols: HTTP
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
EEC-484/584 Computer Networks Lecture 4 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Week 11: Application Layer 1 Web and HTTP r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,… r Web page consists.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Lecture 5 Internet Core: Protocol layers. Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP 
2: Application Layer 1 Chapter 2 Application Layer These ppt slides are originally from the Kurose and Ross’s book. But some slides are deleted and added.
Introduction to Networks
Application Layer Dr. Adil Yousif Lecture 2 CS.
Chapter 2: Application Layer
Block 5: An application layer protocol: HTTP
HTTP request message: general format
Application layer 1 Principles of network applications 2 Web and HTTP
04 - World Wide Web (WWW) 2: Application Layer.
Lecture 2 Dr. Richard Spillman Fall 2009
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
Internet transport protocols services
Chapter 2 Application Layer
Introduction to Networks
CS4470 Computer Networking Protocols
Computer Communication & Networks
EEC-484/584 Computer Networks
لایه ی کاربرد مظفر بگ محمدی 2: Application Layer.
CS 5565 Network Architecture and Protocols
EEC-484/584 Computer Networks
EEC-484/584 Computer Networks
The Application Layer: HTTP
Chapter 2 Application Layer
Chapter 2: Application Layer
CS1652 September 4th, 2012 Jack Lange University of Pittsburgh
Presentation transcript:

3: Application Protocols: HTTP Last Modified: 4/14/2019 1:51:15 AM 2: Application Layer

Top-down: Internet protocol stack users network Application HTTP, SMTP, FTP, TELNET, DNS, … Transport TCP, UDP. Network IP Physical Point-to-point links, LANs, radios, ... 2: Application Layer

Protocol A protocol defines the format and the order of messages exchanged between communicating entities as well as the actions taken on the receipt or the transmission of a message.

Applications and application-layer protocols Application: communicating, distributed processes running in network hosts in “user space” exchange messages to implement app e.g., email, file transfer, the Web Application-layer protocols one “piece” of an app (web browser do more than speak HTTP) define messages exchanged by apps and actions taken user services provided by lower layer protocols application transport network data link physical 2: Application Layer

Client-server paradigm Typical network app has two pieces: client and server application transport network data link physical reply request Server: Running first (always?) provides requested service to client e.g., Web server sends requested Web page, mail server delivers e-mail Client: initiates contact with server (usually “speaks” first) typically requests service from server, for Web, client is implemented in browser; for e-mail, in mail reader 2: Application Layer

Network Applications Drive Network Design Important to remember that network applications are the reason we care about building a network infrastructure Applications range from text based command line ones popular in the 1980s (like telnet, ftp, news, chat, etc) to multimedia applications (Web browsers, audio and video streaming, real-time video conferencing, etc.) 2: Application Layer

What is the Internet used for? Credit: CAIDA (1999) 2: Application Layer

HTTP 2: Application Layer

http example Suppose user enters URL www.someSchool.edu/someDepartment/home.index (contains text, references to 10 jpeg images) 1a. http client initiates TCP connection to http server (process) at www.someSchool.edu. Port 80 is default for http server. 1b. http server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client 2. http client sends http request message (containing URL) into TCP connection socket 3. http server receives request message, forms response message containing requested object (someDepartment/home.index), sends message into socket time 2: Application Layer

http example (cont.) time 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 6. Steps 1-5 repeated for each of 10 jpeg objects time 2: Application Layer

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

http request message: general format 2: Application Layer

RFCs Lets check out RFC 2616 together Also 7230, 7231 Compare to 1945 and 2068 2: Application Layer

Methods "OPTIONS" ; Section 9.2 | "GET" ; Section 9.3 | "HEAD" ; Section 9.4 | "POST" ; Section 9.5 | "PUT" ; Section 9.6 | "DELETE" ; Section 9.7 | "TRACE" ; Section 9.8 | "CONNECT" ; Section 9.9 | extension-method extension-method = token 2: Application Layer

Absolute URIs More common GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1 RFC says “All HTTP/1.1 servers MUST accept the absoluteURI form in requests, even though HTTP/1.1 clients will only generate them in requests to proxies” – do they? More common GET /pub/WWW/TheProject.html HTTP/1.1 Host: www.w3.org 2: Application Layer

Request Headers Max-Forwards ; Accept ; Section 14.1 Section 14.31 | Proxy-Authorization ; Section 14.34 | Range ; Section 14.35 | Referer ; Misspelled  Section 14.36 | TE ; Section 14.39 | User-Agent ; Section 14.43 Accept ; Section 14.1 Accept-Charset ; Section 14.2 Accept-Encoding ; Section 14.3 Accept-Language ; Section 14.4 Authorization ; Section 14.8 Expect ; Section 14.20 From ; Section 14.22 Host ; Section 14.23 If-Match ; Section 14.24 If-Modified-Since ; Section 14.25 If-None-Match ; Section 14.26 If-Range ; Section 14.27 If-Unmodified-Since ; Section 14.28 2: Application Layer

http message format: response status line (protocol status code status phrase) HTTP/1.0 200 OK 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 ... header lines data, e.g., requested html file 2: Application Layer

http response status codes In first line in server->client response message. A few sample 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 2: Application Layer

Lots of information is leaked/shared Versions of software Very chatty protocol Lots of information is leaked/shared Versions of software Languages preferred Installed plugins 2: Application Layer

Uniform Resource Locator (URL) protocol://authority:port/p/a/th/item_name?query protocol = http (ftp , file,…) authority = server machine port = 80 by default /p/a/th/item_name = specifies a file to be returned or possibly a program to be executed to produce the file to be returned query = data to be interpreted by server RFC 1738, "Uniform Resource Locators (URL)“ RFC 2396, “Uniform Resource Identifiers (URI): Generic Syntax and Semantics” 2: Application Layer

HTTPS Compression Lots of redirection 2: Application Layer

Stateless vs Stateful 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 2: Application Layer

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

Authentication (and statelessness) Authentication goal: control access to server documents stateless: client must present authorization in each request authorization: typically name, password authorization: header line in request if no authorization presented, server refuses access, sends WWW authenticate: header line in response Authorization will go with each request to server 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 time usual http response msg Browser caches name & password so that user does not have to repeatedly enter it. 2: Application Layer

Cookies (and statelessness ?) client server server sends “cookie” to client in response mst Set-cookie: client presents cookie in later requests cookie: server matches presented-cookie with server-stored info authentication remembering user preferences, previous choices Get client to remember “state” so server can be stateless! usual http request msg usual http response + Set-cookie: # usual http request msg cookie: # cookie- spectific action usual http response msg usual http request msg cookie: # cookie- spectific action usual http response msg 2: Application Layer

Older history Application-level protocol for distributed, collaborative, hypermedia information systems. 1st version HTTP/0.9 (1990), was a simple protocol for raw data transfer across the Internet. HTTP/1.0, as defined by RFC 1945 [6], improved the protocol by allowing messages to be in the format of MIME-like messages, containing meta information about the data transferred and modifiers on the request/response semantics. HTTP/1.0 does not sufficiently take into consideration the effects of hierarchical proxies, caching, the need for persistent connections, or virtual hosts. Proliferation of incompletely-implemented applications calling themselves "HTTP/1.0" necessitated a protocol version change in order for two communicating applications to determine each other's true capabilities. 2: Application Layer

HTTP 1.1 : Persistent connections Non-persistent HTTP/1.0 server parses request, responds, and closes TCP connection Each object transfer suffers from TCP connection setup overhead 2 RTTs to fetch each object Persistent default for HTTP/1.1 on same TCP connection: server, parses request, responds, parses new request,.. Client sends requests for all referenced objects as soon as it receives base HTML. Fewer RTTs Most browsers use parallel TCP connections. 2: Application Layer

Non-Persistent HTTP: Response time definition of RTT: time for 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 received time Application 2-28

Other Features in HTTP 1.1 Hostname Identification Content Negotiation Allows one physical web server to serve content for multiple logical servers Content Negotiation Allows client to request a specific version of a resource Chunked Transfers For dynamic content, server needn’t specify all characteristics like size ahead of time Byte Ranges Clients can ask for small pieces of documents Support for Proxies and Caches 2: Application Layer

Trying out http (client side) for yourself 1. Telnet to your favorite Web server: telnet www.google.com 80 Opens TCP connection to port 80 (default http server port) at www.google.com. Anything typed in sent to port 80 www.google.com 2. Type in a GET http request: By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to http server GET / HTTP/1.0 NOTE: Download putty and choose never close on exit and Raw mode! Control ] in windows telnet (?) telnet www.cornell.edu 80 GET telnet www.cs.cornell.edu 80 GET / HTTP/1.1 Host: www.cs.cornell.edu GET /courses/ HTTP/1.1 HEAD / HTTP/1.1 GET / HTTP/1.0 3. Look at response message sent by http server! 2: Application Layer

Connection closed by foreign host. Connection closed by foreign host. HTTP 1.0 vs 1.1 1. HTTP 1.0 telnet www.google.com 80 GET / HTTP/1.0 <send data > Connection closed by foreign host. 2. HTTP 1.1 telnet www.google.com 80 GET / HTTP/1.1 <send data> GET / HTTP/1.0 <send data > Connection closed by foreign host. telnet www.cs.cornell.edu 80 GET / HTTP/1.1 Host: www.cs.cornell.edu GET /courses/ HTTP/1.1 HEAD / HTTP/1.1 GET / HTTP/1.0 2: Application Layer

Experiment yourself 1. Try some headers telnet www.google.com 80 GET / HTTP/1.1 Host: www.google.com 2. Try a real query (look at syntax of URL when you use google) 3. Try a chunked transfer 4. Try cookies 5. Try authorization required 2: Application Layer

The Web: the http protocol http: hypertext transfer protocol Web’s application layer protocol client/server model client: browser that requests, receives, “displays” Web objects server: Web server has access to storage containing a set of Web documents; sends copies in response to requests http1.0: RFC 1945 http1.1: RFC 2616 http request Desktop Running Web browser http response Web server 2: Application Layer

For the record: HTTP vs HTML HTML format is highly specified but is just considered the data or body of an HTTP message HTML is not part of the HTTP protocol Example of layering: each layer speaks to a peer layer in an agreed upon language or protocol In this case, both are processed by the web browser. The web browser is both an HTTP client and an HTML parser. Berners-Lee, T. and D. Connolly, "Hypertext Markup Language - 2.0", RFC 1866, November 1995. 2: Application Layer

What type of objects are fetched? Static: Stored in a file and unchanging ( static html, pictures, style sheets, etc.) Dynamic: Formed by server on demand in response to a request Output from a program Often use query data sent with URL Active: Executed at the client! Computer program (not just output) that can interact with user (e.g. Java applet) Regardless data returned from an HTTP GET request 2: Application Layer

Web Caches (proxy server) Goal: satisfy client request without involving origin server user sets browser: Web accesses via web cache client sends all http requests to web cache if object at web cache, web cache immediately returns object in http response else requests object from origin server, then returns http response to client origin server Proxy server http request http request client http response http response http request http request http response http response client origin server 2: Application Layer

Why Web Caching? origin servers Assume: cache is “close” to client (e.g., in same network) smaller response time: cache “closer” to client decrease traffic to distant servers link out of institutional/local ISP network often bottleneck Other reasons? Anonymity? Translation for low feature clients (ex. PDAs) public Internet 1.5 Mbps access link institutional network 100 Mbps LAN institutional cache 2: Application Layer

Why not web caching? It adds time to a requests that miss in the cache Servers don’t see accurate number of hits to their content To collect information on who is requesting what, extract fees, etc. 2: Application Layer

Outtakes 2: Application Layer

HTML overview Markup language give general layout guidelines - not exact placement or format- so browsers may display the same document differently Free form (i.e. Spaces don’t matter) Embedded tags give guidelines Tags often appear in pairs beginning <TAGNAME> ending </TAGNAME> 2: Application Layer

How do clients and servers communicate? API: application programming interface defines interface between application and transport layer socket: Internet API two processes communicate by sending data into socket, reading data out of socket Q: how does a process “identify” the other process with which it wants to communicate? IP address of host running other process “port number” - allows receiving host to determine to which local process the message should be delivered … more on this later. 2: Application Layer

Sockets Specify Transport Services Sockets define the interfaces between an application and the transport layer Applications choose the type of transport layer by choosing the type of socket UDP Sockets – called DatagramSocket in Java, SOCK_DGRAM in C TCP Sockets – called Socket/ServerSocket in Java, SOCK_STREAM in C Client and server agree on the type of socket, the server port number and the protocol 2: Application Layer

QUICK LOOK AHEAD: TCP vs UDP TCP service: connection-oriented: setup required between client, server reliable transport between sending and receiving process flow control: sender won’t overwhelm receiver congestion control: throttle sender when network overloaded does not provide: timing or minimum bandwidth guarantees UDP service: unreliable data transfer between sending and receiving process does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee 2: Application Layer

Protocol stack user X English user Y e-mail client e-mail server SMTP TCP server TCP server TCP IP server IP IP server Peers exchange units meaningful to each end; communicate Uses services of lower layer to avoid complexity IEEE 802.3 standard ethernet driver/card ethernet driver/card electric signals 2: Application Layer

Method types HTTP/1.0 GET POST HEAD HTTP/1.1 GET, POST, HEAD PUT 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 Application 2-45

User-server state: cookies example: Susan always access Internet from PC visits specific e-commerce site for first time when initial HTTP requests arrives at site, site creates: unique ID entry in backend database for ID many Web sites use cookies four components: 1) cookie header line of HTTP response message 2) cookie header line in HTTP request message 3) cookie file kept on user’s host, managed by user’s browser 4) back-end database at Web site Application 2-46

Cookies: keeping “state” (cont.) client server ebay 8734 usual http request msg Amazon server creates ID 1678 for user create entry cookie file usual http response Set-cookie: 1678 ebay 8734 amazon 1678 usual http request msg cookie: 1678 cookie- specific action access usual http request msg cookie: 1678 cookie- specific action access usual http response msg backend database one week later: ebay 8734 amazon 1678 usual http response msg Application 2-47