Fossil SCM

Additional interlinking and clarification of CGI documentation.

drh 2020-08-27 15:11 trunk
Commit 43fb402bfd374f71bf2d3a13c59435b67e8cc86f14315ce04d4fda234abe4677
--- www/aboutcgi.wiki
+++ www/aboutcgi.wiki
@@ -1,12 +1,16 @@
11
<title>How CGI Works In Fossil</title>
22
<h2>Introduction</h2><blockquote>
33
<p>CGI or "Common Gateway Interface" is a venerable yet reliable technique for
44
generating dynamic web content. This article gives a quick background on how
55
CGI works and describes how Fossil can act as a CGI service.
6
-<p>This is a "how it works" guide. If you just want to set up Fossil
7
-as a CGI server, see the [./server/ | Fossil Server Setup] page.
6
+<p>This is a "how it works" guide. This document provides background
7
+information on the CGI protocol so that you can better understand what
8
+is going on behind the scenes. If you just want to set up Fossil
9
+as a CGI server, see the [./server/ | Fossil Server Setup] page. Or
10
+if you want to development CGI-based extensions to Fossil, see
11
+the [./serverext.wiki|CGI Server Extensions] page.
812
</blockquote>
913
<h2>A Quick Review Of CGI</h2><blockquote>
1014
<p>
1115
An HTTP request is a block of text that is sent by a client application
1216
(usually a web browser) and arrives at the web server over a network
@@ -14,20 +18,20 @@
1418
being requested. The URL in the HTTP request is typically the same URL
1519
that appears in the URL bar at the top of the web browser that is making
1620
the request. The URL might contain a "?" character followed
1721
query parameters. The HTTP will usually also contain other information
1822
such as the name of the application that made the request, whether or
19
-not the requesting application can except a compressed reply, POST
23
+not the requesting application can accept a compressed reply, POST
2024
parameters from forms, and so forth.
2125
<p>
2226
The job of the web server is to interpret the HTTP request and formulate
2327
an appropriate reply.
2428
The web server is free to interpret the HTTP request in any way it wants.
2529
But most web servers follow a similar pattern, described below.
2630
(Note: details may vary from one web server to another.)
2731
<p>
28
-Suppose the URL in the HTTP request looks like this:
32
+Suppose the filename component of the URL in the HTTP request looks like this:
2933
<blockquote><b>/one/two/timeline/four</b></blockquote>
3034
Most web servers will search their content area for files that match
3135
some prefix of the URL. The search starts with <b>/one</b>, then goes to
3236
<b>/one/two</b>, then <b>/one/two/timeline</b>, and finally
3337
<b>/one/two/timeline/four</b> is checked. The search stops at the first
@@ -180,10 +184,23 @@
180184
a repository. The PATH_INFO is shortened by removing
181185
"subdir/three/" leaving it at just "timeline".
182186
<li> Fossil looks at the rest of PATH_INFO to see that the webpage
183187
requested is "timeline".
184188
</ol>
189
+<a name="cgivar"></a>
190
+The web server sets many environment variables in step 2 in addition
191
+to just PATH_INFO. The following diagram shows a few of these variables
192
+and their relationship to the request URL:
193
+<pre>
194
+ REQUEST_URI
195
+ ______________|___________________
196
+ / \
197
+ http://example.com/cgis/example2/subdir/three/timeline?c=55d7e1
198
+ \_________/\____________/\____________________/ \______/
199
+ | | | |
200
+ HTTP_HOST SCRIPT_NAME PATH_INFO QUERY_STRING
201
+</pre>
185202
</blockquote>
186203
<h2>Additional CGI Script Options</h2>
187204
<blockquote>
188205
<p>
189206
The CGI script can have additional options used to fine-tune
190207
--- www/aboutcgi.wiki
+++ www/aboutcgi.wiki
@@ -1,12 +1,16 @@
1 <title>How CGI Works In Fossil</title>
2 <h2>Introduction</h2><blockquote>
3 <p>CGI or "Common Gateway Interface" is a venerable yet reliable technique for
4 generating dynamic web content. This article gives a quick background on how
5 CGI works and describes how Fossil can act as a CGI service.
6 <p>This is a "how it works" guide. If you just want to set up Fossil
7 as a CGI server, see the [./server/ | Fossil Server Setup] page.
 
 
 
 
8 </blockquote>
9 <h2>A Quick Review Of CGI</h2><blockquote>
10 <p>
11 An HTTP request is a block of text that is sent by a client application
12 (usually a web browser) and arrives at the web server over a network
@@ -14,20 +18,20 @@
14 being requested. The URL in the HTTP request is typically the same URL
15 that appears in the URL bar at the top of the web browser that is making
16 the request. The URL might contain a "?" character followed
17 query parameters. The HTTP will usually also contain other information
18 such as the name of the application that made the request, whether or
19 not the requesting application can except a compressed reply, POST
20 parameters from forms, and so forth.
21 <p>
22 The job of the web server is to interpret the HTTP request and formulate
23 an appropriate reply.
24 The web server is free to interpret the HTTP request in any way it wants.
25 But most web servers follow a similar pattern, described below.
26 (Note: details may vary from one web server to another.)
27 <p>
28 Suppose the URL in the HTTP request looks like this:
29 <blockquote><b>/one/two/timeline/four</b></blockquote>
30 Most web servers will search their content area for files that match
31 some prefix of the URL. The search starts with <b>/one</b>, then goes to
32 <b>/one/two</b>, then <b>/one/two/timeline</b>, and finally
33 <b>/one/two/timeline/four</b> is checked. The search stops at the first
@@ -180,10 +184,23 @@
180 a repository. The PATH_INFO is shortened by removing
181 "subdir/three/" leaving it at just "timeline".
182 <li> Fossil looks at the rest of PATH_INFO to see that the webpage
183 requested is "timeline".
184 </ol>
 
 
 
 
 
 
 
 
 
 
 
 
 
185 </blockquote>
186 <h2>Additional CGI Script Options</h2>
187 <blockquote>
188 <p>
189 The CGI script can have additional options used to fine-tune
190
--- www/aboutcgi.wiki
+++ www/aboutcgi.wiki
@@ -1,12 +1,16 @@
1 <title>How CGI Works In Fossil</title>
2 <h2>Introduction</h2><blockquote>
3 <p>CGI or "Common Gateway Interface" is a venerable yet reliable technique for
4 generating dynamic web content. This article gives a quick background on how
5 CGI works and describes how Fossil can act as a CGI service.
6 <p>This is a "how it works" guide. This document provides background
7 information on the CGI protocol so that you can better understand what
8 is going on behind the scenes. If you just want to set up Fossil
9 as a CGI server, see the [./server/ | Fossil Server Setup] page. Or
10 if you want to development CGI-based extensions to Fossil, see
11 the [./serverext.wiki|CGI Server Extensions] page.
12 </blockquote>
13 <h2>A Quick Review Of CGI</h2><blockquote>
14 <p>
15 An HTTP request is a block of text that is sent by a client application
16 (usually a web browser) and arrives at the web server over a network
@@ -14,20 +18,20 @@
18 being requested. The URL in the HTTP request is typically the same URL
19 that appears in the URL bar at the top of the web browser that is making
20 the request. The URL might contain a "?" character followed
21 query parameters. The HTTP will usually also contain other information
22 such as the name of the application that made the request, whether or
23 not the requesting application can accept a compressed reply, POST
24 parameters from forms, and so forth.
25 <p>
26 The job of the web server is to interpret the HTTP request and formulate
27 an appropriate reply.
28 The web server is free to interpret the HTTP request in any way it wants.
29 But most web servers follow a similar pattern, described below.
30 (Note: details may vary from one web server to another.)
31 <p>
32 Suppose the filename component of the URL in the HTTP request looks like this:
33 <blockquote><b>/one/two/timeline/four</b></blockquote>
34 Most web servers will search their content area for files that match
35 some prefix of the URL. The search starts with <b>/one</b>, then goes to
36 <b>/one/two</b>, then <b>/one/two/timeline</b>, and finally
37 <b>/one/two/timeline/four</b> is checked. The search stops at the first
@@ -180,10 +184,23 @@
184 a repository. The PATH_INFO is shortened by removing
185 "subdir/three/" leaving it at just "timeline".
186 <li> Fossil looks at the rest of PATH_INFO to see that the webpage
187 requested is "timeline".
188 </ol>
189 <a name="cgivar"></a>
190 The web server sets many environment variables in step 2 in addition
191 to just PATH_INFO. The following diagram shows a few of these variables
192 and their relationship to the request URL:
193 <pre>
194 REQUEST_URI
195 ______________|___________________
196 / \
197 http://example.com/cgis/example2/subdir/three/timeline?c=55d7e1
198 \_________/\____________/\____________________/ \______/
199 | | | |
200 HTTP_HOST SCRIPT_NAME PATH_INFO QUERY_STRING
201 </pre>
202 </blockquote>
203 <h2>Additional CGI Script Options</h2>
204 <blockquote>
205 <p>
206 The CGI script can have additional options used to fine-tune
207
--- www/selfhost.wiki
+++ www/selfhost.wiki
@@ -5,11 +5,10 @@
55
66
1. [https://www.fossil-scm.org/]
77
2. [https://www2.fossil-scm.org/]
88
3. [https://www3.fossil-scm.org/site.cgi]
99
10
-
1110
The canonical repository is (1). Repositories (2) and (3) automatically
1211
stay in synchronization with (1) via a
1312
<a href="http://en.wikipedia.org/wiki/Cron">cron job</a> that invokes
1413
"fossil sync" at regular intervals.
1514
Repository (2) also publishes a
@@ -19,11 +18,11 @@
1918
All three servers support full read/write capabilities.
2019
Changes (such as new tickets or wiki or check-ins) can be implemented
2120
on any of the three servers and those changes automatically propagate to the
2221
other two servers.
2322
24
-Server (1) runs as a CGI script on a
23
+Server (1) runs as a [./aboutcgi.wiki|CGI script] on a
2524
<a href="http://www.linode.com/">Linode 8192</a> located in Dallas, TX
2625
- on the same virtual machine that
2726
hosts <a href="http://www.sqlite.org/">SQLite</a> and over a
2827
dozen other smaller projects. This demonstrates that Fossil can run on
2928
a low-power host processor.
3029
--- www/selfhost.wiki
+++ www/selfhost.wiki
@@ -5,11 +5,10 @@
5
6 1. [https://www.fossil-scm.org/]
7 2. [https://www2.fossil-scm.org/]
8 3. [https://www3.fossil-scm.org/site.cgi]
9
10
11 The canonical repository is (1). Repositories (2) and (3) automatically
12 stay in synchronization with (1) via a
13 <a href="http://en.wikipedia.org/wiki/Cron">cron job</a> that invokes
14 "fossil sync" at regular intervals.
15 Repository (2) also publishes a
@@ -19,11 +18,11 @@
19 All three servers support full read/write capabilities.
20 Changes (such as new tickets or wiki or check-ins) can be implemented
21 on any of the three servers and those changes automatically propagate to the
22 other two servers.
23
24 Server (1) runs as a CGI script on a
25 <a href="http://www.linode.com/">Linode 8192</a> located in Dallas, TX
26 - on the same virtual machine that
27 hosts <a href="http://www.sqlite.org/">SQLite</a> and over a
28 dozen other smaller projects. This demonstrates that Fossil can run on
29 a low-power host processor.
30
--- www/selfhost.wiki
+++ www/selfhost.wiki
@@ -5,11 +5,10 @@
5
6 1. [https://www.fossil-scm.org/]
7 2. [https://www2.fossil-scm.org/]
8 3. [https://www3.fossil-scm.org/site.cgi]
9
 
10 The canonical repository is (1). Repositories (2) and (3) automatically
11 stay in synchronization with (1) via a
12 <a href="http://en.wikipedia.org/wiki/Cron">cron job</a> that invokes
13 "fossil sync" at regular intervals.
14 Repository (2) also publishes a
@@ -19,11 +18,11 @@
18 All three servers support full read/write capabilities.
19 Changes (such as new tickets or wiki or check-ins) can be implemented
20 on any of the three servers and those changes automatically propagate to the
21 other two servers.
22
23 Server (1) runs as a [./aboutcgi.wiki|CGI script] on a
24 <a href="http://www.linode.com/">Linode 8192</a> located in Dallas, TX
25 - on the same virtual machine that
26 hosts <a href="http://www.sqlite.org/">SQLite</a> and over a
27 dozen other smaller projects. This demonstrates that Fossil can run on
28 a low-power host processor.
29
--- www/server/any/cgi.md
+++ www/server/any/cgi.md
@@ -1,11 +1,13 @@
11
# Serving via CGI
22
33
A Fossil server can be run from most ordinary web servers as a CGI
44
program. This feature allows Fossil to seamlessly integrate into a
5
-larger website. We use CGI for the [self-hosting Fossil repository web
6
-site](../../selfhost.wiki).
5
+larger website. The [self-hosting Fossil repository web
6
+site](../../selfhost.wiki) is implemented using CGI. See the
7
+[How CGI Works](../../aboutcgi.wiki) page for background information
8
+on the CGI protocol.
79
810
To run Fossil as CGI, create a CGI script (here called "repo") in the
911
CGI directory of your web server with content like this:
1012
1113
#!/usr/bin/fossil
1214
--- www/server/any/cgi.md
+++ www/server/any/cgi.md
@@ -1,11 +1,13 @@
1 # Serving via CGI
2
3 A Fossil server can be run from most ordinary web servers as a CGI
4 program. This feature allows Fossil to seamlessly integrate into a
5 larger website. We use CGI for the [self-hosting Fossil repository web
6 site](../../selfhost.wiki).
 
 
7
8 To run Fossil as CGI, create a CGI script (here called "repo") in the
9 CGI directory of your web server with content like this:
10
11 #!/usr/bin/fossil
12
--- www/server/any/cgi.md
+++ www/server/any/cgi.md
@@ -1,11 +1,13 @@
1 # Serving via CGI
2
3 A Fossil server can be run from most ordinary web servers as a CGI
4 program. This feature allows Fossil to seamlessly integrate into a
5 larger website. The [self-hosting Fossil repository web
6 site](../../selfhost.wiki) is implemented using CGI. See the
7 [How CGI Works](../../aboutcgi.wiki) page for background information
8 on the CGI protocol.
9
10 To run Fossil as CGI, create a CGI script (here called "repo") in the
11 CGI directory of your web server with content like this:
12
13 #!/usr/bin/fossil
14
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -1,11 +1,11 @@
11
<title>CGI Server Extensions</title>
22
33
<h2>1.0 Introduction</h2>
44
55
If you have a [./server/|Fossil server] for your project,
6
-you can add [https://en.wikipedia.org/wiki/Common_Gateway_Interface|CGI]
6
+you can add [./aboutcgi.wiki|CGI]
77
extensions to that server. These extensions work like
88
any other CGI program, except that they also have access to the Fossil
99
login information and can (optionally) leverage the "skins" of Fossil
1010
so that they appear to be more tightly integrated into the project.
1111
1212
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -1,11 +1,11 @@
1 <title>CGI Server Extensions</title>
2
3 <h2>1.0 Introduction</h2>
4
5 If you have a [./server/|Fossil server] for your project,
6 you can add [https://en.wikipedia.org/wiki/Common_Gateway_Interface|CGI]
7 extensions to that server. These extensions work like
8 any other CGI program, except that they also have access to the Fossil
9 login information and can (optionally) leverage the "skins" of Fossil
10 so that they appear to be more tightly integrated into the project.
11
12
--- www/serverext.wiki
+++ www/serverext.wiki
@@ -1,11 +1,11 @@
1 <title>CGI Server Extensions</title>
2
3 <h2>1.0 Introduction</h2>
4
5 If you have a [./server/|Fossil server] for your project,
6 you can add [./aboutcgi.wiki|CGI]
7 extensions to that server. These extensions work like
8 any other CGI program, except that they also have access to the Fossil
9 login information and can (optionally) leverage the "skins" of Fossil
10 so that they appear to be more tightly integrated into the project.
11
12

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button