Fossil SCM

Fix the $ROOT mechanism in HTML documents so that it accepts any whitespace character before href= and script=. Add $ROOT in appropriate places in the server documentation.

drh 2019-08-21 19:18 trunk
Commit 3e183bfad836ac9ff470596897227391ed4d36f786350332c5cc5a5cd54dbe4d
2 files changed +2 -2 +6 -6
+2 -2
--- src/doc.c
+++ src/doc.c
@@ -526,12 +526,12 @@
526526
for(base=0, i=7; i<n; i++){
527527
if( z[i]=='$'
528528
&& strncmp(&z[i],"$ROOT/", 6)==0
529529
&& (z[i-1]=='\'' || z[i-1]=='"')
530530
&& i-base>=9
531
- && (fossil_strnicmp(&z[i-7]," href=", 6)==0 ||
532
- fossil_strnicmp(&z[i-9]," action=", 8)==0)
531
+ && ((fossil_strnicmp(&z[i-6],"href=",5)==0 && fossil_isspace(z[i-7])) ||
532
+ (fossil_strnicmp(&z[i-8],"action=",7)==0 && fossil_isspace(z[i-9])) )
533533
){
534534
blob_append(cgi_output_blob(), &z[base], i-base);
535535
blob_appendf(cgi_output_blob(), "%R");
536536
base = i+5;
537537
}
538538
--- src/doc.c
+++ src/doc.c
@@ -526,12 +526,12 @@
526 for(base=0, i=7; i<n; i++){
527 if( z[i]=='$'
528 && strncmp(&z[i],"$ROOT/", 6)==0
529 && (z[i-1]=='\'' || z[i-1]=='"')
530 && i-base>=9
531 && (fossil_strnicmp(&z[i-7]," href=", 6)==0 ||
532 fossil_strnicmp(&z[i-9]," action=", 8)==0)
533 ){
534 blob_append(cgi_output_blob(), &z[base], i-base);
535 blob_appendf(cgi_output_blob(), "%R");
536 base = i+5;
537 }
538
--- src/doc.c
+++ src/doc.c
@@ -526,12 +526,12 @@
526 for(base=0, i=7; i<n; i++){
527 if( z[i]=='$'
528 && strncmp(&z[i],"$ROOT/", 6)==0
529 && (z[i-1]=='\'' || z[i-1]=='"')
530 && i-base>=9
531 && ((fossil_strnicmp(&z[i-6],"href=",5)==0 && fossil_isspace(z[i-7])) ||
532 (fossil_strnicmp(&z[i-8],"action=",7)==0 && fossil_isspace(z[i-9])) )
533 ){
534 blob_append(cgi_output_blob(), &z[base], i-base);
535 blob_appendf(cgi_output_blob(), "%R");
536 base = i+5;
537 }
538
--- www/server/index.html
+++ www/server/index.html
@@ -68,11 +68,11 @@
6868
<h2 id="prep">Repository Prep</h2>
6969
7070
<p>
7171
Prior to launching a server on a Fossil repository, it is best to
7272
prepare the repository to be served. The easiest way to do this
73
-is to run the <a href="/help?cmd=ui"><tt>fossil ui</tt></a> command
73
+is to run the <a href="$ROOT/help?cmd=ui"><tt>fossil ui</tt></a> command
7474
on a workstation and then visit the "Setup" menu.
7575
Minimum preparation actions include:</p>
7676
7777
<ol>
7878
<li>
@@ -122,11 +122,11 @@
122122
123123
<p>Most ordinary web servers can <a href="any/cgi.md">run Fossil as a
124124
CGI script</a>. This method is known to work with Apache,
125125
<tt>lighttpd</tt>, and <a
126126
href="any/althttpd.md"><tt>althttpd</tt></a>. The Fossil server
127
-administrator places a <a href="/help?cmd=cgi">short CGI script</a> in
127
+administrator places a <a href="$ROOT/help?cmd=cgi">short CGI script</a> in
128128
the web server's document hierarchy and when a client requests the URL
129129
that corresponds to that script, Fossil runs and generates the
130130
response.</p>
131131
132132
<p>CGI is a good choice for merging Fossil into an existing web site,
@@ -141,11 +141,11 @@
141141
href="any/xinetd.md"><tt>xinetd</tt></a>, <a id="stunnel"
142142
href="any/stunnel.md"><tt>stunnel</tt></a>, <a
143143
href="macos/service.md"><tt>launchd</tt></a>, and <a
144144
href="debian/service.md"><tt>systemd</tt></a>
145145
can be configured to invoke the the
146
-<a href="/help?cmd=http"><tt>fossil http</tt></a> command to handle
146
+<a href="$ROOT/help?cmd=http"><tt>fossil http</tt></a> command to handle
147147
each incoming HTTP request. The "<tt>fossil http</tt>" command reads
148148
the HTTP request off of standard input, computes an appropriate
149149
reply, and writes the reply on standard output. There is a separate
150150
invocation of the "<tt>fossil http</tt>" command for each HTTP request.
151151
The socket listener daemon takes care of relaying content to and from
@@ -153,22 +153,22 @@
153153
handling TLS decryption and encryption.
154154
155155
<h3>Stand-alone HTTP Server</h3>
156156
157157
<p>This is the <a href="any/none.md">easiest method</a>.
158
-A stand-alone server uses the <a
159
-href="/help?cmd=server"><tt>fossil server</tt></a> command to run a
158
+A stand-alone server uses the
159
+<a href="$ROOT/help?cmd=server"><tt>fossil server</tt></a> command to run a
160160
process that listens for incoming HTTP requests on a socket and then
161161
dispatches a copy of itself to deal with each incoming request. You can
162162
expose Fossil directly to the clients in this way or you can interpose a
163163
<a href="https://en.wikipedia.org/wiki/Reverse_proxy">reverse proxy</a>
164164
layer between the clients and Fossil.</p>
165165
166166
<h3>SCGI</h3>
167167
168168
<p>The Fossil standalone server can also handle <a href="any/scgi.md">SCGI</a>.
169
-When the <a href="/help/server"><tt>fossil server</tt></a> command is
169
+When the <a href="$ROOT/help?cmd=server"><tt>fossil server</tt></a> command is
170170
run with the extra <tt>--scgi</tt> option, it listens for incoming
171171
SCGI requests rather than HTTP requests. This allows Fossil to
172172
respond to requests from web servers <a href="debian/nginx.md">such as
173173
nginx</a> that don't support CGI. SCGI is a simpler protocol to proxy
174174
than HTTP, since the HTTP doesn't have to be re-interpreted in terms of
175175
--- www/server/index.html
+++ www/server/index.html
@@ -68,11 +68,11 @@
68 <h2 id="prep">Repository Prep</h2>
69
70 <p>
71 Prior to launching a server on a Fossil repository, it is best to
72 prepare the repository to be served. The easiest way to do this
73 is to run the <a href="/help?cmd=ui"><tt>fossil ui</tt></a> command
74 on a workstation and then visit the "Setup" menu.
75 Minimum preparation actions include:</p>
76
77 <ol>
78 <li>
@@ -122,11 +122,11 @@
122
123 <p>Most ordinary web servers can <a href="any/cgi.md">run Fossil as a
124 CGI script</a>. This method is known to work with Apache,
125 <tt>lighttpd</tt>, and <a
126 href="any/althttpd.md"><tt>althttpd</tt></a>. The Fossil server
127 administrator places a <a href="/help?cmd=cgi">short CGI script</a> in
128 the web server's document hierarchy and when a client requests the URL
129 that corresponds to that script, Fossil runs and generates the
130 response.</p>
131
132 <p>CGI is a good choice for merging Fossil into an existing web site,
@@ -141,11 +141,11 @@
141 href="any/xinetd.md"><tt>xinetd</tt></a>, <a id="stunnel"
142 href="any/stunnel.md"><tt>stunnel</tt></a>, <a
143 href="macos/service.md"><tt>launchd</tt></a>, and <a
144 href="debian/service.md"><tt>systemd</tt></a>
145 can be configured to invoke the the
146 <a href="/help?cmd=http"><tt>fossil http</tt></a> command to handle
147 each incoming HTTP request. The "<tt>fossil http</tt>" command reads
148 the HTTP request off of standard input, computes an appropriate
149 reply, and writes the reply on standard output. There is a separate
150 invocation of the "<tt>fossil http</tt>" command for each HTTP request.
151 The socket listener daemon takes care of relaying content to and from
@@ -153,22 +153,22 @@
153 handling TLS decryption and encryption.
154
155 <h3>Stand-alone HTTP Server</h3>
156
157 <p>This is the <a href="any/none.md">easiest method</a>.
158 A stand-alone server uses the <a
159 href="/help?cmd=server"><tt>fossil server</tt></a> command to run a
160 process that listens for incoming HTTP requests on a socket and then
161 dispatches a copy of itself to deal with each incoming request. You can
162 expose Fossil directly to the clients in this way or you can interpose a
163 <a href="https://en.wikipedia.org/wiki/Reverse_proxy">reverse proxy</a>
164 layer between the clients and Fossil.</p>
165
166 <h3>SCGI</h3>
167
168 <p>The Fossil standalone server can also handle <a href="any/scgi.md">SCGI</a>.
169 When the <a href="/help/server"><tt>fossil server</tt></a> command is
170 run with the extra <tt>--scgi</tt> option, it listens for incoming
171 SCGI requests rather than HTTP requests. This allows Fossil to
172 respond to requests from web servers <a href="debian/nginx.md">such as
173 nginx</a> that don't support CGI. SCGI is a simpler protocol to proxy
174 than HTTP, since the HTTP doesn't have to be re-interpreted in terms of
175
--- www/server/index.html
+++ www/server/index.html
@@ -68,11 +68,11 @@
68 <h2 id="prep">Repository Prep</h2>
69
70 <p>
71 Prior to launching a server on a Fossil repository, it is best to
72 prepare the repository to be served. The easiest way to do this
73 is to run the <a href="$ROOT/help?cmd=ui"><tt>fossil ui</tt></a> command
74 on a workstation and then visit the "Setup" menu.
75 Minimum preparation actions include:</p>
76
77 <ol>
78 <li>
@@ -122,11 +122,11 @@
122
123 <p>Most ordinary web servers can <a href="any/cgi.md">run Fossil as a
124 CGI script</a>. This method is known to work with Apache,
125 <tt>lighttpd</tt>, and <a
126 href="any/althttpd.md"><tt>althttpd</tt></a>. The Fossil server
127 administrator places a <a href="$ROOT/help?cmd=cgi">short CGI script</a> in
128 the web server's document hierarchy and when a client requests the URL
129 that corresponds to that script, Fossil runs and generates the
130 response.</p>
131
132 <p>CGI is a good choice for merging Fossil into an existing web site,
@@ -141,11 +141,11 @@
141 href="any/xinetd.md"><tt>xinetd</tt></a>, <a id="stunnel"
142 href="any/stunnel.md"><tt>stunnel</tt></a>, <a
143 href="macos/service.md"><tt>launchd</tt></a>, and <a
144 href="debian/service.md"><tt>systemd</tt></a>
145 can be configured to invoke the the
146 <a href="$ROOT/help?cmd=http"><tt>fossil http</tt></a> command to handle
147 each incoming HTTP request. The "<tt>fossil http</tt>" command reads
148 the HTTP request off of standard input, computes an appropriate
149 reply, and writes the reply on standard output. There is a separate
150 invocation of the "<tt>fossil http</tt>" command for each HTTP request.
151 The socket listener daemon takes care of relaying content to and from
@@ -153,22 +153,22 @@
153 handling TLS decryption and encryption.
154
155 <h3>Stand-alone HTTP Server</h3>
156
157 <p>This is the <a href="any/none.md">easiest method</a>.
158 A stand-alone server uses the
159 <a href="$ROOT/help?cmd=server"><tt>fossil server</tt></a> command to run a
160 process that listens for incoming HTTP requests on a socket and then
161 dispatches a copy of itself to deal with each incoming request. You can
162 expose Fossil directly to the clients in this way or you can interpose a
163 <a href="https://en.wikipedia.org/wiki/Reverse_proxy">reverse proxy</a>
164 layer between the clients and Fossil.</p>
165
166 <h3>SCGI</h3>
167
168 <p>The Fossil standalone server can also handle <a href="any/scgi.md">SCGI</a>.
169 When the <a href="$ROOT/help?cmd=server"><tt>fossil server</tt></a> command is
170 run with the extra <tt>--scgi</tt> option, it listens for incoming
171 SCGI requests rather than HTTP requests. This allows Fossil to
172 respond to requests from web servers <a href="debian/nginx.md">such as
173 nginx</a> that don't support CGI. SCGI is a simpler protocol to proxy
174 than HTTP, since the HTTP doesn't have to be re-interpreted in terms of
175

Keyboard Shortcuts

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