MSc Internet Computing

Slides:



Advertisements
Similar presentations
PHP syntax basics. Personal Home Page This is a Hypertext processor It works on the server side It demands a Web-server to be installed.
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.
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 World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
Definitions, Definitions, Definitions Lead to Understanding.
Client, Server, HTTP, IP Address, Domain Name. Client-Server Model Client Bob Yahoo Server yahoo.com/finance.html A text file named finance.html.
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/10/10.
HTTP Protocol Specification
FTP (File Transfer Protocol) & Telnet
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.
1 Welcome to CSC 301 Web Programming Charles Frank.
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.
Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs.
Form Data Encoding GET – URL encoded POST – URL encoded
Appendix E: Overview of HTTP ©SoftMoore ConsultingSlide 1.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
Web Technologies Lecture 1 The Internet and HTTP.
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.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 2/13/06.
What’s Really Happening
Block 5: An application layer protocol: HTTP
Shellshock a.k.a. Bashdoor / Bash bug
Section 6.3 Server-side Scripting
Web Concepts Lesson 2 ITBS2203 E-Commerce for IT.
Building Web Apps with Servlets
Web Basics: HTML and HTTP
HTTP – An overview.
The Hypertext Transfer Protocol
Web Development Web Servers.
How does it work ?.
1993 version of Mosaic browser.
Computing with C# and the .NET Framework
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
HTTP Protocol Specification
Hypertext Transport Protocol
CGI CS422 Dick Steflik.
TCP/IP Networking An Example
HTTP Protocol.
Application HTTP.
Tutorial (4): HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
Uniform Resource Locators
Multimedia and Networks
Hypertext Transfer Protocol
HTTP Request Method URL Protocol Version GET /index.html HTTP/1.1
Hypertext Transfer Protocol
Web Server Design Week 5 Old Dominion University
Uniform Resource Locators (URLs)
Hypertext Transfer Protocol (HTTP)
Web Server Design Week 6 Old Dominion University
Hypertext Transfer Protocol
Kevin Harville Source: Webmaster in a Nutshell, O'Rielly Books
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
Uniform Resource Locators

Web Server Design Week 5 Old Dominion University
Application Layer Part 1
HTTP Hypertext Transfer Protocol
Uniform Resource Locators (URLs)
Hypertext Transfer Protocol
Web Server Design Week 6 Old Dominion University
CSCI-351 Data communication and Networks
Web Server Design Week 7 Old Dominion University
Web Server Design Week 7 Old Dominion University
Presentation transcript:

MSc Internet Computing CSYM010 Server Side Software Lecturer: Espen Svennevik

Content Web Servers Common Gateway Interface Server side scripting languages

Scheme of work Tuesday 7th Feb Webservers, CGI & server side scripting languages- PHP 14th Feb PHP 21st Feb PHP & MySQL 28th Feb 7th March JSP & JDBC or AJAX 14th March ASSIGNMENT 21st March ASSIGNMENT – Hand into AHO by Friday 25th March Easter Break

Webserver Apache - Multiplatform Microsoft IIs Jakarta Tomcat HTTP Protocol Typically TCP Port 80

HTTP HyperText Transaction Protocol Version 1.0 or 1.1 Simple text based protocol Client requests Server responds (possibly with an error)

HTTP continued - Example Client: GET /~espen/CSYM010/test.html HTTP/1.0 Server: HTTP/1.0 200 OK Or HTTP/1.0 404 Not Found

HTTP continued - Example espen:~ espen$ telnet www.eng.nene.ac.uk 80 Trying 194.81.104.27... Connected to my23-1.eng.nene.ac.uk. Escape character is '^]'. GET /~espen/CSYM010/test.html HTTP/1.0 HTTP/1.1 200 OK Date: Tue, 07 Feb 2006 10:36:14 GMT Server: Apache/2.0.53 (Unix) PHP/4.3.10 Last-Modified: Tue, 07 Feb 2006 10:36:15 GMT ETag: W/"90db-16-624db300" Accept-Ranges: bytes Content-Length: 22 Connection: close Content-Type: text/html X-Pad: avoid browser bug <b><i>CSYM0101</i></b>Connection closed by foreign host. espen:~ espen$

HTTP continued Common status codes 200 OK The request succeeded, and the resulting resource (e.g. file or script output) is returned in the message body. 404 Not Found The requested resource doesn't exist. 301 Moved Permanently 302 Moved Temporarily 303 See Other (HTTP 1.1 only) The resource has moved to another URL (given by the Location: response header), and should be automatically retrieved by the client. This is often used by a CGI script to redirect the browser to an existing file. 500 Server Error An unexpected server error. The most common cause is a server-side script that has bad syntax, fails, or otherwise can't run correctly.

HTTP continued Other methods apart from GET are: POST - Similar to GET HEAD - Gets header only - no body

Common Gateway Interface (CGI) Interface to server side scripts Client (browser) request a script Server executes scripts Output of scripts are returned to the client Client (browser) displays (renders) output

CGI Example Written in UNIX shell #!/bin/sh echo "Content-Type: text/html" echo NOW=`date` echo "<h1>Todays date and time is $NOW</h1>"

CGI Example - continued Output Content-Type: text/html <h1>Todays date and time is Tue Feb 7 11:48:09 GMT 2006</h1>

Second CGI example #!/bin/sh echo "Content-Type: text/html” echo for i in 1 2 3 4 5 6 do echo "<h$i>Header $i</h$i>” done

Second CGI example - cont’ Content-Type: text/html <h1>Header 1</h1> <h2>Header 2</h2> <h3>Header 3</h3> <h4>Header 4</h4> <h5>Header 5</h5> <h6>Header 6</h6>

Apache environment variables Apache passes data to scripts in environment variables. These include: DOCUMENT_ROOT="/var/www/html” GATEWAY_INTERFACE="CGI/1.1" HTTP_ACCEPT="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*” HTTP_ACCEPT_CHARSET="iso-8859-1,*,utf-8” HTTP_ACCEPT_ENCODING="gzip" HTTP_ACCEPT_LANGUAGE="en” HTTP_CONNECTION="Keep-Alive" HTTP_HOST="194.81.104.115” HTTP_USER_AGENT="Mozilla/4.74 (Macintosh; U; PPC)” PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin” QUERY_STRING="" REMOTE_ADDR="194.81.104.118"

Environment variables REMOTE_PORT="1740" REQUEST_METHOD="GET” REQUEST_URI="/cgi-bin/printenv” SCRIPT_FILENAME="/var/www/cgi-bin/printenv” SCRIPT_NAME="/cgi-bin/printenv” SERVER_ADDR="194.81.104.115” SERVER_ADMIN="root@localhost" SERVER_NAME="radon” SERVER_PORT="80" SERVER_PROTOCOL="HTTP/1.0” SERVER_SIGNATURE="<ADDRESS>Apache/1.3.12 Server at radon Port 80</ADDRESS>\n” SERVER_SOFTWARE="Apache/1.3.12 (Unix) (Red Hat/Linux) mod_ssl/2.6.6 OpenSSL/0.9.5a DAV/1.0.1 PHP/4.0.2 mod_perl/1.24"

CGI script & environment #!/bin/sh echo "Content-Type: text/html” echo echo "<h1>Your browser is $HTTP_USER_AGENT</h1>” echo "<h2>Your IP address is $REMOTE_ADDR</h2>” echo "<h2>Your PORT number is $REMOTE_PORT</h2>"

CGI script & environment • Previous script produces this output in the browser window: Your browser is Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 Your IP address is 194.81.104.118 Your PORT number is 51046