Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.

Slides:



Advertisements
Similar presentations
HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
Advertisements

HTTP – HyperText Transfer Protocol
Hypertext Transfer Protocol Kyle Roth Mark Hoover.
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.
The Web The World Wide Web What does it do?.
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
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Know how HTTP accesses data on the WWW Objectives.
Lecture 7 TELNET Protocol & HyperText Transfer Protocol CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
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 The HyperText Transfer Protocol: HTTP Nick Smith Stuart Alley Tara Tjaden.
Definitions, Definitions, Definitions Lead to Understanding.
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 Transport Protocol CS Dick Steflik.
Client, Server, HTTP, IP Address, Domain Name. Client-Server Model Client Bob Yahoo Server yahoo.com/finance.html A text file named finance.html.
 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.
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
HTTP Protocol Specification
FTP (File Transfer Protocol) & Telnet
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.
Internet Engineering Web Servers.
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.
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,…
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
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,
HTTP HTTP stands for Hypertext Transfer Protocol. It is an TCP/IP based communication protocol which is used to deliver virtually all files and other.
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.
Web Server Design Week 4 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/03/10.
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.
WWW: an Internet application Bill Chu. © Bei-Tseng Chu Aug 2000 WWW Web and HTTP WWW web is an interconnected information servers each server maintains.
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.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
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):
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.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
What’s Really Happening
Tiny http client and server
Block 5: An application layer protocol: HTTP
HTTP – An overview.
The Hypertext Transfer Protocol
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
HTTP Protocol Specification
HTTP Protocol.
HTTP Hypertext Transfer Protocol
Hypertext Transfer Protocol
Hypertext Transfer Protocol
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
HTTP Hypertext Transfer Protocol
CSCI-351 Data communication and Networks
Presentation transcript:

Maryam Elahi University of Calgary – CPSC 441

 HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively called resources ) on the World Wide Web  Usually, HTTP takes place through TCP/IP sockets.  A browser is an HTTP client  It sends requests to an HTTP server (Web server)  The standard/default port for HTTP servers to listen on is 80  A resource is some chunk of data that is referred to by a URL  The most common kind of resource is a file  A resource may also be a dynamically-generated content, e.g., query result, CGI scrip output, etc.

 HTTP uses the client-server model:  An HTTP client opens a connection and sends a request message to an HTTP server;  The server then returns a response message, usually containing the resource that was requested.  After delivering the response, the server closes the connection (except for persistent connections).  Format of the HTTP request and response messages:  Almost the same, human readable (English-oriented)  An initial line specifying the method,  zero or more header lines,  a blank line (i.e. a CRLF by itself), and  an optional message body (e.g. a file, or query data, or query output).

Header1: value1 Header2: value2 Header3: value3 Header1: value1 Header2: value2 Header3: value3

 A request line has three parts, separated by spaces:  a method name,  the local path of the requested resource,  and the version of HTTP being used.  Example: GET /path/to/file/index.html HTTP/1.1  GET: most common HTTP request. Says: "give me this resource".  Other methods include POST and HEAD, etc.  Method names are always uppercase.  The path is the part of the URL after the host name, also called the request URI (a URI is like a URL, but more general).  The HTTP version always takes the form " HTTP/x.x ", uppercase.

 Status line:  The HTTP version  A response status code: result of the request  A reason phrase describing the status code.  Response categories:  1xx an informational message  2xx success of some kind  3xx redirections  4xx an error on the client's part  5xx an error on the server's part  The most common status codes are:  200 OK The request succeeded, and the resulting resource is returned in the message body.  404 Not Found  301 Moved Permanently  302 Moved Temporarily  303 See Other (HTTP 1.1 only)The resource has moved to another URL  Check RFC 2616 for the complete list

 After headers, there may be a body of data  In a response this may be:  the requested resource  or perhaps explanatory text if there's an error.  In a request this may be:  the user-entered data  or uploaded files  If an HTTP message includes a body, there are usually header lines in the message that describe the body.  The Content-Type: the MIME-type of the data e.g., text/html or image/gif.  The Content-Length: the number of bytes in the body.

HTTP REQUESTHTTP RESPONSE GET /path/f.htm HTTP/1.1 Host: User-Agent: HTTPTool/1.0 [blank line here] GET /path/f.htm HTTP/1.1 Host: User-Agent: HTTPTool/1.0 [blank line here] HTTP/ OK Date: Fri, 31 Dec :59:59 GMT Content-Type: text/html Content-Length: 1354 Happy New Millennium! (more file contents)... HTTP/ OK Date: Fri, 31 Dec :59:59 GMT Content-Type: text/html Content-Length: 1354 Happy New Millennium! (more file contents)...

 A HEAD request is just like a GET request, except:  It asks the server to return the response headers only, not the actual resource. (i.e. no message body)  This is used to check characteristics of a resource without actually downloading it  HEAD is used when you don't actually need a file's contents.  The response to a HEAD request must never contain a message body, just the status line and headers.

 A POST method is used to send data to the server  A POST request is different from a GET request:  Data is sent with the request, in the message body.  There are usually extra headers to describe this message body, e.g., Content-Type: and Content-Length:.  The request URI is not a resource to retrieve; it's usually a program to handle the data you're sending.  The HTTP response is normally program output, not a static file.  Example: Submitting HTML form data to CGI scripts.  The Content-Type: header is usually application/x-www-form- urlencoded,  The Content-Length: header gives the length of the URL-encoded form data.

 Here's a typical form submission, using POST:  You can use a POST request to send whatever data you want, not just form submissions. Just make sure the sender and the receiving program agree on the format.  The GET method can also be used to submit forms. The form data is URL- encoded and appended to the request URI. POST /login.jsp HTTP/1.1 Host: User-Agent: Mozilla/4.0 Content-Length: 27 Content-Type: application/x- www-form-urlencoded userid=me&password=guessme POST /login.jsp HTTP/1.1 Host: User-Agent: Mozilla/4.0 Content-Length: 27 Content-Type: application/x- www-form-urlencoded userid=me&password=guessme

 Persistent HTTP connection:  To increase performance, some servers allow persistent HTTP connections  The server does not immediately close the connection after sending the response  The responses should be sent back in the same order as requests  The " Connection: close " header in a request indicating the final request for the connection. The server should close the connection after sending the response. Also, the server should close an idle connection after some timeout period.

 Saves bandwidth and improves efficiency  Proxy or web browser avoids transferring resources for which a local up-to-date copy exists  A copy of the previous content is saved in the cache  Upon a new request, first the cache is searched  If found in cache, return the content from cache  If not in cache, send request to the server  But what if the content is out of date?  We need to check if the content is modified since last access

 We need time-stamped responses for caching.  Servers must timestamp every response with a Date: header containing the current time e.g., Date: Fri, 31 Dec :59:59 GMT  All responses except those with 100-level status (but including error responses) must include the Date: header.  All time values in HTTP use Greenwich Mean Time.

REQUESTRESPONSE GET /sample.html HTTP/1.1 Host: example.com If-Modified-Since: Wed, 01 Sep :24:52 GMT If-None-Match: “4135cda4″ HTTP/ Not Modified Expires: Tue, 27 Dec :25:19 GMT Date: Tue, 27 Dec :25:19 GMT Server: Apache/ (Unix) PHP/4.3.10

REQUEST 1RESPONSE 1 GET /~carey/index.html HTTP/1.1 Host: Connection: keep-alive User-Agent: Mozilla/5.0 […] Accept: text/html,application/ […] Accept-Encoding: gzip,deflate,sdch […] \r\n GET /~carey/index.html HTTP/1.1 Host: Connection: keep-alive User-Agent: Mozilla/5.0 […] Accept: text/html,application/ […] Accept-Encoding: gzip,deflate,sdch […] \r\n HTTP/ Found Date: Sat, 21 Jan :10:43 GMT Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4OpenSSL/0.9.7a PHP/5.2.9 mod_jk/ Location: \r\n HTTP/ Found Date: Sat, 21 Jan :10:43 GMT Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4OpenSSL/0.9.7a PHP/5.2.9 mod_jk/ Location: \r\n

HTTP/ OK Date: Sat, 21 Jan :11:49 GMT Server: Apache/2.2.4 (Unix) […] Last-Modified: Mon, 16 Jan :40:45 GMT Content-Length: 3157 Keep-Alive: timeout=5 Connection: Keep-Alive Content-Type: text/html \r\n […] \r\n HTTP/ OK Date: Sat, 21 Jan :11:49 GMT Server: Apache/2.2.4 (Unix) […] Last-Modified: Mon, 16 Jan :40:45 GMT Content-Length: 3157 Keep-Alive: timeout=5 Connection: Keep-Alive Content-Type: text/html \r\n […] \r\n ↓ REQUEST 2 RESPONSE 2 → GET /~carey/index.html HTTP/1.1 Host: pages.cpsc.ucalgary.ca Connection: keep-alive User-Agent: Mozilla/5.0 […] Accept: text/html,application/ […] Accept-Encoding:gzip,deflate […] \r\n GET /~carey/index.html HTTP/1.1 Host: pages.cpsc.ucalgary.ca Connection: keep-alive User-Agent: Mozilla/5.0 […] Accept: text/html,application/ […] Accept-Encoding:gzip,deflate […] \r\n

 Host header: HTTP 1.1 has a required host header  Persistent connections: By default, connections are assumed to be kept open after the transmission of a request and its response. The protocol permits closing of connections at any point. Connection: close header is used to inform the recipient that the connection will not be reused.  Pipelining: A client need not wait to receive the response for one request before sending another request on the same connection  Stronger Cache Support  Chunked transfer-encoding  Options Method: A way for a client to learn about the capabilities of a server without actually requesting a resource.  There are more, take a look at this WWW conference paper for detailed discussion of differences:

 The content of these slides are taken from the online tutorial “HTTP Made Really Easy, A Practical Guide to Writing Clients and Servers” by James Marshall (Extended and partially modified)  RFC