Web Programming Week 1 Old Dominion University

Slides:



Advertisements
Similar presentations
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/10/10.
Advertisements

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.
Copyright (c) 2010, Dr. Kuanchin Chen1 The Client-Server Architecture of the WWW Dr. Kuanchin Chen.
Web Server Design Week 1 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 1/13/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.
Web Server Design Assignment #2: Conditionals & Persistence Due: 02/24/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010.
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 Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/7/10.
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 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 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.
HTTP – An overview.
Web Server Design Week 10 Old Dominion University
Collective Intelligence Week 1
Web Server Design Week 4 Old Dominion University
Web Server Design Assignment #5: Unsafe Methods & CGI
Hypertext Transfer Protocol
CS3220 Web and Internet Programming Generating HTTP Responses
Web Server Design Week 1 Old Dominion University
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
Hypertext Transfer Protocol
Web Server Design Assignment #2: Conditionals & Persistence
Web Server Design Week 8 Old Dominion University
Web Server Design Week 1 Old Dominion University
Hypertext Transfer Protocol (HTTP)
Web Server Design Week 8 Old Dominion University
Web Server Design Assignment #2: Conditionals & Persistence
Old Dominion University Department of Computer Science
Web Server Design Week 6 Old Dominion University
Web Server Design Week 10 Old Dominion University
Web Server Design Week 8 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 Programming Assignment #3: Admin and User Functions
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 Programming Assignment #1: Basic BBS Operations
Web Server Design Week 3 Old Dominion University
Web Server Design Week 3 Old Dominion University
Old Dominion University Department of Computer Science
Web Server Design Week 7 Old Dominion University
Web Server Design Week 7 Old Dominion University
Web Programming Assignment #3: Admin and User Functions
Presentation transcript:

Web Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2006 Michael L. Nelson <mln@cs.odu.edu> 8/28/06

Goals We will learn to work in the LAMP environment:

No MS Environments!

Goals Demonstrate LAMP proficiency with a semester long project based on a bulletin board system. Some examples: http://www.fordfe.com/ http://www.pro-touring.com/forum/ http://www.techsideline.com/forums.htm

Prerequisites I assume you know: how to program in some (imperative) language basic Internet/WWW concepts basic HTML basic relational database concepts

Who Should Take This Class? This class will cover breadth, not depth If you want to learn more about: System administration CS 454/554 Network Management HTTP CS 495/595 Web Server Design databases CS 450/550 Database Concepts CS 419/519 Internet Databases and many others…. Java CS 695 Java & XML

Administrivia This is a programming class! I assume you know how to program your grade will be determined solely on your server’s performance on 4 different checkpoints through the semester You will work in teams of 1 or 2 (grad + undergrad teams are possible) Pick teams wisely teams will exist by mutual consent only at any time, teams can split up, but no new teams will be formed after the first assignment is due ex-team members will have access to their shared code base

Administrivia 2 Important URLs Class homepage: http://www.cs.odu.edu/~mln/teaching/cs518-f06/ http://list.odu.edu/listinfo/cs518-f06/ Class homepage: Readings are listed under the day they are expected to be completed assignments are listed under the day they will be demoed in class each group will give a 3-4 minute status report the week before an assignment is due! All development will be done on a shared linux machine mln-web.cs.odu.edu

Grading 4 programs, 23 points each 20 points for functional requirements 3 points voted on by other groups for aesthetic appeal 8 remaining points come from each group asking or answering 8 technical questions about the assignments on the email list no points for duplicate questions or answers!

HTTP Operation Origin Client Server request = (method, URI, version, “MIME-like” message) Origin Server Client response = (version, success/error code, “MIME-like” message)

GET Request (ends w/ CRLF) Response AIHT:~/Desktop/cs595-s06 mln$ telnet www.cs.odu.edu 80 | tee 1-1.out Trying 128.82.4.2... Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/index.html HTTP/1.1 Connection: close Host: www.cs.odu.edu HTTP/1.1 200 OK Date: Mon, 09 Jan 2006 17:07:04 GMT Server: Apache/1.3.26 (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Last-Modified: Sun, 29 May 2005 02:46:53 GMT ETag: "1c52-14ed-42992d1d" Accept-Ranges: bytes Content-Length: 5357 Content-Type: text/html <html> <head> <title>Home Page for Michael L. Nelson</title> <style type="text/css"> <!-- [lots of html deleted] Connection closed by foreign host. Request (ends w/ CRLF) Response

HEAD AIHT:~/Desktop/cs595-s06 mln$ telnet www.cs.odu.edu 80 | tee 1-2.out Trying 128.82.4.2... Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/index.html HTTP/1.1 Connection: close Host: www.cs.odu.edu HTTP/1.1 200 OK Date: Mon, 09 Jan 2006 17:14:39 GMT Server: Apache/1.3.26 (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Last-Modified: Sun, 29 May 2005 02:46:53 GMT ETag: "1c52-14ed-42992d1d" Accept-Ranges: bytes Content-Length: 5357 Content-Type: text/html Connection closed by foreign host.

POST Typically the result of HTML “Forms” http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4 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 http://www.ietf.org/rfc/rfc1867.txt

HTML Examples <FORM action="http://server.com/cgi/handle" enctype= "application/x-www-form-urlencoded" method="post"> <P> What is your name? <INPUT type="text" name="submit-name"><BR> <INPUT type="submit" value="Send"> <INPUT type="reset"> </FORM> <FORM action="http://server.com/cgi/handle" enctype="multipart/form-data" method="post"> <P> What is your name? <INPUT type="text" name="submit-name"><BR> What files are you sending? <INPUT type="file" name="files"> <BR> <INPUT type="submit" value="Send"> <INPUT type="reset"> </FORM> based on examples from: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4

application/x-www-form-urlencoded POST /~mln/foo.cgi HTTP/1.1 Host: www.cs.odu.edu Connection: close Referer: http://www.cs.odu.edu/~mln/bar.html User-Agent: CS 595-s06 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 /~mln/foo.cgi?action=restore&manufacturer=ford&model=fairlane+500XL &year=1966&status=modified&engine=427+sideoiler&transmission=4+speed+toploader HTTP/1.1 Host: www.cs.odu.edu Connection: close Referer: http://www.cs.odu.edu/~mln/bar.html User-Agent: CS 595-s06 Automatic Testing Program

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

Response Codes from section 6.1.1 of RFC 2616 - 1xx: Informational - Request received, continuing process - 2xx: Success - The action was successfully received, understood, and accepted - 3xx: Redirection - Further action must be taken in order to complete the request - 4xx: Client Error - The request contains bad syntax or cannot be fulfilled - 5xx: Server Error - The server failed to fulfill an apparently valid request

But Few Web Resources Are Static Files… GET /foo HTTP/1.1 Origin Server Client foo HTTP/1.1 200 OK foo Java, Javascript foo PHP, ASP, JSP foo HTML, PDF, etc.

Server Side Processing Mnemonic CODE HTML html code html code “Traditional” CGI (e.g. Perl) PHP

Let’s Look at Some PHP http://www.cs.odu.edu/~mln/teaching/cs518-f06/code/ http://mln-web.cs.odu.edu/~mln/code/

To Do for Next Time… Subscribe to the class email list Log in to: mln-web.cs.odu.edu uid/passwds same as *.cs.odu.edu machines MySQL login == linux login; passwd = (to be determined) Start reading & practicing in your own public_html directory on the cs machines Email me your group info! If you’re not in a group by 11:59 PM Sept 11, you’re working alone.