Fossil SCM
Add --host and --https options to the http command.
Commit
ff0e506e42714e5757bf7ec694286ad35fc6a729
Parent
a435ae67a97b536…
1 file changed
+9
-1
+9
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1093,11 +1093,11 @@ | ||
| 1093 | 1093 | ** |
| 1094 | 1094 | ** The argv==6 form is used by the win32 server only. |
| 1095 | 1095 | ** |
| 1096 | 1096 | ** COMMAND: http |
| 1097 | 1097 | ** |
| 1098 | -** Usage: %fossil http REPOSITORY [--notfound URL] | |
| 1098 | +** Usage: %fossil http REPOSITORY [--notfound URL] [--host HOSTNAME] [--https] | |
| 1099 | 1099 | ** |
| 1100 | 1100 | ** Handle a single HTTP request appearing on stdin. The resulting webpage |
| 1101 | 1101 | ** is delivered on stdout. This method is used to launch an HTTP request |
| 1102 | 1102 | ** handler from inetd, for example. The argument is the name of the |
| 1103 | 1103 | ** repository. |
| @@ -1105,15 +1105,23 @@ | ||
| 1105 | 1105 | ** If REPOSITORY is a directory that contains one or more respositories |
| 1106 | 1106 | ** with names of the form "*.fossil" then the first element of the URL |
| 1107 | 1107 | ** pathname selects among the various repositories. If the pathname does |
| 1108 | 1108 | ** not select a valid repository and the --notfound option is available, |
| 1109 | 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. | |
| 1110 | 1114 | */ |
| 1111 | 1115 | void cmd_http(void){ |
| 1112 | 1116 | const char *zIpAddr; |
| 1113 | 1117 | const char *zNotFound; |
| 1118 | + const char *zHost; | |
| 1114 | 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); | |
| 1115 | 1123 | g.cgiOutput = 1; |
| 1116 | 1124 | if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){ |
| 1117 | 1125 | fossil_fatal("no repository specified"); |
| 1118 | 1126 | } |
| 1119 | 1127 | g.fullHttpReply = 1; |
| 1120 | 1128 |
| --- 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 |