Web Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2010 Martin Klein 8/31/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

HTTP – HyperText Transfer Protocol
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.
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July.
Hypertext Transfer Protocol Information Systems 337 Prof. Harry Plantinga.
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.
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/10/10.
COMP3016 Web Technologies Introduction and Discussion What is the Web?
Web Technologies Computer Security Lecture 9 Tom Chothia.
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)
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.
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Copyright (c) 2010, Dr. Kuanchin Chen1 The Client-Server Architecture of the WWW Dr. Kuanchin Chen.
Web Server Design Week 14 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/14/10.
Web Server Design Week 1 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 1/13/10.
Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10.
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.
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 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.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
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 Technologies Lecture 1 The Internet and HTTP.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/7/10.
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
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
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 #3: Transfer Encoding & Content Negotiation Due: 03/24/2010 Old Dominion University Department of Computer Science CS 495/595.
Web Server Design Week 10 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/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 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.
Web Server Design Week 1 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 1/10/12.
Hypertext Transfer Protocol
Web Server Design Assignment #2: Conditionals & Persistence
HTTP Protocol.
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 6 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 14 Old Dominion University
Web Server Design Assignment #1: Basic Operations
Web Server Design Week 6 Old Dominion University
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 Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2010 Martin Klein 8/31/10

Goals We will learn to work in the LAMP environment: PHP - PHP: Hypertext Preprocessor.

No MS Environments!

Goals Demonstrate LAMP proficiency with a semester long project based on a bulletin board system. Some examples: – – – –

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

This is a programming class! –I assume you know how to program –your grade will be determined solely on your program’s performance on 4 different checkpoints through the semester Attendance is not mandatory –But don’t waste your and my time! 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 Mandatory 1 st Class of the Semester Slide

Important URLs – – 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 (attendance) –each group will give a 3-4 minute status report the week before an assignment is due! (attendance) All development will be done on a shared Linux machine –mln-web.cs.odu.edu TA: tbd Mandatory 1 st Class of the Semester Slide #2

4 programs, 23 points each –17 points for functional requirements –3 points voted on by other groups for aesthetic appeal –3 points for in-class status report the week prior to the assignment’s due date 8 remaining points come from each group asking or answering 8 technical questions about the assignments on the list –no points for duplicate questions or answers! Grading, aka Mandatory 1 st Class of the Semester Slide #3

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

Lots of HTTP Methods… GET, HEAD TRACE –for debugging OPTIONS –what methods are defined on this URI? DELETE –rarely supported for most URIs PUT –also rarely supported –unix semantics: % echo “hello world” > temp.txt POST –commonly supported –unix semantics: % echo “hello world” | spell Want to learn more? read RFC-2616 –

Talking to HTTP servers… mk$ curl --head HTTP/ OK Date: Wed, 13 Jan :36:09 GMT Server: Apache/ (Unix) DAV/2 PHP/ Last-Modified: Mon, 11 Jan :38:15 GMT ETag: "640e2a cd9974d0fd9" Accept-Ranges: bytes Content-Length: 1362 Content-Type: text/html mk$ curl --head HTTP/ OK Date: Wed, 13 Jan :43:10 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO Set-Cookie: PREF=ID=93c27673a367c338:TM= :LM= :S=akzlDIbyLg9rjmww; expires=Fri, 13-Jan :43:10 GMT; path=/; domain=.google.com Server: gws Transfer-Encoding: chunked “curl” is convenient, but speaking raw HTTP is more fun…

GET mk$ telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mklein/index.html HTTP/1.1 Connection: close Host: HTTP/ OK Date: Wed, 13 Jan :51:57 GMT Server: Apache/ (Unix) DAV/2 PHP/ Last-Modified: Mon, 11 Jan :38:15 GMT ETag: "640e2a cd9974d0fd9" Accept-Ranges: bytes Content-Length: 1362 Connection: close Content-Type: text/html Martin Klein -- Old Dominion University … [lots of html deleted] … Connection closed by foreign host. Request (ends w/ CRLF) Response

HEAD mk$ telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mklein/index.html HTTP/1.1 Connection: close Host: HTTP/ OK Date: Wed, 13 Jan :46:43 GMT Server: Apache/ (Unix) DAV/2 PHP/ Last-Modified: Mon, 11 Jan :38:15 GMT ETag: "640e2a cd9974d0fd9" Accept-Ranges: bytes Content-Length: 1362 Connection: close Content-Type: text/html Connection closed by foreign host.

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) note the “--” to indicate the end 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--

Response Codes - 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 from section of RFC 2616

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

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

Let’s Look at Some Basic PHP

WWW History If you want to know more, read a book (irony intentional)

PHP Helper (one of many)

Who Should NOT Take This Class? Students not able to/not willing to learn how to code Students not willing to work in groups Students not willing to work on and solve complex problems

To Do for Next Time… Subscribe to the class list Log in to: mln-web.cs.odu.edu (I will send to the class list when the accounts are ready) –uid/passwds same as *.cs.odu.edu machines don’t have a *.cs.odu.edu acct? get one: –MySQL login == linux login; passwd = (to be determined) Start reading & practicing in your own public_html directory on the cs machines me your group info! If you’re not in a group by 11:59 PM Sept , you’re working alone.

“And Now For Something Completely Different” Weekly “Trivia of the Day” –Question: “What happened today x years ago?” Main but not exclusive source: Wikipedia Price: