University of Calgary – CPSC 441 Parts of these slides are courtesy of Erich Nahum (IBM Research)

Slides:



Advertisements
Similar presentations
Hypertext Transfer PROTOCOL ----HTTP Sen Wang CSE5232 Network Programming.
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
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
1 Web Search Interfaces. 2 Web Search Interface Web search engines of course need a web-based interface. Search page must accept a query string and submit.
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
1 K. Salah Module 2.1: Application Layer Application-level protocols provide high-level services –Web and HTTP –DNS –Electronic mail –Remote login –FTP.
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.
Web Architecture Dr. Frank McCown Intro to Web Science Harding University This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike.
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.
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
1 Lecture #7-8 HTTP – HyperText Transfer Protocol HAIT Summer 2005 Shimrit Tzur-David.
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.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
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.
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Web application architecture
1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW p Waleed Ejaz
WWW, HTTP, GET, POST, Cookies Svetlin Nakov Telerik Corporation
IT Engineering Instructor: Rezvan Shiravi
WebServer A Web server is a program that, using the client/server model and the World Wide Web's Hypertext Transfer Protocol (HTTP), serves the files that.
Web HTTP Hypertext Transfer Protocol. Web Terminology ◘Message: The basic unit of HTTP communication, consisting of structured sequence of octets matching.
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.
HTTP Hypertext Transfer Protocol
Proxy Lab Recitation I Monday Nov 20, 2006.
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.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
CPSC 4411 HTTP Protocol r Slides originally from Williamson at Calgary r Minor modifications are made.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
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)
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
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
Data Communication EDA344, DIT420 Description of Lab 1 and Optional Programming HTTP Assignment Bapi Chatterjee Prajith R G.
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
HTTP Review Carey Williamson Department of Computer Science
HTTP Hypertext Transfer Protocol
Carey Williamson Department of Computer Science University of Calgary
HTTP Hypertext Transfer Protocol
Presentation transcript:

University of Calgary – CPSC 441 Parts of these slides are courtesy of Erich Nahum (IBM Research)

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

 User clicks on something  Uniform Resource Locator (URL): scheme://domain:portnumber/the path of the resource     ftp://ftp.kernel.org Different URL schemes map to different services  Hostname is converted from a name to a 32-bit IP address (DNS lookup)  Connection is established to server (TCP)

 Client downloads HTML page  Typically in text format (ASCII)  Contains instructions for rendering (e.g., background color, frames)  Many have embedded objects  Images: GIF, JPG (logos, banner ads)  Usually automatically retrieved ▪ I.e., without user involvement ▪ User may be able to change setting for automatic retrievals <meta name=“Author” content=“Erich Nahum”> Sample HTML Page <img width=31 height=11 src=“ibmlogo.gif”> <img src=“images/new.gif> Hi There! Here’s lots of cool linux stuff! Click here for more! <meta name=“Author” content=“Erich Nahum”> Sample HTML Page <img width=31 height=11 src=“ibmlogo.gif”> <img src=“images/new.gif> Hi There! Here’s lots of cool linux stuff! Click here for more!

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

Called Methods:  GET: retrieve a file (95% of requests)  HEAD: just get meta-data (e.g., modified time)  Asks the server to return the response headers only  POST: submitting a form/file to a server  And a few others:  PUT: store enclosed document as URI  DELETE: removed named resource  LINK/UNLINK: in 1.0, gone in 1.1  TRACE: http “echo” for debugging (added in 1.1)  CONNECT: used by proxies for tunneling (1.1)  OPTIONS: request for server/proxy options (1.1)  …

 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.) GET /images/penguin.gif HTTP/1.0 Host: User-Agent: Mozilla/0.9.4 (Linux ) Accept: text/html, image/gif, image/jpeg Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso ,*,utf-8 Cookie: B=xh203jfsf; Y=3sdkfjej GET /images/penguin.gif HTTP/1.0 Host: User-Agent: Mozilla/0.9.4 (Linux ) Accept: text/html, image/gif, image/jpeg Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso ,*,utf-8 Cookie: B=xh203jfsf; Y=3sdkfjej

 Similar format to requests (i.e., ASCII) 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 [data follows…] 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 [data follows…]

 1XX: Informational  100 Continue, 101 Switching Protocols  2XX: Success  200 OK, 206 Partial Content  3XX: Redirection  301 Moved Permanently, 304 Not Modified  4XX: Client error  400 Bad Request, 403 Forbidden, 404 Not Found  5XX: Server error  500 Internal Server Error, 503 Service Unavailable, 505 HTTP Version Not Supported

Initialize; Setup the listening socket; forever do { get request; process; send response; log request (optional); }

 First allocate a socket and bind() it to the address  HTTP requests are usually sent on TCP to port 80.  Other services use different ports (e.g., SSL is on 443)  Call listen() on the socket to indicate willingness to receive requests  Call accept() to wait for a request to come in (blocking)  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 */ … } 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 */ … }

 read() is called on new socket to retrieve request  Type of request is determined by parsing the read data  For logging purposes (optional, but done by most):  figure out the remote host name  figure out the name of other end  get time of request remoteIP = getsockname(newconn); remoteHost = gethostbyname(remoteIP); gettimeofday(currentTime); read(newconn, reqBuffer, sizeof(reqBuffer)); reqInfo = serverParse(reqBuffer); remoteIP = getsockname(newconn); remoteHost = gethostbyname(remoteIP); gettimeofday(currentTime); read(newconn, reqBuffer, sizeof(reqBuffer)); reqInfo = serverParse(reqBuffer);

 Assuming the request is for a file (e.g., penguin.gif)  Test file path and meta-data  See if file exists/is accessible  Check permissions  Check meta data: e.g., size of file, last modified time  Assuming all is OK:  open the file fileName = parseOutFileName(requestBuffer); fileAttr = stat(fileName); serverCheckFileStuff(fileName, fileAttr); open(fileName); fileName = parseOutFileName(requestBuffer); fileAttr = stat(fileName); serverCheckFileStuff(fileName, fileAttr); open(fileName);

 Read the file into user space  Send HTTP headers on socket  Write the file on the socket  If connection is not persistent, close the socket  Close the open file descriptor  Write on the log file read(fileName, fileBuffer); headerBuffer = serverFigureHeaders(fileName, reqInfo); write(newSock, headerBuffer); write(newSock, fileBuffer); close(newSock); close(fileName); write(logFile, requestInfo); read(fileName, fileBuffer); headerBuffer = serverFigureHeaders(fileName, reqInfo); write(newSock, headerBuffer); write(newSock, fileBuffer); close(newSock); close(fileName); write(logFile, requestInfo);

 Plays two roles, acts as:  A server for the client browser  A client for the target web server  For each HTTP request from the browser 1. Accepts HTTP requests from the browser 2. Gets the data from the target web server (or from its cache), modifies the response if need be 3. Sends HTTP respond with the data  Must handle concurrent browser requests  May be designed for different purposes (Caching, access control, etc.)

16 socket() bind() listen() accept() write() read() Proxy close() socket() TCP Client connect() write() read() close() Get request Send data socket() bind() listen() accept() write() read() Web Server close() socket() connect() write() read() close() Get data modify Server Side Client Side v v v v