CPSC 4411 HTTP Protocol r Slides originally from Williamson at Calgary r Minor modifications are made.

Slides:



Advertisements
Similar presentations
Hypertext Transfer PROTOCOL ----HTTP Sen Wang CSE5232 Network Programming.
Advertisements

CSE534 – Fundamentals of Computer Networks Lecture 11: HTTP/Web (The Internet’s first killer app) Based on slides from Kurose + Ross, and Carey Williamson.
1 Network Measurements of a Wireless Classroom Network Carey Williamson Nuha Kamaluddeen Department of Computer Science University of Calgary.
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
Web basics HTTP – – URI/L/Ns – HTML –
1 HTTP – HyperText Transfer Protocol Part 1. 2 Common Protocols In order for two remote machines to “ understand ” each other they should –‘‘ speak the.
16-Jun-15 HTTP Hypertext Transfer Protocol. 2 HTTP messages HTTP is the language that web clients and web servers use to talk to each other HTTP is largely.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
How the web works: HTTP and CGI explained
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
Definitions, Definitions, Definitions Lead to Understanding.
HTTP and TCP: A Review Carey Williamson iCORE Chair and Professor Department of Computer Science University of Calgary.
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.
HTTP Overview Vijayan Sugumaran School of Business Administration Oakland University.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
HyperText Transfer Protocol (HTTP) Review Carey Williamson iCORE Chair and Professor Department of Computer Science University of Calgary Slide content.
Hypertext Transport Protocol CS Dick Steflik.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
PL-IV- Group A HTTP Request & Response Header
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
University of Calgary – CPSC 441 Parts of these slides are courtesy of Erich Nahum (IBM Research)
HTTP Protocol Specification
FTP (File Transfer Protocol) & Telnet
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
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.
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,…
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
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
Web HTTP Hypertext Transfer Protocol. Web Terminology ◘Message: The basic unit of HTTP communication, consisting of structured sequence of octets matching.
HyperText Transfer Protocol (HTTP) RICHI GUPTA CISC 856: TCP/IP and Upper Layer Protocols Fall 2007 Thanks to Dr. Amer, UDEL for some of the slides used.
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.
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)
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination.
EE 122: Lecture 21 (HyperText Transfer Protocol - HTTP) Ion Stoica Nov 20, 2001 (*)
CS 6401 The World Wide Web Outline Background Structure Protocols.
Overview of Servlets and JSP
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):
HyperText Transfer Protocol (HTTP) Deepti Kulkarni CISC 856: TCP/IP and Upper Layer Protocols Fall 2008 Acknowledgements Professor Amer Richi Gupta.
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.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Block 5: An application layer protocol: HTTP
How HTTP Works Made by Manish Kushwaha.
HTTP – An overview.
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
ISC440: Web Programming 2 Web Servers
Computer Communication & Networks
HTTP Review Carey Williamson Department of Computer Science
HTTP Hypertext Transfer Protocol
HTTP and TCP Carey Williamson Department of Computer Science
EE 122: HyperText Transfer Protocol (HTTP)
Hypertext Transfer Protocol (HTTP)
Carey Williamson Department of Computer Science University of Calgary
Carey Williamson Department of Computer Science University of Calgary
HTTP Hypertext Transfer Protocol
Presentation transcript:

CPSC 4411 HTTP Protocol r Slides originally from Williamson at Calgary r Minor modifications are made

CPSC 4412 Introduction to HTTP r HTTP: HyperText Transfer Protocol m Communication protocol between clients and servers m Application layer protocol for WWW r Client/Server model: m Client: browser that requests, receives, displays object m Server: receives requests and responds to them r Protocol consists of various operations m Few for HTTP 1.0 (RFC 1945, 1996) m Many more in HTTP 1.1 (RFC 2616, 1999) Laptop w/ Netscape Server w/ Apache Desktop w/ Explorer http request http response

CPSC 4413 Request Generation r User clicks on something r Uniform Resource Locator (URL): m m m m ftp://ftp.kernel.org r Different URL schemes map to different services r Hostname is converted from a name to a 32-bit IP address (DNS lookup, if needed) r Connection is established to server (TCP)

CPSC 4414 What Happens Next? r Client downloads HTML document m Sometimes called “container page” m Typically in text format (ASCII) m Contains instructions for rendering (e.g., background color, frames) m Links to other pages r Many have embedded objects: m Images: GIF, JPG (logos, banner ads) m Usually automatically retrieved I.e., without user involvement can control sometimes (e.g. browser options, junkbusters) <meta name=“Author” content=“Erich Nahum”> Linux Web Server Performance Hi There! Here’s lots of cool linux stuff! Click here for more! sample html file

CPSC 4415 Web Server Role r Respond to client requests, typically a browser m Can be a proxy, which aggregates client requests (e.g., AOL) m Could be search engine spider or robot (e.g., Keynote) r May have work to do on client’s behalf: m Is the client’s cached copy still good? m Is client authorized to get this document? r Hundreds or thousands of simultaneous clients r Hard to predict how many will show up on some day (e.g., “flash crowds”, diurnal cycle, global presence) r Many requests are in progress concurrently

CPSC 4416 HTTP Request Format GET /images/penguin.gif HTTP/1.0 User-Agent: Mozilla/0.9.4 (Linux ) Host: Accept: text/html, image/gif, image/jpeg Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso ,*,utf-8 Cookie: B=xh203jfsf; Y=3sdkfjej Messages are in ASCII (human-readable) Carriage-return and line-feed indicate end of headers Headers may communicate private information (browser, OS, cookie information, etc.)

CPSC 4417 Request Types Called Methods: r GET: retrieve a file (95% of requests) r HEAD: just get meta-data (e.g., mod time) r POST: submitting a form to a server r PUT: store enclosed document as URI r DELETE: removed named resource r LINK/UNLINK: in 1.0, gone in 1.1 r TRACE: http “echo” for debugging (added in 1.1) r CONNECT: used by proxies for tunneling (1.1) r OPTIONS: request for server/proxy options (1.1)

CPSC 4418 Response Format HTTP/ OK Server: Tux 2.0 Content-Type: image/gif Content-Length: 43 Last-Modified: Fri, 15 Apr :36:21 GMT Expires: Wed, 20 Feb :54:46 GMT Date: Mon, 12 Nov :29:48 GMT Cache-Control: no-cache Pragma: no-cache Connection: close Set-Cookie: PA=wefj2we0-jfjf Similar format to requests (i.e., ASCII)

CPSC 4419 Response Types r 1XX: Informational (def’d in 1.0, used in 1.1) 100 Continue, 101 Switching Protocols r 2XX: Success 200 OK, 206 Partial Content r 3XX: Redirection 301 Moved Permanently, 304 Not Modified r 4XX: Client error 400 Bad Request, 403 Forbidden, 404 Not Found r 5XX: Server error 500 Internal Server Error, 503 Service Unavailable, 505 HTTP Version Not Supported

CPSC Outline of an HTTP Transaction r This section describes the basics of servicing an HTTP GET request from user space r Assume a single process running in user space, similar to Apache 1.3 r We’ll mention relevant socket operations along the way initialize; forever do { get request; process; send response; log request; } server in a nutshell

CPSC Readying a Server r First thing a server does is notify the OS it is interested in WWW server requests; these are typically on TCP port 80. Other services use different ports (e.g., SSL is on 443) r Allocate a socket and bind()'s it to the address (port 80) r Server calls listen() on the socket to indicate willingness to receive requests r Calls accept() to wait for a request to come in (and blocks) r When the accept() returns, we have a new socket which represents a new connection to a client s = socket(); /* allocate listen socket */ bind(s, 80); /* bind to TCP port 80 */ listen(s); /* indicate willingness to accept */ while (1) { newconn = accept(s); /* accept new connection */b

CPSC Processing a Request r getsockname() called to get the remote host name m for logging purposes (optional, but done by most) r gethostbyname() called to get name of other end m again for logging purposes r gettimeofday() is called to get time of request m both for Date header and for logging r read() is called on new socket to retrieve request r request is determined by parsing the data m “GET /images/jul4/flag.gif” remoteIP = getsockname(newconn); remoteHost = gethostbyname(remoteIP); gettimeofday(currentTime); read(newconn, reqBuffer, sizeof(reqBuffer)); reqInfo = serverParse(reqBuffer);

CPSC Processing a Request (cont) r stat() called to test file path m to see if file exists/is accessible m may not be there, may only be available to certain people m "/microsoft/top-secret/plans-for-world-domination.html" r stat() also used for file meta-data m e.g., size of file, last modified time m "Has file changed since last time I checked?“ r might have to stat() multiple files and directories r assuming all is OK, open() called to open the file fileName = parseOutFileName(requestBuffer); fileAttr = stat(fileName); serverCheckFileStuff(fileName, fileAttr); open(fileName);

CPSC Responding to a Request r read() called to read the file into user space r write() is called to send HTTP headers on socket (early servers called write() for each header!) r write() is called to write the file on the socket r close() is called to close the socket r close() is called to close the open file descriptor r write() is called on the log file read(fileName, fileBuffer); headerBuffer = serverFigureHeaders(fileName, reqInfo); write(newSock, headerBuffer); write(newSock, fileBuffer); close(newSock); close(fileName); write(logFile, requestInfo);

CPSC Network View: HTTP and TCP r TCP is a connection-oriented protocol SYN SYN/ACK ACK GET URL YOUR DATA HERE FIN FIN/ACK ACK Web ClientWeb Server

CPSC Example Web Page Harry Potter Movies As you all know, the new HP book will be out in June and then there will be a new movie shortly after that… “Harry Potter and the Bathtub Ring” page.html hpface.jpg castle.gif

CPSC Client Server The “classic” approach in HTTP/1.0 is to use one HTTP request per TCP connection, serially. TCP SYN TCP FIN page.html G TCP SYN TCP FIN hpface.jpg G TCP SYN TCP FIN castle.gif G

CPSC Client Server Concurrent (parallel) TCP connections can be used to make things faster. TCP SYN TCP FIN page.html G castle.gif G F S G hpface.jpg S F C S C S

CPSC Client Server The “persistent HTTP” approach can re-use the same TCP connection for Multiple HTTP transfers, one after another, serially. Amortizes TCP overhead, but maintains TCP state longer at server. TCP FIN Timeout TCP SYN page.html G hpface.jpg G castle.gif G

CPSC Client Server The “pipelining” feature in HTTP/1.1 allows requests to be issued asynchronously on a persistent connection. Requests must be processed in proper order. Can do clever packaging. TCP FIN Timeout TCP SYN page.html G castle.gif hpface.jpg GG

CPSC Summary of Web and HTTP r The major application on the Internet m Majority of traffic is HTTP (or HTTP-related) r Client/server model: m Clients make requests, servers respond to them m Done mostly in ASCII text (helps debugging!) r Various headers and commands m Too many to go into detail here m Many web books/tutorials exist (e.g., Krishnamurthy & Rexford 2001)