SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
Note of 
CGI & ASP 
William.L 
wiliwe@gmail.com 
2013-12-05
Index 
Static & Dynamic Web Pages............................................................................................................................... 3 
In early times – CGI ............................................................................................................................................. 4 
A Successor of CGI - ASP..................................................................................................................................... 6 
Resource................................................................................................................................................................. 8
Static & Dynamic Web Pages 
"Static" means unchanged or constant, while "dynamic" means changing or lively. Therefore, static Web 
pages contain the same prebuilt content each time the page is loaded, while the content of dynamic Web pages 
can be generated on-the-fly(at runtime). 
Standard HTML pages are static Web pages. They contain HTML code, which defines the structure and 
content of the Web page. Each time an HTML page is loaded, it looks the same. The only way the content of an 
HTML page will change is if the Web developer updates and publishes the file. 
Dynamic Web pages, such as PHP, ASP, and JSP pages, contain "server-side" code, which allows the server to 
generate unique content each time the page is loaded. It may also output a unique response based on a Web form 
the user filled out. Many dynamic pages use server-side code to access database information, which enables the 
page's content to be generated from information stored in the database. Web sites that generate Web pages from 
database information are often called database-driven websites. 
There are two primary ways to create a dynamic Web page: 
* Generate the HTML tags via conventional C code. CGI, Common Gateway Interface, is this way. 
* Create the Web page and insert dynamic data at run time via expansion tags(or called escape tag) 
The first way requires no special handling by the Web server and may seem an attractive approach at first. But, 
cause to that Web pages are hard to engineer if you cannot see the final result, so programmers need 
development cycle “edit, compile, display, re-edit, re-compile, re-display”, this is very tedious. 
The second approach allows much faster development cycles. Many HTML design tools such as DreamWeaver, 
can be used to create Web pages in a WYSIWYG manner. All that remains, is the dynamic data that is replaced 
at run time. In this way, the Web page whose full content is generated dynamically contains mini-tags that are 
expanded into real tags with the dynamic data. 
In general, dynamic Web pages have special file extension other than conventional ".htm" or ".html," for the 
recognition of what dynamic Web page technology is adopted such as ".asp", ".php", ".jsp", etc. If it is ".htm" 
or ".html," the page is probably static.
In early times – CGI 
Quoted from W3C (http://www.w3.org/CGI/): 
“An HTTP server is often used as a gateway to a legacy information system; for example, an existing body 
of documents or an existing database application. The Common Gateway Interface is an agreement 
between HTTP server implementors about how to integrate such gateway scripts and programs.” 
CGI is NOT a language but a simple protocol that can be used to communicate between Web forms and your 
(CGI)program. The CGI program is known as CGI script or simply CGI; a CGI program could be written in a 
scripting language or any programming language. CGI programs(executable scripts(with “.cgi” extension) 
or binary files) are usually put in a folder named “cgi-bin”(known CGI directory) under Web server 
document root directory(containing all Web pages(ex: index.html) and relevant resources(ex: pictures)). 
When a request to a CGI program is received by the Web server, it runs the program as a separate process, 
rather than within the Web server process. For each CGI request the environment of the new process must be set 
to include all the CGI variables(environmemt variables) defined in CGI RFC specification. 
The latest version of CGI is v1.1 and was specified as RFC 3875. 
[PDF] http://www.potaroo.net/ietf/rfc/rfc3875.pdf 
[Text] http://www.potaroo.net/ietf/rfc/rfc3875.txt 
The below figure shows the basic flow of generation of dynamic Web pages through GCI. 
Web 
Client 
(browser) 
(2) Invoke 
( STDIN + EnvVar ) 
Web Server 
CGI 
program 
A separate 
process 
Generate (3) 
HTML 
page 
(1) 
HTTP Request 
HTTP Response 
(5) 
(4) Return 
(STDOUT) 
A CGI program mainly contains three parts: standard input(STDIN), standard output(STDOUT) and 
environment variable. The CGI program receives Web messages from Web server through STDIN and send 
generated Web messages to Web server through STDOUT. Web clients(browsers) communicate information 
with Web server through environment variable. 
Reading the User's Form Input 
When the user submits the form, your script receives the form data as a set of name-value pairs. The names are 
what you defined in the INPUT tags (ex: select or textarea), and the values are whatever the user typed in or
selected. 
This set of name-value pairs is given to you as one long string, which you need to parse. The long string is in 
one of these two formats: 
"name1=value1&name2=value2&name3=value3" 
"name1=value1;name2=value2;name3=value3" 
The execution of a CGI program is to create a process and starting the process can consume much more time 
and memory than the actual work of generating the output. So, if the program is called often, the resulting 
workload can quickly overwhelm the Web server. Cause to this short point of CGI, the new way to generate 
Web pages dynamically was developed, e.g. to insert expansion tags into Web pages and convert to actual data 
at runtime(when being request).
A Successor of CGI - ASP 
Active Server Pages (ASP) is a Microsoft developed approach to allow the easy creation of dynamic Web 
pages. Originally shipped in Microsoft IIS, it has now been ported to a wide variety of platforms and is 
available from many vendors in commercial products. 
Active Server Pages permits the scripting of dynamic data using JavaScript or any other supported scripting 
language (ex:VBscript). The Web server would then evaluate the ASP script and the results are substituted into 
the page replacing the original script before it is sent to the user's browser. This should be done in a one-pass 
operation for maximum efficiency. By using such server-side scripting, the dynamic data to be displayed is 
easily modified without recompiling the Web server. 
Web pages using ASP normally(but not mandatorily) have an “.asp” extension to distinguish them form normal 
HTML pages. To insert ASP tag in a Web page, the scripting code is encapsulated/enclosed using the special 
marking “<%” and “%>”, also called ASP delimiter. 
<%TagName1%> 
<html> 
<head> 
</head> 
<body> 
<%TagName2%> 
</body> 
</html> 
Actual Data 1 
<html> 
<head> 
</head> 
<body> 
Actual Data 2 
</body> 
</html> 
Web server scans and 
replaces escape tags 
with actual data 
The below figure shows the basic flow of generation of dynamic Web pages through ASP. 
Web 
Client 
(browser) 
Web Server 
HTML Page 
<%TagName1%> 
<%TagName2%> 
Replace (2) 
HTML Page 
Actual Data 1 
Actual Data 2 
(1) 
HTTP Request 
HTTP Response 
(3)
For small Web server(GoAhead, Boa) using ASP way to generate dynamic Web pages, a programmer add ASP 
tags in Web page and tag handlers in Web server code correspondingly. In practice, it usually uses table-style to 
store “EscapeTag - TagHandler” pair, EscapeTag is string type and TagHandler is function pointer. For 
example (in C language, TagHandlerEntry is a structure), 
TagHandlerEntry AspTagHandlerTab[] = { 
{ "get_timezone", get_timezone }, 
{ "get_date", get_date}, 
... 
}; 
Some Web server may provide pre-defined macro for programmer to add each entry of tag handler table. 
GoAhead is one such Web server, it provides function websAspDefine() to register an ASP tag and its handler 
into the tag handler table.
Resource 
* GoAhead WebServer White Paper 
http://www.embed.com.cn/protocol/goahead/GoAhead%20WebServer%20white%20paper.doc

Mais conteúdo relacionado

Mais procurados (20)

XSLT. Basic.
XSLT. Basic.XSLT. Basic.
XSLT. Basic.
 
React Js Simplified
React Js SimplifiedReact Js Simplified
React Js Simplified
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Service Worker Presentation
Service Worker PresentationService Worker Presentation
Service Worker Presentation
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Angular
AngularAngular
Angular
 
Linkers And Loaders
Linkers And LoadersLinkers And Loaders
Linkers And Loaders
 
Modern Web Development
Modern Web DevelopmentModern Web Development
Modern Web Development
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Text Editor for System software
Text Editor for System softwareText Editor for System software
Text Editor for System software
 
Basics of the Web Platform
Basics of the Web PlatformBasics of the Web Platform
Basics of the Web Platform
 
React Tech Salon
React Tech SalonReact Tech Salon
React Tech Salon
 
Web services SOAP
Web services SOAPWeb services SOAP
Web services SOAP
 
UDA-Componentes RUP. Diálogo (v2.1.0 deprecado)
UDA-Componentes RUP. Diálogo  (v2.1.0 deprecado)UDA-Componentes RUP. Diálogo  (v2.1.0 deprecado)
UDA-Componentes RUP. Diálogo (v2.1.0 deprecado)
 
Soap Vs Rest
Soap Vs RestSoap Vs Rest
Soap Vs Rest
 
Go at uber
Go at uberGo at uber
Go at uber
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python Meetup
 
PHP slides
PHP slidesPHP slides
PHP slides
 
Angular Best Practices - Perfomatix
Angular Best Practices - PerfomatixAngular Best Practices - Perfomatix
Angular Best Practices - Perfomatix
 
Web-Socket
Web-SocketWeb-Socket
Web-Socket
 

Destaque

Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 UsageWilliam Lee
 
C Program Runs on Wrong Target Platform(CPU Architecture)
C Program Runs on Wrong Target Platform(CPU Architecture)C Program Runs on Wrong Target Platform(CPU Architecture)
C Program Runs on Wrong Target Platform(CPU Architecture)William Lee
 
Cygwin Install How-To (Chinese)
Cygwin Install How-To (Chinese)Cygwin Install How-To (Chinese)
Cygwin Install How-To (Chinese)William Lee
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web PageWilliam Lee
 
Usage Note of PlayCap
Usage Note of PlayCapUsage Note of PlayCap
Usage Note of PlayCapWilliam Lee
 
Usage Note of Microsoft Dependency Walker
Usage Note of Microsoft Dependency WalkerUsage Note of Microsoft Dependency Walker
Usage Note of Microsoft Dependency WalkerWilliam Lee
 
Viewing Android Source Files in Eclipse (Chinese)
Viewing Android Source Files in Eclipse  (Chinese)Viewing Android Source Files in Eclipse  (Chinese)
Viewing Android Source Files in Eclipse (Chinese)William Lee
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHPWilliam Lee
 

Destaque (8)

Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 Usage
 
C Program Runs on Wrong Target Platform(CPU Architecture)
C Program Runs on Wrong Target Platform(CPU Architecture)C Program Runs on Wrong Target Platform(CPU Architecture)
C Program Runs on Wrong Target Platform(CPU Architecture)
 
Cygwin Install How-To (Chinese)
Cygwin Install How-To (Chinese)Cygwin Install How-To (Chinese)
Cygwin Install How-To (Chinese)
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web Page
 
Usage Note of PlayCap
Usage Note of PlayCapUsage Note of PlayCap
Usage Note of PlayCap
 
Usage Note of Microsoft Dependency Walker
Usage Note of Microsoft Dependency WalkerUsage Note of Microsoft Dependency Walker
Usage Note of Microsoft Dependency Walker
 
Viewing Android Source Files in Eclipse (Chinese)
Viewing Android Source Files in Eclipse  (Chinese)Viewing Android Source Files in Eclipse  (Chinese)
Viewing Android Source Files in Eclipse (Chinese)
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHP
 

Semelhante a Note of CGI and ASP

Decoding the Web
Decoding the WebDecoding the Web
Decoding the Webnewcircle
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3Gopi A
 
Improving web site performance and scalability while saving
Improving web site performance and scalability while savingImproving web site performance and scalability while saving
Improving web site performance and scalability while savingmdc11
 
Web-Technologies 26.06.2003
Web-Technologies 26.06.2003Web-Technologies 26.06.2003
Web-Technologies 26.06.2003Wolfgang Wiese
 
Rails Girls - Introduction to HTML & CSS
Rails Girls - Introduction to HTML & CSSRails Girls - Introduction to HTML & CSS
Rails Girls - Introduction to HTML & CSSTimo Herttua
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
Integrate Sas With Google Maps
Integrate Sas With Google MapsIntegrate Sas With Google Maps
Integrate Sas With Google Mapsvineetkaul
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web ApplicationSachin Walvekar
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaJignesh Aakoliya
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB
 
Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)Gustaf Nilsson Kotte
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB
 

Semelhante a Note of CGI and ASP (20)

Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
 
Decoding the Web
Decoding the WebDecoding the Web
Decoding the Web
 
Presemtation Tier Optimizations
Presemtation Tier OptimizationsPresemtation Tier Optimizations
Presemtation Tier Optimizations
 
Html5
Html5Html5
Html5
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
Web 2 0 Tools
Web 2 0 ToolsWeb 2 0 Tools
Web 2 0 Tools
 
Improving web site performance and scalability while saving
Improving web site performance and scalability while savingImproving web site performance and scalability while saving
Improving web site performance and scalability while saving
 
Web-Technologies 26.06.2003
Web-Technologies 26.06.2003Web-Technologies 26.06.2003
Web-Technologies 26.06.2003
 
Rails Girls - Introduction to HTML & CSS
Rails Girls - Introduction to HTML & CSSRails Girls - Introduction to HTML & CSS
Rails Girls - Introduction to HTML & CSS
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Integrate Sas With Google Maps
Integrate Sas With Google MapsIntegrate Sas With Google Maps
Integrate Sas With Google Maps
 
Ecom 1
Ecom 1Ecom 1
Ecom 1
 
Fm 2
Fm 2Fm 2
Fm 2
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
 
CGI by rj
CGI by rjCGI by rj
CGI by rj
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
 
Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch Tutorial
 

Mais de William Lee

Usage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP LanguagesUsage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP LanguagesWilliam Lee
 
Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxWilliam Lee
 
Upgrade GCC & Install Qt 5.4 on CentOS 6.5
Upgrade GCC & Install Qt 5.4 on CentOS 6.5 Upgrade GCC & Install Qt 5.4 on CentOS 6.5
Upgrade GCC & Install Qt 5.4 on CentOS 6.5 William Lee
 
Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3William Lee
 
Qt4 App - Sliding Window
Qt4 App - Sliding WindowQt4 App - Sliding Window
Qt4 App - Sliding WindowWilliam Lee
 
GTK+ 2.0 App - Desktop App Chooser
GTK+ 2.0 App - Desktop App ChooserGTK+ 2.0 App - Desktop App Chooser
GTK+ 2.0 App - Desktop App ChooserWilliam Lee
 
GTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon ChooserGTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon ChooserWilliam Lee
 
Moblin2 - Window Manager(Mutter) Plugin
Moblin2 - Window Manager(Mutter) PluginMoblin2 - Window Manager(Mutter) Plugin
Moblin2 - Window Manager(Mutter) PluginWilliam Lee
 
Asterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log RotationAsterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log RotationWilliam Lee
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5William Lee
 
Android Storage - StorageManager & OBB
Android Storage - StorageManager & OBBAndroid Storage - StorageManager & OBB
Android Storage - StorageManager & OBBWilliam Lee
 
Study of Chromium OS
Study of Chromium OSStudy of Chromium OS
Study of Chromium OSWilliam Lee
 
GNOME GeoClue - The Geolocation Service in Gnome
GNOME GeoClue - The Geolocation Service in GnomeGNOME GeoClue - The Geolocation Service in Gnome
GNOME GeoClue - The Geolocation Service in GnomeWilliam Lee
 
Introdunction To Network Management Protocols SNMP & TR-069
Introdunction To Network Management Protocols SNMP & TR-069Introdunction To Network Management Protocols SNMP & TR-069
Introdunction To Network Management Protocols SNMP & TR-069William Lee
 
More Details about TR-069 (CPE WAN Management Protocol)
More Details about TR-069 (CPE WAN Management Protocol)More Details about TR-069 (CPE WAN Management Protocol)
More Details about TR-069 (CPE WAN Management Protocol)William Lee
 
CWMP TR-069 Training (Chinese)
CWMP TR-069 Training (Chinese)CWMP TR-069 Training (Chinese)
CWMP TR-069 Training (Chinese)William Lee
 
Qt Development Tools
Qt Development ToolsQt Development Tools
Qt Development ToolsWilliam Lee
 
Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069William Lee
 

Mais de William Lee (20)

Usage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP LanguagesUsage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP Languages
 
Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on Linux
 
Upgrade GCC & Install Qt 5.4 on CentOS 6.5
Upgrade GCC & Install Qt 5.4 on CentOS 6.5 Upgrade GCC & Install Qt 5.4 on CentOS 6.5
Upgrade GCC & Install Qt 5.4 on CentOS 6.5
 
Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3
 
Qt4 App - Sliding Window
Qt4 App - Sliding WindowQt4 App - Sliding Window
Qt4 App - Sliding Window
 
GTK+ 2.0 App - Desktop App Chooser
GTK+ 2.0 App - Desktop App ChooserGTK+ 2.0 App - Desktop App Chooser
GTK+ 2.0 App - Desktop App Chooser
 
GTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon ChooserGTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon Chooser
 
Moblin2 - Window Manager(Mutter) Plugin
Moblin2 - Window Manager(Mutter) PluginMoblin2 - Window Manager(Mutter) Plugin
Moblin2 - Window Manager(Mutter) Plugin
 
MGCP Overview
MGCP OverviewMGCP Overview
MGCP Overview
 
Asterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log RotationAsterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log Rotation
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5
 
Android Storage - StorageManager & OBB
Android Storage - StorageManager & OBBAndroid Storage - StorageManager & OBB
Android Storage - StorageManager & OBB
 
Study of Chromium OS
Study of Chromium OSStudy of Chromium OS
Study of Chromium OS
 
GNOME GeoClue - The Geolocation Service in Gnome
GNOME GeoClue - The Geolocation Service in GnomeGNOME GeoClue - The Geolocation Service in Gnome
GNOME GeoClue - The Geolocation Service in Gnome
 
Introdunction To Network Management Protocols SNMP & TR-069
Introdunction To Network Management Protocols SNMP & TR-069Introdunction To Network Management Protocols SNMP & TR-069
Introdunction To Network Management Protocols SNMP & TR-069
 
More Details about TR-069 (CPE WAN Management Protocol)
More Details about TR-069 (CPE WAN Management Protocol)More Details about TR-069 (CPE WAN Management Protocol)
More Details about TR-069 (CPE WAN Management Protocol)
 
CWMP TR-069 Training (Chinese)
CWMP TR-069 Training (Chinese)CWMP TR-069 Training (Chinese)
CWMP TR-069 Training (Chinese)
 
Qt Development Tools
Qt Development ToolsQt Development Tools
Qt Development Tools
 
Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069
 
Qt Animation
Qt AnimationQt Animation
Qt Animation
 

Último

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Último (20)

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Note of CGI and ASP

  • 1. Note of CGI & ASP William.L wiliwe@gmail.com 2013-12-05
  • 2. Index Static & Dynamic Web Pages............................................................................................................................... 3 In early times – CGI ............................................................................................................................................. 4 A Successor of CGI - ASP..................................................................................................................................... 6 Resource................................................................................................................................................................. 8
  • 3. Static & Dynamic Web Pages "Static" means unchanged or constant, while "dynamic" means changing or lively. Therefore, static Web pages contain the same prebuilt content each time the page is loaded, while the content of dynamic Web pages can be generated on-the-fly(at runtime). Standard HTML pages are static Web pages. They contain HTML code, which defines the structure and content of the Web page. Each time an HTML page is loaded, it looks the same. The only way the content of an HTML page will change is if the Web developer updates and publishes the file. Dynamic Web pages, such as PHP, ASP, and JSP pages, contain "server-side" code, which allows the server to generate unique content each time the page is loaded. It may also output a unique response based on a Web form the user filled out. Many dynamic pages use server-side code to access database information, which enables the page's content to be generated from information stored in the database. Web sites that generate Web pages from database information are often called database-driven websites. There are two primary ways to create a dynamic Web page: * Generate the HTML tags via conventional C code. CGI, Common Gateway Interface, is this way. * Create the Web page and insert dynamic data at run time via expansion tags(or called escape tag) The first way requires no special handling by the Web server and may seem an attractive approach at first. But, cause to that Web pages are hard to engineer if you cannot see the final result, so programmers need development cycle “edit, compile, display, re-edit, re-compile, re-display”, this is very tedious. The second approach allows much faster development cycles. Many HTML design tools such as DreamWeaver, can be used to create Web pages in a WYSIWYG manner. All that remains, is the dynamic data that is replaced at run time. In this way, the Web page whose full content is generated dynamically contains mini-tags that are expanded into real tags with the dynamic data. In general, dynamic Web pages have special file extension other than conventional ".htm" or ".html," for the recognition of what dynamic Web page technology is adopted such as ".asp", ".php", ".jsp", etc. If it is ".htm" or ".html," the page is probably static.
  • 4. In early times – CGI Quoted from W3C (http://www.w3.org/CGI/): “An HTTP server is often used as a gateway to a legacy information system; for example, an existing body of documents or an existing database application. The Common Gateway Interface is an agreement between HTTP server implementors about how to integrate such gateway scripts and programs.” CGI is NOT a language but a simple protocol that can be used to communicate between Web forms and your (CGI)program. The CGI program is known as CGI script or simply CGI; a CGI program could be written in a scripting language or any programming language. CGI programs(executable scripts(with “.cgi” extension) or binary files) are usually put in a folder named “cgi-bin”(known CGI directory) under Web server document root directory(containing all Web pages(ex: index.html) and relevant resources(ex: pictures)). When a request to a CGI program is received by the Web server, it runs the program as a separate process, rather than within the Web server process. For each CGI request the environment of the new process must be set to include all the CGI variables(environmemt variables) defined in CGI RFC specification. The latest version of CGI is v1.1 and was specified as RFC 3875. [PDF] http://www.potaroo.net/ietf/rfc/rfc3875.pdf [Text] http://www.potaroo.net/ietf/rfc/rfc3875.txt The below figure shows the basic flow of generation of dynamic Web pages through GCI. Web Client (browser) (2) Invoke ( STDIN + EnvVar ) Web Server CGI program A separate process Generate (3) HTML page (1) HTTP Request HTTP Response (5) (4) Return (STDOUT) A CGI program mainly contains three parts: standard input(STDIN), standard output(STDOUT) and environment variable. The CGI program receives Web messages from Web server through STDIN and send generated Web messages to Web server through STDOUT. Web clients(browsers) communicate information with Web server through environment variable. Reading the User's Form Input When the user submits the form, your script receives the form data as a set of name-value pairs. The names are what you defined in the INPUT tags (ex: select or textarea), and the values are whatever the user typed in or
  • 5. selected. This set of name-value pairs is given to you as one long string, which you need to parse. The long string is in one of these two formats: "name1=value1&name2=value2&name3=value3" "name1=value1;name2=value2;name3=value3" The execution of a CGI program is to create a process and starting the process can consume much more time and memory than the actual work of generating the output. So, if the program is called often, the resulting workload can quickly overwhelm the Web server. Cause to this short point of CGI, the new way to generate Web pages dynamically was developed, e.g. to insert expansion tags into Web pages and convert to actual data at runtime(when being request).
  • 6. A Successor of CGI - ASP Active Server Pages (ASP) is a Microsoft developed approach to allow the easy creation of dynamic Web pages. Originally shipped in Microsoft IIS, it has now been ported to a wide variety of platforms and is available from many vendors in commercial products. Active Server Pages permits the scripting of dynamic data using JavaScript or any other supported scripting language (ex:VBscript). The Web server would then evaluate the ASP script and the results are substituted into the page replacing the original script before it is sent to the user's browser. This should be done in a one-pass operation for maximum efficiency. By using such server-side scripting, the dynamic data to be displayed is easily modified without recompiling the Web server. Web pages using ASP normally(but not mandatorily) have an “.asp” extension to distinguish them form normal HTML pages. To insert ASP tag in a Web page, the scripting code is encapsulated/enclosed using the special marking “<%” and “%>”, also called ASP delimiter. <%TagName1%> <html> <head> </head> <body> <%TagName2%> </body> </html> Actual Data 1 <html> <head> </head> <body> Actual Data 2 </body> </html> Web server scans and replaces escape tags with actual data The below figure shows the basic flow of generation of dynamic Web pages through ASP. Web Client (browser) Web Server HTML Page <%TagName1%> <%TagName2%> Replace (2) HTML Page Actual Data 1 Actual Data 2 (1) HTTP Request HTTP Response (3)
  • 7. For small Web server(GoAhead, Boa) using ASP way to generate dynamic Web pages, a programmer add ASP tags in Web page and tag handlers in Web server code correspondingly. In practice, it usually uses table-style to store “EscapeTag - TagHandler” pair, EscapeTag is string type and TagHandler is function pointer. For example (in C language, TagHandlerEntry is a structure), TagHandlerEntry AspTagHandlerTab[] = { { "get_timezone", get_timezone }, { "get_date", get_date}, ... }; Some Web server may provide pre-defined macro for programmer to add each entry of tag handler table. GoAhead is one such Web server, it provides function websAspDefine() to register an ASP tag and its handler into the tag handler table.
  • 8. Resource * GoAhead WebServer White Paper http://www.embed.com.cn/protocol/goahead/GoAhead%20WebServer%20white%20paper.doc