throbber
On-the-Spot Information
`
`on the World Wide Web
`
`NUTSHELL
`
`HANDBOOK
`
`Shishir Gundavaram
`
`OReilly
`
`Associates Inc
`
`Petitioner IBM – Ex. 1039, p. 1
`
`

`
`Petitioner IBM – Ex. 1039, p. 2
`
`

`
`CGI Programming
`on the World Wide Web
`
`Petitioner IBM – Ex. 1039, p. 3
`
`

`
`CGI Programming
`on the World Wide Web
`
`Shishir Gundavaram
`
`Bonn
`
`Cambridge
`
`Paris
`
`Sebastopol
`
`Tokyo
`
`OReilly
`
`Associates Inc
`
`Petitioner IBM – Ex. 1039, p. 4
`
`

`
`CIII Programming on the World Wide Web
`by Shishir Gundavaram
`
`Associates Inc All rights reserved
`1996 OReilly
`Copyright
`Printed in the United States of America
`
`Published by OReilly
`
`Associates Inc 103 Morris Street Suite
`
`Sebastopol CA 95472
`
`Editors Andy Oram and Linda Mui
`
`Production Editor Jane Ellin
`
`Printing History
`
`March 1996
`
`First Edition
`
`Nutshell Handbook and the Nutshell Handbook logo are registered trademarks of OReilly
`Associates Inc
`
`Many of the designations used by manufacturers and sellers to distinguish their products are
`claimed as trademarks Where those designations appear in this book and OReilly
`trademark claim the designations have been printed in caps
`Associates Inc was aware of
`caps
`
`or initial
`
`While every precaution has been taken in the preparation of this book the publisher assumes
`no responsibility for errors or omissions or for damages resulting from the use of the
`information contained herein
`
`This book is printed on acid-free paper with 85% recycled content 15% post-consumer waste
`is committed to using paper with the highest recycled content available
`Associates
`OReilly
`consistent with high quality
`
`ISBN 1-56592-168-2
`
`Petitioner IBM – Ex. 1039, p. 5
`
`

`
`Table of Contents
`
`Preface
`
`The Common Gateway Interface CGI
`Is CGP
`What
`
`CGI Applications
`Some Working CGI Applications
`
`Internal Workings of CGI
`
`Configuring the Server
`
`Programming in CGI
`
`CGI Considerations
`
`Overview of the Book
`
`Input to the Common Gateway Interface
`
`Introduction
`
`Using Environment Variables
`Accessing Form Input
`
`Extra Path Information
`
`Other Languages Under UNIX
`
`Other Languages Under Microsoft Windows
`
`Other Languages on Macintosh Servers
`
`Examining Environment Variables
`
`ix
`
`13
`
`13
`
`15
`
`15
`
`16
`
`23
`
`30
`
`31
`
`35
`
`36
`
`37
`
`Petitioner IBM – Ex. 1039, p. 6
`
`

`
`vi
`
`Table of Contents
`
`Output from the Common Gateway Interface
`
`Overview
`
`CGI and Response Headers
`
`Accept Types and Content Types
`The Content-length Header
`
`Server Redirection
`
`The Expires and Pragma Headers
`Status Codes
`
`Complete Non-Parsed Headers
`
`4Forms and CGI
`HTML Tags
`Sending Data to the Server
`
`Designing Applications Using Forms in Perl
`
`Decoding Forms in Other Languages
`
`Server Side Includes
`
`IntroductiOn
`
`Configuration
`
`Environment Variables
`
`Including Boilerplates
`
`File Statistics
`
`Executing External Programs
`
`Executing CGI Programs
`
`Tailoring 551 Output
`Common Errors
`
`Hypermedia Documents
`Creating Dynamic Home Pages
`CGI Examples with PostScript
`The gd Graphics Library
`CGI Examples with gnuplot
`CGI Examples with pgperl
`
`Animation
`
`39
`
`39
`
`40
`
`41
`
`42
`
`44
`
`46
`
`47
`
`49
`
`51
`
`52
`
`59
`
`63
`
`69
`
`87
`
`87
`
`89
`
`90
`
`91
`
`92
`
`93
`
`94
`
`99
`
`100
`
`101
`
`101
`
`104
`
`116
`
`127
`
`131
`
`136
`
`Petitioner IBM – Ex. 1039, p. 7
`
`

`
`Table of Contents
`
`Advanced Form Applications
`Guestbook
`
`Survey/Poll and Pie Graphs
`Quiz/Test Form Application
`
`Security
`
`Mu1t4le Form Interaction
`Hidden Fields
`
`CGI Side Includes
`
`Netscape Persistent Cookies
`
`Gateways Databases and Search/Index Utilities
`UNIX Manual Page Gateway
`
`Mail Gateway
`
`Relational Databases
`
`Search/Index Gateway
`
`10 Gateways to Internet Information Servers
`Overview
`
`What Are Sockets7
`
`Socket
`
`I/O in Perl
`
`Socket Library
`Checking Hypertext HYFP Links
`
`Archie
`Network News on the Web
`
`Magic Cookies
`
`Maintaining State with
`
`Server
`
`Forking/Spawning Child Processes
`
`11 Advanced and Creative CGI Applications
`Animated Clock
`
`Game of Concentration
`
`Introduction to Imagemaps
`Calendar Manager
`
`12 Debugging and Testing CGI Applications
`Common Errors
`
`Programming/System Errors
`
`vii
`
`143
`
`143
`
`151
`
`163
`
`180
`
`183
`
`184
`
`190
`
`202
`
`205
`
`205
`
`215
`
`223
`
`255
`
`263
`
`263
`
`264
`
`264
`
`268
`
`269
`
`271
`
`279
`
`290
`
`293
`
`308
`
`311
`
`311
`
`314
`
`326
`
`327
`
`367
`
`367
`
`370
`
`Petitioner IBM – Ex. 1039, p. 8
`
`

`
`viii
`
`Table of Contents
`
`Environment Variables
`
`Logging and Simulation
`CGI LintA Debugging/Testing Tool
`Set UID/GID Wrapper
`
`Pen CGI Programming FAQ
`
`Summary of Regular Expressions
`
`CGI Modules for Perl
`
`CGILite
`
`372
`
`373
`
`375
`
`380
`
`383
`
`401
`
`405
`
`413
`
`Applications Modules Utilities and Documentation
`
`417
`
`Index
`
`423
`
`Petitioner IBM – Ex. 1039, p. 9
`
`

`
`Preface
`
`The Common Gateway Interface CGI emerged as the first way to present dynam
`ically generated information on the World Wide Web CGI allows the computer
`generate Web pages instantly at
`the users request rather
`than being written by
`someone in advance And at
`remains the only stable
`the time of
`this writing it
`and well-understood method for creating such pages Java presents problems that
`have not yet been solved Other products are currently just in the announcement
`stage
`
`to
`
`is fun You can get
`CGI
`kick out of writing scripts that perform tricks for you
`and the users enjoy the spice the scripts add to your Web pages But CGI has
`serious side too It
`lets the Internet offer the kind of interactive user-driven appli
`that modern computer users have come to expect CGI opens up an entire
`cations
`class of modern applications to the Web
`
`to particular questions Gone are
`Todays computer users expect custom answers
`the days when people were satisfied by the computing center staff passing out
`to all users Instead each salesperson manager and engi
`single general report
`neer wants to enter specific queries and get up-to-date responses And if
`single
`computer can do that why not the Web
`
`This is the promise of CGI You can display sales figures for particular products
`month by month as requested by your staff using beautiful pie charts or plots
`You can let customers enter keywords in order to find information on your prod
`ucts You can also offer day-to-day conveniences
`like collecting comments from
`users offering them searches
`through your archives and letting them sign your
`guestbook
`
`ix
`
`Petitioner IBM – Ex. 1039, p. 10
`
`

`
`Whats in the Book
`
`Preface
`
`So on to the book What will you encounter here
`variety of powerful applica
`serve as models for your own CGI scripts
`tions that you can use and that will
`Among the complete applications in the book are an animated clock
`search
`gateway to Usenet News
`game
`clickable imagemap
`
`quiz program
`survey
`tool
`appointment calendar based on
`
`and an
`
`to set up your own database and cant afford
`commercial product
`If you want
`like Oracle you can use the Sprite extension to Perl that wrote Sprite offers
`subset of SQL commands with
`file as the database
`also offer
`debugging
`flat
`program called CGI Lint and
`program that lets you write and parse extensions
`to HTML
`but you can
`wrote the latter program to support my quiz application
`to other purposes without much trouble Appendix
`adapt
`Applications
`Modules Utilities and Documentation
`lists where you can get Sprite and CGI Lint
`
`it
`
`hope to give you is not any particular program but
`But
`the most important
`tool
`thorough understanding of CGIs potential and how to invoke it The ideas in
`these programs should become yours for any purpose you want no matter what
`someone
`you use The old adage about
`teaching
`language
`operating system or
`how to fish may no longer be politically
`world of dangerously
`correct
`to do The tech
`the metaphor describes what
`want
`depleted fish stocks but
`show in this book are fundamental CGI practices passing information
`niques
`through SQL
`between client browser and server
`interacting with databases
`to existing programs and storing informa
`
`in
`
`generating graphics writing gateways
`tion while handling multiple forms
`
`What You Are Expected to Know
`Before Reading
`
`levels of computer expertise come to CGI to solve their
`People at many different
`expect you to be comfortable thinking
`problems CGI involves programming so
`dont expect you to know any particular
`programmer
`language but you
`like
`must promise that when
`show you
`loop you wont be thrown for
`loop
`want this book to be chock
`full of unique CGI techniques that you wont
`where and therefore
`dont want to take up space telling you things that you can
`find in many other books
`
`find else
`
`of choice for CGI programming is Perl at least on UNIX systems
`The language
`little about several other languages notably Tcl But most examples are
`also talk
`dont expect
`Perl programmer
`in Perl Still
`to force you into being
`do carefully in plain English
`so you can implement
`describe everything
`
`try to
`
`the
`
`Petitioner IBM – Ex. 1039, p. 11
`
`

`
`Preface
`
`xi
`
`of your choice Remember
`same techniques in the language
`the way you implement it
`is up to you
`learn is the concept
`
`the main thing to
`
`If you do come to the same conclusion that thousands of CGI programmers have
`reachedthat Perl
`in which to do the text and array manip
`is the easiest
`language
`ulation that characterizes CGI tasksthen you can use my examples as
`basis for
`the book with either
`your own Perl programs and supplement
`the extensive
`manual pages or the books on Perl from OReilly
`Associates Learning Pen by
`Randal Schwartz
`beginning tutorial and Programming Pen by Larry Wall and
`as
`Randal Schwartz
`for advanced
`is available on many non-UNIX
`techniques Perl
`systems by the way
`
`UNIX bias in this book because UNIX is the
`should admit up front
`that theres
`most popular system for Web servers Some of
`do all
`the time on
`the things
`UNIXsuch as pipe output
`to another programhave to be done differently on
`other systems And similarly some of
`that go along with
`the security concerns
`executing UNIX commands wont exist on other systems But
`repeat The basic
`CGI tasks are the same in any language on any system They spring from the divi
`labor between
`and
`client and server
`sion of
`the
`
`protocols
`
`they use
`
`to
`
`communicate
`
`Organization of This Book
`few
`but you have to firmly understand
`CGI concepts
`are not very difficult
`aspects of how the client and server work before you start programming So
`followed by
`offer
`discussion of basic proto-
`quick introduction
`in Chapter
`and
`After that its off on whirlwind tour of CGI techniques
`cols in Chapters
`with complete working examples
`
`The Common Gateway Interface CGI explains how CGI works and
`Chapter
`you can use to write scripts
`compares the different
`languages
`
`from Web
`Input to the Common Gateway Inteiface describes the input
`Chapter
`to server which you need to capture
`and parse Query strings and input
`streams are discussed here
`
`client
`
`Output from the Common Gateway Interface describes
`Chapter
`Web server sends to
`CGI programmer
`client Everything
`the HTTP protocol
`is here including error values and HTTP headers
`about
`
`the output
`that
`to know
`needs
`
`Forms and CGI
`Chapter
`form-based CGI applications
`
`introduces you to HTML
`
`forms and to some simple
`
`covers some useful quick services
`Server Side Includes
`Chapter
`that the server
`can handle for you such as inserting the current date into your document
`
`Petitioner IBM – Ex. 1039, p. 12
`
`

`
`xii
`
`Preface
`
`shows
`Hypermedia Documents
`Chapter
`of ways to
`incorporate
`variety
`graphics and animation into CGI output Among the languages
`and extensions
`the gd extension to Perl and the pgperl plotting
`illustrated are PostScript gnuplot
`
`library
`
`Advanced Form Applications
`shows more complicated examples using
`Chapter
`the forms interface to CGI
`show
`generalized interface that you can use to let
`develop their own forms the quiz application
`mentioned
`
`your colleagues
`
`earlier
`
`Chapter Multiple Form Interaction shows several approaches to passing infor
`show how to use hidden fields
`mation between multiple CGI programs
`Netscapes persistent cookies and CGI side includes to maintain state
`
`Gateways Databases and Search/Index
`shows you how to
`Chapter
`hook up with existing programs to extend the power of your own CGI script
`introduce several ways to use SQL in
`CGI program including
`interfaces to
`Oracle Sybase and my own Sprite library
`
`Utilities
`
`to Internet
`
`Information Servers extends the ideas in Chap
`Chapter 10 Gateways
`to communication
`over
`the Internet The main example in this
`through
`that can maintain state information for multiple CGI
`cookie server
`
`ters
`
`chapter is
`
`programs
`
`Chapter 11 Advanced and Creative CGI Applications
`advanced
`includes several
`calendar program that shows you how to generate
`examples
`particularly
`imagemap and interpret clicks on the fly
`
`an
`
`Chapter 12 Debugging and Testing CGI Applications
`shows you how to use my CGI Lint tool
`
`lists
`
`common errors and
`
`Appendix
`Perl CGI
`
`Appendix
`in Pen
`
`Perl CGI Programming FAQ is
`
`Frequently Asked Questions list
`
`for
`
`Summary of Regular Expressions lists syntax for regular expressions
`
`CGI Modules for Perl
`Appendix
`introduces
`and shows some examples of their use
`
`variety of CGI niodules for Perl
`
`Appendix
`
`CGILite introduces the CGI Lite library of Perl
`
`Appendix
`
`Applications Modules Utilities and Documentation
`for CGI documentation and software
`print resources
`
`lists URLs and
`
`Petitioner IBM – Ex. 1039, p. 13
`
`

`
`Preface
`
`Conventions in This Book
`
`xiii
`
`types
`
`Courier
`
`Italic
`
`is used
`
`status codes MIME content
`for HTFP headers
`directives in configuration files and computer output
`
`in text
`
`is used for
`names
`pathnames
`filenames
`Internet
`newsgroup
`addresses URL5 email addresses variable names except
`examples terms being introduced
`commands options/switches
`program names subroutine names functions
`methods and hostnames
`
`arrays operators
`
`in
`
`ALL CAPS
`
`is used for environment variables HTML attributes and HTML
`within angle brackets
`
`tags
`
`Acknowledgments
`remember early last year when there was so much demand for
`there was not even one book to help all
`the eager users put up counters or
`yet
`that we write
`guestbooks My boss at
`book on
`that time Dyung Le suggested
`CGI Of course we laughed it off several minutes later
`
`CGI book and
`
`But
`
`the idea never left either one of us Several days later we started writing up
`and the rest
`is historythanks to Adrian Nye an editor at OReilly
`contract
`who helped us put
`dream come true writing
`tech
`It was
`the contract
`together
`nical book for OReilly
`
`Associates
`
`First and foremost Id like to thank Mr Le for not only suggesting the idea for the
`book but giving me an opportunity to develop software straight out of high
`In addition Id like to thank Rita Horsey my other boss who also taught
`school
`me quite
`bit and provided me with an Internet connection in the early days of
`the book
`
`Of course Id also like to thank my family for not only putting up with my bizarre
`work hours during the entire writing period but also coming to my assistance
`could have finished this book without
`whenever
`needed it Theres no way
`their support
`
`the king of
`
`Thanks
`
`to all
`
`the reviewers and everyone who provided suggestions Jeffrey Friedl
`regular expressions Andreas Koenig the father of MakeMaker
`the CGI FAQ Tom Christiansen the UNIX
`the originator
`Marc Hedlund
`of
`wizard Jon Backstrom Joseph Radin Paul DuBois and from ORA Norman
`Paula Ferguson Ellie Cutler Tanya Herlick Frank Willison Andy Oram
`Walsh
`Linda Mui more on these guys in minute and Tim Reilly the godfather of
`the Nutshell
`
`Petitioner IBM – Ex. 1039, p. 14
`
`

`
`xiv
`
`Preface
`
`teachers Andy and Linda
`had the privilege of working with two really excellent
`whom also consider my friends Theyve guided me through the entire process
`and their editorial criticisms were always right on So Id like to thank them for
`everything
`
`Andy has been through some very tough and trying times in the
`Unfortunately
`last several months after an auto accident No doubt hell be back to doing what
`in no time Get well soon Andy
`he does best
`also cant believe the amount of
`time Linda has devoted to the book despite going through the trials and tribula
`tions of pregnancy You guys are great
`
`to the production staff at ORA especially
`Of course
`go out
`great big thanks
`Jane Ellin who has done
`job managing the production
`responsibilities
`great
`with help from Mike Sierra Kismet McDonough Mary Ann Faughnan Sheryl
`Avmch Sue Willing Hanna Dyer and Clairemarie Fisher OLeary Thanks
`to Chris
`the great figures Edie Freedman for designing the cover which
`Reilley for all
`wasnt happy with originally but have come to love Seth Maislin for the index
`and Nancy Priest for the internal design
`
`And last but not
`to all my friends here and to my family and rela
`least
`tives in India especially my grandparents
`
`thanks
`
`Hope you find the book useful
`
`Petitioner IBM – Ex. 1039, p. 15
`
`

`
`In This Chapter
`What Is CGI
`CGI Applications
`Some Working CGI
`
`Applications
`
`Internal Workings of
`CGI
`
`Configuring the
`
`aO
`
`Overview of the Book
`
`What Is CGI
`
`The Common
`Gateway Interface
`CGI
`
`the World Wide Web you will come across
`As you traverse
`frontier of
`the vast
`you wonder How did they do this These documents
`documents that make
`could consist of among other things forms that ask for feedback
`or registration
`the image
`information imagemaps that allow you to click on various parts of
`counters that display the number of users that accessed the document
`and utili
`information In most cases
`ties that allow you to search databases
`for particular
`find that these effects were achieved using the Common Gateway Interface
`youll
`commonly known as CGI
`
`its trivial
`
`write
`
`Its
`
`One of the Internets worst-kept
`secrets is that CGI is astoundingly simple That
`in design and anyone with an iota of programming
`experience can
`only when
`scripts that work
`are more
`needs
`rudimentary
`your
`demanding that you have to master the more complex workings of the Web In
`way CGI is easy the same way cooking is easy anyone can toast
`muffin or
`poach an egg Its only when you want
`Hollandaise sauce that things start
`complicated
`
`is
`
`to get
`
`CGI
`
`the Web server
`that can communicate with other programs
`is the part of
`the Web server can call up
`program while
`running on the server With CGI
`to the program such as what
`host
`the
`data
`user
`passing user-specific
`form syntax The
`the user has supplied using HTML
`connecting from or
`input
`that data and the server passes the programs response
`program then processes
`back to the Web browser
`
`is
`
`few
`CGI isnt magic its just programming with some special types of input and
`rules on program output Everything in between is just programming Of
`
`strict
`
`Petitioner IBM – Ex. 1039, p. 16
`
`

`
`Chapter
`
`The Common Gateway Interface CGI
`
`course there are special
`techniques that are particular
`book
`is mostly about But underlying
`Figure 1-1
`
`it
`
`all
`
`is
`
`the
`
`to CGI and thats what
`this
`shown in
`simple model
`
`WWW Browser
`
`on client
`
`1ni
`
`Server
`
`Application
`
`Submit
`
`completed
`
`form
`
`ol/ CGI
`
`CG/
`
`Programs
`
`response
`
`/1
`
`CGI
`
`Program
`
`response
`
`Figure 1-1 Simple diagram of CGI
`
`CGI Applications
`CGI turns the Web from simple collection of static hypermedia documents into
`whole new interactive medium in which users can ask questions and run appli
`at some of
`look
`cations
`Lets take
`be
`the possible applications
`that can
`
`designed using CGI
`
`Forms
`
`One of the most prominent uses of CGI is in processing forms Forms are
`subset
`of HTML
`that allow the user to supply information The forms interface makes
`Web browsing an interactive process
`for the user and the provider Figure 1-2
`simple form
`shows
`
`number of graphical widgets are available for
`As can be seen from the figure
`form creation such as radio buttons
`and selection lists
`fields checkboxes
`When
`the form is completed by the user the Submit Order button is used to
`send the information to the server which executes
`the program associated with
`the particular form to decode the data
`
`text
`
`forms are used for two main purposes At their simplest forms can be
`Generally
`used to collect
`information from the user But
`they can also be used in more
`complex manner
`to provide back-and-forth interaction For example the user can
`be presented with
`form listing the various documents available on the sewer
`as
`well as an option to search for particular
`information within these documents
`
`Petitioner IBM – Ex. 1039, p. 17
`
`

`
`CGI Applications
`
`Hamej JjJ OJ JJ
`
`BJ1 .j
`Whats CQOj
`
`Net SerQhJ torj
`
`soitwreJ
`
`Netscape CGtCorportian
`
`Order Form
`
`.s.ssse.s
`
`V7t
`14e esign
`woik do you pe
`Sotwaze 1Opnt
`ie1 service
`1eohxd.oa1 uor
`
`AnagrnEnt
`
`Wbtt opertirq system
`
`yot
`
`TJ1tLX
`
`oin oheok 11 tb ajply
`
`is your moen
`
`28.8K
`
`Comments
`
`love your prodts They
`
`ro great
`
`Paymert
`
`1ster Card Ovisa QDisoovr
`
`Oerj LearFonni
`
`Figure 1-2 Simple form illustrating different widgets
`
`CGI program can process this information and return documents that match the
`users selection criteria
`
`Forms and CG1
`Chapter
`Form Applications
`
`discusses
`
`incorporating
`
`forms in detail and Chapter
`forms into several
`shows examples of
`
`Advanced
`
`robust
`
`applications
`
`Gateways
`
`Web
`are programs or scripts used to access
`information that
`is not
`gateways
`directly readable by the client For example say you have an Oracle database that
`the players on your company team and you
`contains
`baseball statistics
`would like to provide this information on the Web How would you do it You
`
`for all
`
`Petitioner IBM – Ex. 1039, p. 18
`
`

`
`Chapter
`
`The Common Gateway Interface CGI
`
`file i.e open the URL associ
`certainly cannot point your client
`to see any meaningful data
`ated with the file and expect
`
`to the database
`
`gateway You can use
`CGI provides
`solution to the problem in the form of
`such as oraperl see Chapter
`Gateways Databases and Search/Index
`language
`DBI extension to Perl to form SQL queries to
`Utilities for more information or
`read the information contained within the database Once you have the informa
`tion you can format and send it
`In this case the CGI program serves
`to the client
`to the Oracle database as shown in Figure 1-3
`as
`gateway
`
`ORACLETM
`
`Database
`
`11 zJ
`
`__________
`
`Request
`
`failed Request
`
`--- SQL
`MOUAM
`
`Web Gateway
`
`____________
`
`Request
`
`Result
`
`Figure 1-3
`
`gateway to
`
`database
`
`Similarly you can write gateway programs to any other
`information
`Internet
`service including Archie WAIS and NNTP Usenet News Chapter 10 Gateways
`Information Servers shows examples of
`interacting with other Internet
`to Internet
`services In addition you can amplify the power of gateways
`by using the forms
`query or search string from the user to retrieve and display
`interface to request
`information We will discuss these special documents next
`dynamic or virtual
`
`Virtual Documents
`
`the heart of CGI Virtual documents
`Virtual or dynamic document creation is at
`users information request You can create
`are created on the fly in response to
`virtual HTML plain text
`image and even audio documents
`simple example of
`virtual document could be something as trivial
`as this
`
`Petitioner IBM – Ex. 1039, p. 19
`
`

`
`Some Working CGlApplicatkrns
`
`___________
`
`to Shishirs WWW Server
`Welcome
`You are visiting from diamond.com The load average
`1.25
`Happy navigating
`
`on this machine is
`
`In this example there are two pieces of dynamic information the alphanumeric
`UP name of
`on the serving
`the remote user and the load average
`address
`very simple example indeed
`machine This is
`
`creating
`
`On the other hand very complex virtual documents can be created by writing
`combination of graphics libraries gateways and forms As
`programs that utilize
`more sophisticated example say you are the manager of an art gallery that
`specializes in selling replicas of ancient Renaissance paintings and you are inter
`these masterpieces on the Web You start out by
`ested in presenting images of
`form that asks for user information for the purpose of promotional mail
`the user to enter the name of
`painting as well
`search field for
`ings presents
`selection list containing popular paintings Once the user submits the form to
`certain address or store
`program can email
`the user information to
`the server
`file And depending on the users selection either
`message stating that
`in
`the painting can be displayed along
`the painting does not exist or an image of
`with some historical
`information located elsewhere on the Internet
`
`as
`
`it
`
`form with several
`Along with the picture and history another
`image processing
`the picture can be
`contrast and/or
`size of
`options to modify the brightness
`displayed You can write another CGI program to modify the image properties on
`the fly using certain graphics libraries such as gd sending the resultant picture to
`the client
`
`This is an example of more complex CGI program utilizing many aspects of CGI
`programming Several such examples will be presented in this book
`
`Some Working CGI Applications
`What better way to learn about CGI than to see actual programs in action Here
`are the locations of some of the more impressive CGI programs on the Web
`
`Lycos World Wide Web Search
`Located at http.//www.lycos.com this server allows the user to search the Web
`dynamic hypertext document contain
`for specific documents Lycos returns
`ing the documents that match the users search criteria
`
`Coloring Book
`
`An entertaining application that displays an image for users to color
`accessed at http.//www.ravenna.com/coloring
`
`It can be
`
`Petitioner IBM – Ex. 1039, p. 20
`
`

`
`Chapter
`
`The Common Gateway Interface CGI
`
`ArchiePlex Gateway
`
`gateway to the Archie search server Allows the user to search for
`virtual hypertext document
`string and
`returns
`
`specific
`This useful gateway is
`rchi e/a rchieplex/a rc hi eplex html
`at http//pubweb.nexor.co
`uk/public/a
`simple Archie gateway is presented in Chapter 10
`
`located
`
`Guestbook with World Map
`
`forms-based application that allows users to leave messages
`guestbook is
`for everyone to see Though there are numerous guestbooks on the Web this
`is one of the best You can access it at http//www.cosy.sbg.ac.at/rec/guestbook
`
`Japanese
`
`English Dictionary
`
`sophisticated CGI program that queries the user for an English word and
`virtual document with graphic images of an equivalent Japanese
`returns
`word or vice versa It can be accessed at http//www.wg.omron.co.jp/cgi-bin/
`j-eSASEffledl.html or at http.//enterp
`rise ic.gc ca/cgi-bin/j-e
`
`Although most of
`these documents are curiosities
`aspects of CGI The interface allows for
`documents using forms and gateways
`
`they illustrate the powerful
`the creation of highly effective
`
`virtual
`
`Internal Workings of CGI
`So how does the whole interface work Most servers expect CGI programs and
`scripts to reside in
`to have
`special directory usually called cgi-bin and/or
`These
`extension
`certain file
`parameters
`configuration
`Configuring the Server section in this chapter When
`user opens
`CGI program the client sends
`ated with
`request to the server asking for the
`
`are discussed
`in the
`URT associ
`
`file
`
`For the most part
`CGI program looks the same as it does for all
`the request for
`Web documents The difference is that when
`server recognizes that
`the address
`being requested is
`CGI program the server does not
`return the file contents
`verbatim Instead the server tries to execute
`the program Here is what
`client request might look like
`
`sample
`
`HTTP/1.O
`
`/cgi-bin/welcome.pl
`GET
`Accept www/source
`AccepL
`texL/hLml
`AccepL
`image/gif
`User-Agent
`Lynx/2.4 libwww/2.14
`From shjshjr@bu edu
`
`This GET request
`server
`
`identifies the file
`
`to retrieve as /cgi-bin/welcome.pl
`Since the
`in the cgi-bin directory tree as CGI
`is configured to recognize all
`programs it understands that it should execute
`the program instead of relaying it
`
`files
`
`Petitioner IBM – Ex. 1039, p. 21
`
`

`
`Internal Workings of CGI
`
`directly
`
`to
`
`the browser The
`
`string HTTP/
`
`identifies
`
`the
`
`communication
`
`protocol
`
`to use
`
`The
`
`client
`
`can accept www/source
`passes the
`request also
`and image/gif
`text/html
`Lynx client and sends user
`as
`information All this information is made available to the CGI program along with
`information from the server
`additional
`
`data formats it
`
`identifies itself
`
`their
`
`input depends on the server and on the
`The way that CGT programs get
`native operating system On
`from
`UNIX system CGT programs get
`standard input sTDIN and from UNIX environment
`These
`variables
`variables
`form the
`the input search string in the case of
`store such information as
`in bytes the remote host and user
`the length of
`the input
`format of the input
`information They also store the server name
`passing the input and other client
`the communication protocol and the name of the software running the server
`
`their
`
`input
`
`new docu
`Once the CGT program starts running it can either create and output
`ment or provide the URL to an existing one On UNIX programs send their
`to standard output STDOUT as
`data stream The data stream consists of
`output
`full or partial HflP header that at minimum
`two parts The first part
`is either
`the returned data is in e.g HTML plain text GIF etc.
`describes what
`format
`is the body
`blank line signifies the end of
`the header section The second part
`which contains
`type reflected in the header
`the data conforming to the format
`The body is not modified or interpreted by the server in any way
`
`header
`
`ally
`
`If
`
`CGT program can choose to send the newly created data directly to the client or
`complete HYIP
`to send it
`the output consists of
`indirectly through the server
`the data is sent directly to the client without server modification Its actu
`little more complicated than this as we will discuss
`in Chapter
`from the Common Gateway Interface Or as is usually the case the output
`data stream The
`to the server as
`is then responsible for adding the
`server
`complete header information and using the HTTP protocol
`to transfer the data to
`the client
`
`Output
`
`is sent
`
`Here is the sample output of
`with the complete HflP header
`
`program generating an HTML virtual document
`
`200 OK
`HTTP/1.0
`22-February--96 082800 GMT
`Date Thursday
`Server NCSA/1.4.2
`MIME-version
`1.0
`Content-type text/html
`Content-length 2000
`
`HTML
`HEADTITLEWelcome
`
`to Shishirs WWW Server/TITLEc/HEAD
`
`Petitioner IBM – Ex. 1039, p. 22
`
`

`
`Chapter
`
`The Common Gateway Interface CGI
`
`BODY
`H1Welcome/H1
`
`/BODY
`/HTML
`
`The header contains
`communication
`the date
`protocol
`the
`the MIME protocol
`response the server name and version and the revision of
`type and the number of
`the MIME content
`Most
`of
`importantly it also consists
`to the number of bytes of the enclosed data as well as the
`characters equivalent
`data itself Now the output with the partial HYFP header
`
`time of
`
`the
`
`and
`
`Content-type text/html
`
`to Shishirts WWW Server/TITLE/HEAD
`
`HTML
`HEADTITLEWelcome
`BODY
`H1Welcome 1/Hi
`
`/BODY
`/HTML
`
`In this instance the only header line that is output
`which describes the MIME format of
`the output Since the output
`is declared
`
`format text/html
`
`is the content
`
`type that
`
`is the Contenttype header
`in HTML
`
`is
`
`is much simpler
`Most CGI programmers prefer
`partial header
`to supply only
`the format and the data than to formulate the complete header infofma
`to output
`there are times when you need to
`to the server However
`tion which can be left
`complete HTTP
`client by outputting
`send
`the information directly
`header
`
`as you will see in Chapter
`
`to the
`
`It
`
`Configuring the Server
`
`Before you can run CGI programs on your server certain parameters in the server
`the NCSA or CERN
`files must be modified If you are using either
`configuration
`HYFP server you need to first
`set the ServerRoot directive in the httpd.conf
`to the directory where the server software is located
`to point
`
`file
`
`ServerRoot
`
`/usr/iocal/etc/httpd
`
`What is MIME and what does it stand for MIME Multipurpose Internet Mail Extensions
`specifica
`tion that was originally developed for sending multiple types of data through electronic mail MIME types
`are used to identify types of data sent as content over the Web
`
`is
`
`Petitioner IBM – Ex. 1039, p. 23
`
`

`
`_____
`
`Programming in CGI
`
`Running CGI Scripts
`On the NCSA server
`the ScriptAlias directive in the server resource map file
`srm.conj5 indicates the directory where the CGI scripts are placed
`
`ScriptAlias
`
`/cgi-bin/
`
`/usr/local/etc/httpd/cgi-bin/
`
`For example if
`
`user accesses the URL
`
`http //your_host
`
`com/cgi-bin/welcome
`
`the local program
`
`/usr/local/etc/httpd/cgi-bin/welcorne
`
`will be executed by the server You can have multiple directories to hold CGI
`
`scripts
`
`ScriptAlias
`ScriptAlias
`
`/cgi-bin/
`
`/my-cgi--bin/
`
`/usr/local/etc/httpd/cgibin/
`/etc/httpd/mycgi-bin/
`/usr/local
`
`You might wonder why all CGI programs must be placed in distinct directories
`reason for this is system security By having all
`The most
`the programs
`important
`can control and monitor all
`in one place
`server administrator
`the programs
`being run on the system However
`there are directives that allow programs to be
`based on the file extension The following direc
`run outside of
`these directories
`tives when placed in the srm.conf configuration file allow the server to execute
`.cgi extensions
`
`files containing p1 sb or
`
`AddType
`
`application/x-httpd-cgi
`
`.pl
`
`.sh
`
`.cgi
`
`However
`
`this could be very dangerous By globally enabling all
`certain extensions there is
`risk that novice progra

This document is available on Docket Alarm but you must sign up to view it.


Or .

Accessing this document will incur an additional charge of $.

After purchase, you can access this document again without charge.

Accept $ Charge
throbber

Still Working On It

This document is taking longer than usual to download. This can happen if we need to contact the court directly to obtain the document and their servers are running slowly.

Give it another minute or two to complete, and then try the refresh button.

throbber

A few More Minutes ... Still Working

It can take up to 5 minutes for us to download a document if the court servers are running slowly.

Thank you for your continued patience.

This document could not be displayed.

We could not find this document within its docket. Please go back to the docket page and check the link. If that does not work, go back to the docket and refresh it to pull the newest information.

Your account does not support viewing this document.

You need a Paid Account to view this document. Click here to change your account type.

Your account does not support viewing this document.

Set your membership status to view this document.

With a Docket Alarm membership, you'll get a whole lot more, including:

  • Up-to-date information for this case.
  • Email alerts whenever there is an update.
  • Full text search for other cases.
  • Get email alerts whenever a new case matches your search.

Become a Member

One Moment Please

The filing “” is large (MB) and is being downloaded.

Please refresh this page in a few minutes to see if the filing has been downloaded. The filing will also be emailed to you when the download completes.

Your document is on its way!

If you do not receive the document in five minutes, contact support at support@docketalarm.com.

Sealed Document

We are unable to display this document, it may be under a court ordered seal.

If you have proper credentials to access the file, you may proceed directly to the court's system using your government issued username and password.


Access Government Site

We are redirecting you
to a mobile optimized page.





Document Unreadable or Corrupt

Refresh this Document
Go to the Docket

We are unable to display this document.

Refresh this Document
Go to the Docket