Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/7/10.

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

Hypertext Transfer Protocol Information Systems 337 Prof. Harry Plantinga.
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/10/10.
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.
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.
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Web Server Design Week 14 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/14/10.
Web Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2010 Martin Klein 8/31/10.
Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10.
Web Server Design Week 4 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/03/10.
Web Server Design Assignment #1: Basic Operations Due: 02/03/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
Web Server Design Week 11 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/24/10.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
Form Data Encoding GET – URL encoded POST – URL encoded
Web Server Design Assignment #2: Conditionals & Persistence Due: 02/24/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010.
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.
Web Server Design Week 2 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 1/20/10.
Web Server Design Week 7 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/24/10.
Web Server Design Assignment #4: Authentication Due: 04/14/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein.
Overview of Servlets and JSP
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/17/10.
Web Server Design Assignment #5: Unsafe Methods & CGI Due: 05/05/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin.
Web Server Design Week 10 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/17/10.
Web Protocols: HTTP COMP6017 Topics on Web Services Dr Nicholas Gibbins –
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 02/07/12.
Web Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2007 Michael L. Nelson 8/27/07.
Web Server Design Week 1 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 1/09/06.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 04/03/12.
Web Server Design Week 15 Old Dominion University Department of Computer Science CS 495/595 Spring 2009 Michael L. Nelson 4/20/09.
Web Server Design Week 3 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 1/23/06.
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 2/13/06.
Hypertext Transfer Protocol (HTTP) COMP6218 Web Architecture Dr Nicholas Gibbins –
HTTP – An overview.
Web Server Design Week 10 Old Dominion University
Web Server Design Assignment #5: Unsafe Methods & CGI
Hypertext Transfer Protocol
Web Server Design Assignment #2: Conditionals & Persistence
Web Server Design Week 8 Old Dominion University
Web Server Design Week 11 Old Dominion University
Web Server Design Week 7 Old Dominion University
HTTP Protocol.
Web Server Design Assignment #5 Extra Credit
Web Server Design Week 4 Old Dominion University
Web Server Design Week 12 Old Dominion University
Web Server Design Week 15 Old Dominion University
Web Server Design Week 5 Old Dominion University
Web Server Design Assignment #2: Conditionals & Persistence
Web Server Design Week 8 Old Dominion University
Web Server Design Week 6 Old Dominion University
Web Server Design Week 10 Old Dominion University
Web Server Design Week 3 Old Dominion University
Web Server Design Week 11 Old Dominion University
Web Server Design Week 5 Old Dominion University
Web Server Design Week 3 Old Dominion University
Web Server Design Week 4 Old Dominion University
HTTP Hypertext Transfer Protocol
Web Server Design Week 16 Old Dominion University
Web Server Design Week 12 Old Dominion University
Web Server Design Week 12 Old Dominion University
Web Server Design Week 14 Old Dominion University
Web Server Design Assignment #1: Basic Operations
Web Server Design Week 6 Old Dominion University
Web Server Design Assignment #5 Extra Credit
Web Server Design Week 7 Old Dominion University
Web Programming Week 1 Old Dominion University
Web Server Design Week 7 Old Dominion University
Presentation transcript:

Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/7/10

Safe/Unsafe Methods Safe methods: “read” operations; do not change the status of the server –GET, HEAD, OPTIONS, TRACE –n.b.: in practice, GET can have side effects: Unsafe methods: “write” operations; change the status of the server –PUT, POST, DELETE

Idempotent Methods Idempotent: get the same result if you do it over and over again Safe & Idempotent: –GET (no side effects), HEAD, OPTIONS, TRACE Unsafe & Idempotent –PUT, DELETE Unsafe & ~Idempotent –POST, GET (w/ side effects) e.g.

PUT vs. POST PUT tells the server to use the uploaded entity to create a resource at the specified URI –Unix semantic equivalent: echo “hello world” > /home/mklein/hw.txt POST tells the server to submit the uploaded entity to the existing resource at the specified URI –Unix semantic equivalent: echo “hello world” | /usr/bin/spell

POST If the request does not result in a resource that can be identified with a URI, then the response codes should be: –200 OK an entity describing the result –204 No Content no description If the result does produce a URI identifiable resource, the result should be: –201 Created, and: –“Location” header specifying the new URI

PUT If a new resource is created: –201 Created response code is returned If an existing resource is modified: –200 OK if there is an entity describing the results –204 No Content if there is no entity describing the results

DELETE If the URI is successfully deleted, then valid response codes are: –200 OK if there is an entity describing the results –204 No Content if there is no entity describing the results –202 Accepted the request was understood, queued and might be successful in the future. an entity is returned with this response, but there is no provision for the server to relay the eventual success or failure of the original request

Failure Response Codes 403 Forbidden –Server understood the request, but will not honor it. Authentication will not help; do not repeat. 405 Method Not Allowed –method/URI combination not valid 411 Length Required –“Content-Length” header is missing on client upload 413 Request Entity Too Large –configurable server value; prevent DOS attacks note the “Content-Length” header may lie! 414 Request-URI Too Long – configurable server value; prevent DOS attacks

Reality… PUT, DELETE are rarely (never?) implemented as specified in the RFC –security considerations, limited client support –PUT sometimes implemented by redirecting to a CGI script: –Web Distributed Authoring and Versioning (WebDAV) is the preferred implementation for “write” operations We will do neither approach; we’ll implement native support for unsafe methods

Allowing PUT/DELETE Recursively allow PUT / DELETE in a directory via these directives in WeMustProtectThisHouse! file: –ALLOW-PUT –ALLOW-DELETE Orthogonal to the uid/passwd info: # ALLOW-PUT ALLOW-DELETE # authorization-type=Basic # realm="Fried Twice" # mklein: cae72c19f215480ddf2d0d5c3 mk:318bcb4be908d0da6448a0db76908d78 jbollen:c82138c7e01ad922b0a58fdd33c3a91c mln:5a df37fd781035da

PUT Example PUT /~mklein/fairlane.txt HTTP/1.1 Host: Connection: close User-Agent: CS 595-s10 Automatic Testing Program Content-type: text/plain Content-length: 193 ______________ // \\ // \\ | __ __ | |--/ \ / \---| \__/ \__/

DELETE Example DELETE /~mklein/fairlane.txt HTTP/1.1 Host: Connection: close User-Agent: CS 595-s10 Automatic Testing Program

Reminder: OPTIONS Be sure to give the correct values for the OPTIONS method –PUT, DELETE depend on the values in “WeMustProtectThisHouse!” –POSTing to URI that is not an executable file? Apache seems to allow it… –but not to directories We will not (status 405) mk$ telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. POST /~mklein/index.html HTTP/1.1 Host: Connection: close HTTP/ OK Date: Wed, 07 Apr :15:44 GMT Server: Apache/ (Unix) DAV/2 PHP/ Last-Modified: Wed, 13 Jan :55:23 GMT ETag: "64371b-54b-47d0f797c18d9" Accept-Ranges: bytes Content-Length: 1355 Connection: close Content-Type: text/html Martin Klein -- Old Dominion University [deletia] telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. POST /~mklein/pubs/ HTTP/1.1 Host: COnnection: close HTTP/ Not Found Date: Wed, 07 Apr :18:30 GMT Server: Apache/ (Unix) DAV/2 PHP/ Content-Length: 306 Connection: close Content-Type: text/html; charset=iso [deletia]

POST Typically the result of HTML “Forms” – html40/interact/forms.html#h http:// html40/interact/forms.html#h Two types of values in the client’s “Content- type” request header: –application/x-www-form-urlencoded (original & default) –multipart/form-data introduced in RFC-1867; allows file upload –

HTML Examples <FORM action=" enctype="multipart/form-data" method="post"> What is your name? What files are you sending? <FORM action=" enctype= "application/x-www-form-urlencoded" method="post"> What is your name? based on examples from:

application/x-www-form-urlencoded POST /~mklein/foo.cgi HTTP/1.1 Host: Connection: close Referer: User-Agent: CS 595-s10 Automatic Testing Program Content-type: application/x-www-form-urlencoded Content-Length: 134 action=restore&manufacturer=ford&model=fairlane+500XL &year=1966&status=modified&engine=427+sideoiler &transmission=4+speed+toploader functionally the same as (modulo a possible 414 response): GET /~mklein/foo.cgi?action=restore&manufacturer=ford&model=fairlane+500XL &year=1966&status=modified&engine=427+sideoiler&transmission=4+speed+toploader HTTP/1.1 Host: Connection: close Referer: User-Agent: CS 595-s10 Automatic Testing Program

multipart/form-data (with file upload) POST /~mklein/foo.cgi HTTP/1.1 Host: Connection: close Referer: User-Agent: CS 595-s10 Automatic Testing Program Content-type: multipart/form-data; boundary= xKhTmLbOuNdArY Content-Length: xKhTmLbOuNdArY Content-Disposition: form-data; name=”action" restore xKhTmLbOuNdArY Content-Disposition: form-data; name=”manufacturer" ford xKhTmLbOuNdArY Content-Disposition: form-data; name=”model" fairlane 500xl xKhTmLbOuNdArY Content-Disposition: form-data; name=”year" xKhTmLbOuNdArY Content-Disposition: form-data; name=”picture"; filename="fairlane.txt" Content-Type: text/plain ______________ // \\ // \\ | __ __ | |--/ \ / \---| \__/ \__/ xKhTmLbOuNdArY-- note the “--” to indicate the end