HTTP Reading: Section 9.1.2 and 9.4.3 COS 461: Computer Networks Spring 2013 1.

Slides:



Advertisements
Similar presentations
HTTP Reading: Section and COS 461: Computer Networks Spring
Advertisements

HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
HTTP – HyperText Transfer Protocol
Chapter 9 Application Layer, HTTP Professor Rick Han University of Colorado at Boulder
1 HTTP – HyperText Transfer Protocol Part 1. 2 Common Protocols In order for two remote machines to “ understand ” each other they should –‘‘ speak the.
How the web works: HTTP and CGI explained
HTTP and Web Content Delivery COS 461: Computer Networks Spring 2011 Mike Freedman
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
Web Content Delivery Reading: Section and COS 461: Computer Networks Spring 2010 (MW 3:00-4:20 in CS105) Mike Freedman
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July.
Web, HTTP and Web Caching
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
Web Content Delivery Reading: Section and COS 461: Computer Networks Spring 2009 (MW 1:30-2:50 in CS105) Mike Freedman Teaching Assistants:
Hypertext Transport Protocol CS Dick Steflik.
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
Network Protocols: Design and Analysis Polly Huang EE NTU
COMP3016 Web Technologies Introduction and Discussion What is the Web?
HTTP Protocol Specification
FTP (File Transfer Protocol) & Telnet
Mail (smtp), VoIP (sip, rtp)
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
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.
Application Layer 2 Figures from Kurose and Ross
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
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,…
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Sistem Jaringan dan Komunikasi Data #9. DNS The Internet Directory Service  the Domain Name Service (DNS) provides mapping between host name & IP address.
CS640: Introduction to Computer Networks Aditya Akella Lecture 4 - Application Protocols, Performance.
WWW, HTTP, GET, POST, Cookies Svetlin Nakov Telerik Corporation
The HyperText Transfer Protocol. History HTTP has been in use since 1990 (HTTP/0.9) HTTP/1.0 was defined in RFC 1945 (May 1996) and included metainformation.
1 Introductory material. This module illustrates the interactions of the protocols of the TCP/IP protocol suite with the help of an example. The example.
Hui Zhang, Fall Computer Networking Web, HTTP, Caching.
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.
1 CS 4396 Computer Networks Lab TCP/IP Networking An Example.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
CSE 524: Lecture 4 Application layer protocols. Administrative ● Reading assignment Chapter 2 ● Mid-term exam may be delayed to 11/2/2004 – Mostly on.
Appendix E: Overview of HTTP ©SoftMoore ConsultingSlide 1.
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
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.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
Advance Computer Networks Lecture#05 Instructor: Engr. Muhammad Mateen Yaqoob.
Web Server Design Week 7 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/24/10.
Web Technologies Lecture 1 The Internet and HTTP.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
EE 122: Lecture 21 (HyperText Transfer Protocol - HTTP) Ion Stoica Nov 20, 2001 (*)
Overview of Servlets and JSP
LURP Details. LURP Lab Details  1.Given a GET … call a proxy CGI script in the same way you would for a normal CGI request  2.This UDP perl.
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.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
Computer Networking The Web. 2 Web history 1945: Vannevar Bush, “As we may think”, Atlantic Monthly, July, describes the idea of a distributed.
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.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Tiny http client and server
Block 5: An application layer protocol: HTTP
HTTP – An overview.
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
HTTP Protocol Specification
Internet transport protocols services
Web Caching? Web Caching:.
HTTP Hypertext Transfer Protocol
HyperText Transfer Protocol
EE 122: HyperText Transfer Protocol (HTTP)
Hypertext Transfer Protocol (HTTP)
HTTP Hypertext Transfer Protocol
CSCI-351 Data communication and Networks
Presentation transcript:

HTTP Reading: Section and COS 461: Computer Networks Spring

Outline HTTP overview Proxies HTTP caching 2

Two Forms of Header Formats Fixed: Every field (type, length) defined – Fast parsing (good for hardware implementations) – Not human readable – Fairly static (IPv6 ~20 years to deploy) – E.g., Ethernet, IP, TCP headers Variable length headers – Slower parsing (hard to implement in hardware) – Human readable – Extensible – E.g., HTTP (Web), SMTP ( ), XML 3

HTTP Basics (Overview) HTTP over bidirectional byte stream (e.g. TCP) Interaction – Client looks up host (DNS) – Client sends request to server – Server responds with data or error – Requests/responses are encoded in text Stateless – HTTP maintains no info about past client requests – HTTP “Cookies” allow server to identify client and associate requests into a client session 4

HTTP Request 5 “cr” is \r “lf” is \n sp is “ “

HTTP Request Request line – Method GET – return URI HEAD – return headers only of GET response POST – send data to the server (forms, etc.) – URL (relative) E.g., /index.html – HTTP version 6

HTTP Request (cont.) Request headers – Variable length, human-readable – Uses: Authorization – authentication info Acceptable document types/encodings From – user If-Modified-Since Referrer – what caused this page to be requested User-Agent – client software Blank-line Body 7

HTTP Request Example GET /index.html HTTP/1.1 Host: 8

HTTP Request Example GET /index.html HTTP/1.1 Host: Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) Connection: Keep-Alive 9

HTTP Response 10

HTTP Response Status-line – HTTP version (now “1.1”) – 3 digit response code 1XX – informational 2XX – success – 200 OK 3XX – redirection – 301 Moved Permanently – 303 Moved Temporarily – 304 Not Modified 4XX – client error – 404 Not Found 5XX – server error – 505 HTTP Version Not Supported – Reason phrase 11

HTTP Response (cont.) Headers – Variable length, human-readable – Uses: Location – for redirection Server – server software WWW-Authenticate – request for authentication Allow – list of methods supported (get, head, etc) Content-Encoding – E.g x-gzip Content-Length Content-Type Expires (caching) Last-Modified (caching) Blank-line Body 12

HTTP Response Example HTTP/ OK Date: Tue, 27 Mar :49:38 GMT Server: Apache/ (Unix) (Red-Hat/Linux) mod_ssl/2.7.1 OpenSSL/0.9.5a DAV/1.0.2 PHP/4.0.1pl2 mod_perl/1.24 Last-Modified: Mon, 29 Jan :54:18 GMT Accept-Ranges: bytes Content-Length: 4333 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html ….. 13

How to Mark End of Message? Close connection – Only server can do this – One request per TCP connection. Hurts performance. Content-Length – Must know size of transfer in advance No body content. Double CRLF marks end – E.g., 304 never have body content Transfer-Encoding: chunked (HTTP/1.1) – After headers, each chunk is content length in hex, CRLF, then body. Final chunk is length 0. 14

Example: Chunked Encoding HTTP/ OK Transfer-Encoding: chunked 25 This is the data in the first chunk 1A and this is the second one 0 Especially useful for dynamically-generated content, as length is not a priori known – Server would otherwise need to cache data until done generating, and then go back and fill-in length header before transmitting 15

Outline HTTP overview Proxies HTTP caching 16

Proxies End host that acts a broker between client and server – Speaks to server on client’s behalf Why? – Privacy – Content filtering – Can use caching (coming up) 17

Proxies (Cont.) Accept requests from multiple clients Takes request and reissues it to server Takes response and forwards to client 18 client Proxy server client HTTP request HTTP response HTTP request HTTP response origin server origin server

Assignment 1: Requirements Non-caching, HTTP 1.0 proxy – Support only GET requests – No persistent connections: 1 HTTP request per TCP connection Multi-process: use fork() Simple binary that takes a port number –./proxy (proxy listens on port 12345) Work in Firefox & Chrome – Use settings to point browser to your proxy 19

Assignment 1: Requirements What you need from a client request: host, port, and URI path – GET HTTP/1.0 What you send to a remote server: – GET / HTTP/1.0 Host: Connection: close Check request line and header format Forward the response to the client 20

Why Absolute vs. Relative URLs? First there was one domain per server – GET /index.html Then proxies introduced – Need to specify which server – GET Then virtual hosting: multiple domains per server – GET /index.html – Host: Absolute URL still exists for historical reasons and backward compatibility 21

Assignment 1: Requirements Non-GET request? – return “Not Implemented” (code 501) Unparseable request? – return “Bad Request” (code 400) Use provided parsing library 22

Advice Networking is hard – Hard to know what’s going on in network layers – Start out simple, test often Build in steps – Incrementally add pieces – Make sure they work – Will help reduce the effect of “incomplete” information Assume teaching staff is non malicious – ( we aren’t trying to trick you ) 23

Assignment 1 – Getting Started Modify Assn 0 to have server respond – Simple echo of what client sent Modify Assn 0 to handle concurrent clients – Use fork() Create “proxy” server – Simply “repeats” client msg to a server, and “repeats” server msg back Client sends HTTP requests, proxy parses 24

Outline HTTP overview Proxies HTTP caching 25

HTTP Caching Why cache? – Lot of objects don’t change (images, js, css) – Reduce # of client connections – Reduce server load – Reduce overall network traffic; save $$$ 26

Caching is Hard Significant fraction (>50%?) of HTTP objects uncachable – Dynamic data: Stock prices, scores, web cams – CGI scripts: results based on passed parameters – Cookies: results may be based on passed data – SSL: encrypted data is not cacheable – Advertising / analytics: owner wants to measure # hits Random strings in content to ensure unique counting Want to limit staleness of cached objects 27

Validating Cached Objects Timestamps – Server hints when an object “expires” (Expires: xxx) – Server provides last modified date, client can check if that’s still valid – Why the server’s timestamp? Problems – Server replicas won’t agree on time – Objects may go back to previous value, and using time will have you redownload the object There are other ways (look up ETags) 28

Example Cache Check Request GET / HTTP/1.1 Accept-Language: en-us If-Modified-Since: Mon, 29 Jan :54:18 GMT Host: Connection: Keep-Alive 29

Example Cache Check Response HTTP/ Not Modified Date: Tue, 27 Mar :50:51 GMT Connection: Keep-Alive 30

Web Proxy Caches User configures browser: Web accesses via cache Browser sends all HTTP requests to cache – Object in cache: cache returns object – Else: cache requests object from origin, then returns to client 31 client Proxy server client HTTP request HTTP response HTTP request HTTP response origin server origin server

Summary HTTP: Simple text-based file exchange protocol – Support for status/error responses, authentication, client-side state maintenance, cache maintenance How to improve performance – Proxies – Caching – Persistent connections (more later) 32

Pop Quiz! Advantage of “fast retransmit” over timeouts? When are fast retransmits possible? When are timeouts particularly expensive? 33

Pop Quiz! Advantage of “fast retransmit” over timeouts? – No waiting for the timeout When are fast retransmits possible? – Large transfers (lots of segments to trip-dup-ack) When are timeouts particularly expensive? – High RTT, High Bandwidth 34