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.
Commit
3e183bfad836ac9ff470596897227391ed4d36f786350332c5cc5a5cd54dbe4d
Parent
154ea087af6d39d…
2 files changed
+2
-2
+6
-6
+2
-2
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -526,12 +526,12 @@ | ||
| 526 | 526 | for(base=0, i=7; i<n; i++){ |
| 527 | 527 | if( z[i]=='$' |
| 528 | 528 | && strncmp(&z[i],"$ROOT/", 6)==0 |
| 529 | 529 | && (z[i-1]=='\'' || z[i-1]=='"') |
| 530 | 530 | && 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])) ) | |
| 533 | 533 | ){ |
| 534 | 534 | blob_append(cgi_output_blob(), &z[base], i-base); |
| 535 | 535 | blob_appendf(cgi_output_blob(), "%R"); |
| 536 | 536 | base = i+5; |
| 537 | 537 | } |
| 538 | 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-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 |
+6
-6
| --- www/server/index.html | ||
| +++ www/server/index.html | ||
| @@ -68,11 +68,11 @@ | ||
| 68 | 68 | <h2 id="prep">Repository Prep</h2> |
| 69 | 69 | |
| 70 | 70 | <p> |
| 71 | 71 | Prior to launching a server on a Fossil repository, it is best to |
| 72 | 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 | |
| 73 | +is to run the <a href="$ROOT/help?cmd=ui"><tt>fossil ui</tt></a> command | |
| 74 | 74 | on a workstation and then visit the "Setup" menu. |
| 75 | 75 | Minimum preparation actions include:</p> |
| 76 | 76 | |
| 77 | 77 | <ol> |
| 78 | 78 | <li> |
| @@ -122,11 +122,11 @@ | ||
| 122 | 122 | |
| 123 | 123 | <p>Most ordinary web servers can <a href="any/cgi.md">run Fossil as a |
| 124 | 124 | CGI script</a>. This method is known to work with Apache, |
| 125 | 125 | <tt>lighttpd</tt>, and <a |
| 126 | 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 | |
| 127 | +administrator places a <a href="$ROOT/help?cmd=cgi">short CGI script</a> in | |
| 128 | 128 | the web server's document hierarchy and when a client requests the URL |
| 129 | 129 | that corresponds to that script, Fossil runs and generates the |
| 130 | 130 | response.</p> |
| 131 | 131 | |
| 132 | 132 | <p>CGI is a good choice for merging Fossil into an existing web site, |
| @@ -141,11 +141,11 @@ | ||
| 141 | 141 | href="any/xinetd.md"><tt>xinetd</tt></a>, <a id="stunnel" |
| 142 | 142 | href="any/stunnel.md"><tt>stunnel</tt></a>, <a |
| 143 | 143 | href="macos/service.md"><tt>launchd</tt></a>, and <a |
| 144 | 144 | href="debian/service.md"><tt>systemd</tt></a> |
| 145 | 145 | 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 | |
| 147 | 147 | each incoming HTTP request. The "<tt>fossil http</tt>" command reads |
| 148 | 148 | the HTTP request off of standard input, computes an appropriate |
| 149 | 149 | reply, and writes the reply on standard output. There is a separate |
| 150 | 150 | invocation of the "<tt>fossil http</tt>" command for each HTTP request. |
| 151 | 151 | The socket listener daemon takes care of relaying content to and from |
| @@ -153,22 +153,22 @@ | ||
| 153 | 153 | handling TLS decryption and encryption. |
| 154 | 154 | |
| 155 | 155 | <h3>Stand-alone HTTP Server</h3> |
| 156 | 156 | |
| 157 | 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 | |
| 158 | +A stand-alone server uses the | |
| 159 | +<a href="$ROOT/help?cmd=server"><tt>fossil server</tt></a> command to run a | |
| 160 | 160 | process that listens for incoming HTTP requests on a socket and then |
| 161 | 161 | dispatches a copy of itself to deal with each incoming request. You can |
| 162 | 162 | expose Fossil directly to the clients in this way or you can interpose a |
| 163 | 163 | <a href="https://en.wikipedia.org/wiki/Reverse_proxy">reverse proxy</a> |
| 164 | 164 | layer between the clients and Fossil.</p> |
| 165 | 165 | |
| 166 | 166 | <h3>SCGI</h3> |
| 167 | 167 | |
| 168 | 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 | |
| 169 | +When the <a href="$ROOT/help?cmd=server"><tt>fossil server</tt></a> command is | |
| 170 | 170 | run with the extra <tt>--scgi</tt> option, it listens for incoming |
| 171 | 171 | SCGI requests rather than HTTP requests. This allows Fossil to |
| 172 | 172 | respond to requests from web servers <a href="debian/nginx.md">such as |
| 173 | 173 | nginx</a> that don't support CGI. SCGI is a simpler protocol to proxy |
| 174 | 174 | than HTTP, since the HTTP doesn't have to be re-interpreted in terms of |
| 175 | 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="/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 |