Common Gateway Interface (CGI). CGI is a protocol: CGI is not a programming language CGI is a protocol for the exchange of information between between.

Slides:



Advertisements
Similar presentations
CS 22: Enhanced Web Site Design - Week 8Slide 1 of 15 Enhanced Web Site Design Stanford University Continuing Studies CS 22 Mark Branom
Advertisements

CGI & HTML forms CGI Common Gateway Interface  A web server is only a pipe between user-agents  and content – it does not generate content.
Adding Dynamic Content to your Web Site
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
How does the server format the information it gives to the appln program? As environment variables and in standard input.
Chapter 29 Structure of Computer Names Domain Names Within an Organization The DNS Client-Server Model The DNS Server Hierarchy Resolving a Name Optimization.
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.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
1 The HyperText Transfer Protocol: HTTP Nick Smith Stuart Alley Tara Tjaden.
Definitions, Definitions, Definitions Lead to Understanding.
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.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Web Client/Server Communication A290/A590, Fall /09/2014.
APACHE SERVER By Innovationframes.com »
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
TP2653 Adv Web Programming SOAP and WSDL. SOAP Simple Object Access Protocol – Lightweight XML-based messaging protocol – A protocol for accessing a Web.
Web server and web browser It’s a take and give policy in between client and server through HTTP(Hyper Text Transport Protocol) Server takes a request.
INTRODUCTION TO WEB DATABASE PROGRAMMING
J2EE Web Fundamentals Lesson 1 Introduction and Overview
Chapter 9 Using Perl for CGI Programming. Computation is required to support sophisticated web applications Computation can be done by the server or the.
NETWORK CENTRIC COMPUTING (With included EMBEDDED SYSTEMS)
Overview A plain HTML document is static A CGI program is executed in real-time, so that it can output dynamic information. CGI (Common Gateway Interface)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
HTTP Protocol Specification
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
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.
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
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.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
ITIS 1210 Introduction to Web-Based Information Systems Chapter 23 How Web Host Servers Work.
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
USING PERL FOR CGI PROGRAMMING
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Introduction to ASP.NET1. 2 Web applications in general Web applications are divided into two parts –The server part –The client part The server part.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Form Data Encoding GET – URL encoded POST – URL encoded
Multimedia and Networks. Protocols (rules) Rules governing the exchange of data over networks Conceptually organized into stacked layers – Application-oriented.
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.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Web Server Design Assignment #2: Conditionals & Persistence Due: 02/24/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
The Module Road Map Assignment 1 Road Map We will look at… Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX.
WEB SERVER Mark Kimmet Shana Blair. The Project Web Server Application  Receives request for web pages or images from a client browser via the internet.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1 Fundamentals.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
SOAP, Web Service, WSDL Week 14 Web site:
HTTP Protocol Amanda Burrows. HTTP Protocol The HTTP protocol is used to send HTML documents through the Internet. The HTTP protocol sends the HTML documents.
The Common Gateway Interface (CGI) Pat Morin COMP2405.
Tiny http client and server
CS 330 Class 7 Comments on Exam Programming plan for today:
WWW and HTTP King Fahd University of Petroleum & Minerals
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Tutorial (4): HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
HyperText Transfer Protocol
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Presentation transcript:

Common Gateway Interface (CGI)

CGI is a protocol: CGI is not a programming language CGI is a protocol for the exchange of information between between –an HTTPD demon (server program) and –application programs which run on the same machine as the HTTP server

When is CGI used? When a HTTPD server receives a request for a resource, it can either –deliver the resource to the requesting client, or –treat the resource as a program which will generate some output that is to be sent to the requesting client Servers can use different criteria to decide whether a requested file in its directory structure is to be delivered or executed –the decision could be based on the directory in which the file is located –the decision could be based on the type of the file, as reflected in its name extension

A typical approach: Most types of file are served up to the requesting client: html, jpg, gif, wav Files whose names have the extension.cgi are treated as programs to be executed, programs whose output is to be served up to the requesting client

This is when CGI is used: When a HTTP server has decided that a requested resource is to be treated as program, –it uses CGI to exchange information with the program

What channels are used? The HTTP server demon sends information to an application program using –standard input –environment variables The application program sends information to the HTTP server demon using –standard output

What languages can appln programs be written in? They can be written in ANY language provided the language is able to access the communication channels used by the CGI protocol –standard input –standard output –environment variables

What does the CGI protocol specify? It specifies –the information that the HTTP demon should provide to the application program through environment variables through standard input –the information that the application should provide to the demon through standard output –the way in which all this information should be encoded and decoded

What information should the HTTP server demon provide to the application program? The server should give the appln program –information about the client, such as the IP address or domain name of the client machine, etc –all the information it received in the HTTP request message: the request method, URI and HTTP version used in the request line all the information in the HTTP message headers (if any) that followed the request line all the information in the HTTP message body (if any) that followed the blank line after the last header –information about the server itself, such as the version of CGI it is using to the talk to the appln program; the IP address or domain name of the server machine the TCP/IP port which is being used by the HTTP demon

Cs 4320 got here on 6/feb/2004

What information should the appln program provide to the HTTP server demon? The appln program gives to the HTTP server demon whatever information it wants to have sent, by the HTTP server demon, to the client This means that the appln program can determine –the status line of the response message –the headers used in the response message –the body (if any) in the response message

Status line Usually, an appln program says nothing to the HTTP server about the status code (and associated natural language phrase) that should be sent in the status line of the HTTP response message to the client –in this case, the HTTP server will select the code and phrase itself However, an appln program can choose the status code and phrase itself Indeed, as we will see later, since the set of HTTP server codes is extensible, –we can write application programs which choose non-standard codes

Cs 4320 got here on 18 jan 2005

Message Headers Most appln programs are willing to let the HTTP server select what headers to send to the client Usually, however, an appln program gives at least one header to the server –typically, either a Content-Type: or a Location: header An appln program can insist that the HTTP server should not add any more headers to the message, extra to those that the appln program has given to the server Usually, however, the appln program lets the server parse the headers and decide to send additional headers which it thinks are necessary

Message body The application program has sole control on what body, if any, is sent in the response message