Fossil SCM

Add --host and --https options to the http command.

drh 2011-01-18 18:58 trunk
Commit ff0e506e42714e5757bf7ec694286ad35fc6a729
1 file changed +9 -1
+9 -1
--- src/main.c
+++ src/main.c
@@ -1093,11 +1093,11 @@
10931093
**
10941094
** The argv==6 form is used by the win32 server only.
10951095
**
10961096
** COMMAND: http
10971097
**
1098
-** Usage: %fossil http REPOSITORY [--notfound URL]
1098
+** Usage: %fossil http REPOSITORY [--notfound URL] [--host HOSTNAME] [--https]
10991099
**
11001100
** Handle a single HTTP request appearing on stdin. The resulting webpage
11011101
** is delivered on stdout. This method is used to launch an HTTP request
11021102
** handler from inetd, for example. The argument is the name of the
11031103
** repository.
@@ -1105,15 +1105,23 @@
11051105
** If REPOSITORY is a directory that contains one or more respositories
11061106
** with names of the form "*.fossil" then the first element of the URL
11071107
** pathname selects among the various repositories. If the pathname does
11081108
** not select a valid repository and the --notfound option is available,
11091109
** then the server redirects (HTTP code 302) to the URL of --notfound.
1110
+**
1111
+** The --host option can be used to specify the hostname for the server.
1112
+** The --https option indicates that the request came from HTTPS rather
1113
+** than HTTP.
11101114
*/
11111115
void cmd_http(void){
11121116
const char *zIpAddr;
11131117
const char *zNotFound;
1118
+ const char *zHost;
11141119
zNotFound = find_option("notfound", 0, 1);
1120
+ if( find_option("https",0,0)!=0 ) cgi_replace_parameter("HTTPS","on");
1121
+ zHost = find_option("host", 0, 1);
1122
+ if( zHost ) cgi_replace_parameter("HTTP_HOST",zHost);
11151123
g.cgiOutput = 1;
11161124
if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){
11171125
fossil_fatal("no repository specified");
11181126
}
11191127
g.fullHttpReply = 1;
11201128
--- src/main.c
+++ src/main.c
@@ -1093,11 +1093,11 @@
1093 **
1094 ** The argv==6 form is used by the win32 server only.
1095 **
1096 ** COMMAND: http
1097 **
1098 ** Usage: %fossil http REPOSITORY [--notfound URL]
1099 **
1100 ** Handle a single HTTP request appearing on stdin. The resulting webpage
1101 ** is delivered on stdout. This method is used to launch an HTTP request
1102 ** handler from inetd, for example. The argument is the name of the
1103 ** repository.
@@ -1105,15 +1105,23 @@
1105 ** If REPOSITORY is a directory that contains one or more respositories
1106 ** with names of the form "*.fossil" then the first element of the URL
1107 ** pathname selects among the various repositories. If the pathname does
1108 ** not select a valid repository and the --notfound option is available,
1109 ** then the server redirects (HTTP code 302) to the URL of --notfound.
 
 
 
 
1110 */
1111 void cmd_http(void){
1112 const char *zIpAddr;
1113 const char *zNotFound;
 
1114 zNotFound = find_option("notfound", 0, 1);
 
 
 
1115 g.cgiOutput = 1;
1116 if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){
1117 fossil_fatal("no repository specified");
1118 }
1119 g.fullHttpReply = 1;
1120
--- src/main.c
+++ src/main.c
@@ -1093,11 +1093,11 @@
1093 **
1094 ** The argv==6 form is used by the win32 server only.
1095 **
1096 ** COMMAND: http
1097 **
1098 ** Usage: %fossil http REPOSITORY [--notfound URL] [--host HOSTNAME] [--https]
1099 **
1100 ** Handle a single HTTP request appearing on stdin. The resulting webpage
1101 ** is delivered on stdout. This method is used to launch an HTTP request
1102 ** handler from inetd, for example. The argument is the name of the
1103 ** repository.
@@ -1105,15 +1105,23 @@
1105 ** If REPOSITORY is a directory that contains one or more respositories
1106 ** with names of the form "*.fossil" then the first element of the URL
1107 ** pathname selects among the various repositories. If the pathname does
1108 ** not select a valid repository and the --notfound option is available,
1109 ** then the server redirects (HTTP code 302) to the URL of --notfound.
1110 **
1111 ** The --host option can be used to specify the hostname for the server.
1112 ** The --https option indicates that the request came from HTTPS rather
1113 ** than HTTP.
1114 */
1115 void cmd_http(void){
1116 const char *zIpAddr;
1117 const char *zNotFound;
1118 const char *zHost;
1119 zNotFound = find_option("notfound", 0, 1);
1120 if( find_option("https",0,0)!=0 ) cgi_replace_parameter("HTTPS","on");
1121 zHost = find_option("host", 0, 1);
1122 if( zHost ) cgi_replace_parameter("HTTP_HOST",zHost);
1123 g.cgiOutput = 1;
1124 if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){
1125 fossil_fatal("no repository specified");
1126 }
1127 g.fullHttpReply = 1;
1128

Keyboard Shortcuts

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