Fossil SCM

tls: move the checking for --https to before verify_options is called

rdb 2022-01-17 13:47 tls-server-fix
Commit 60d1581ff00fc2688dcedcbdce70caabb576b10560f6a08ae61d08b00e10c16d
1 file changed +3 -1
+3 -1
--- src/main.c
+++ src/main.c
@@ -3067,10 +3067,11 @@
30673067
const char *zFossilCmd =0; /* Name of "fossil" binary on remote system */
30683068
#if FOSSIL_ENABLE_SSL
30693069
const char *zCertFile =0; /* Internal - TLS/SSL cert filename of the --tls-cert-file option */
30703070
int zTls =0; /* Internal - 1 = use a TLS/SSL cert that has been previously loaded by ssl-config load-cert command or 0 if no TLS / SSL has been loaeded */
30713071
#endif
3072
+ const char *zHttps =0; /* Internal - set if if --https is present */
30723073
#if defined(_WIN32)
30733074
const char *zStopperFile; /* Name of file used to terminate server */
30743075
zStopperFile = find_option("stopper", 0, 1);
30753076
#endif
30763077
@@ -3148,10 +3149,11 @@
31483149
#if !defined(_WIN32)
31493150
/* Disable the timeout during debugging */
31503151
zTimeout = "100000000";
31513152
#endif
31523153
}
3154
+ zHttps = find_option("https",0,0);
31533155
/* We should be done with options.. */
31543156
verify_all_options();
31553157
31563158
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
31573159
if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
@@ -3197,11 +3199,11 @@
31973199
** The database has only just been found and made available
31983200
*/
31993201
#if FOSSIL_ENABLE_SSL
32003202
init_ssl_decoder(zCertFile, zTls);
32013203
#endif
3202
- if( find_option("https",0,0)!=0 || g.httpUseSSL ){
3204
+ if( zHttps !=0 || g.httpUseSSL ){
32033205
cgi_replace_parameter("HTTPS","on");
32043206
}
32053207
if( g.httpUseSSL && (flags & HTTP_SERVER_SCGI)!=0 ){
32063208
fossil_fatal("SCGI does not (yet) support TLS-encrypted connections");
32073209
}
32083210
--- src/main.c
+++ src/main.c
@@ -3067,10 +3067,11 @@
3067 const char *zFossilCmd =0; /* Name of "fossil" binary on remote system */
3068 #if FOSSIL_ENABLE_SSL
3069 const char *zCertFile =0; /* Internal - TLS/SSL cert filename of the --tls-cert-file option */
3070 int zTls =0; /* Internal - 1 = use a TLS/SSL cert that has been previously loaded by ssl-config load-cert command or 0 if no TLS / SSL has been loaeded */
3071 #endif
 
3072 #if defined(_WIN32)
3073 const char *zStopperFile; /* Name of file used to terminate server */
3074 zStopperFile = find_option("stopper", 0, 1);
3075 #endif
3076
@@ -3148,10 +3149,11 @@
3148 #if !defined(_WIN32)
3149 /* Disable the timeout during debugging */
3150 zTimeout = "100000000";
3151 #endif
3152 }
 
3153 /* We should be done with options.. */
3154 verify_all_options();
3155
3156 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
3157 if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
@@ -3197,11 +3199,11 @@
3197 ** The database has only just been found and made available
3198 */
3199 #if FOSSIL_ENABLE_SSL
3200 init_ssl_decoder(zCertFile, zTls);
3201 #endif
3202 if( find_option("https",0,0)!=0 || g.httpUseSSL ){
3203 cgi_replace_parameter("HTTPS","on");
3204 }
3205 if( g.httpUseSSL && (flags & HTTP_SERVER_SCGI)!=0 ){
3206 fossil_fatal("SCGI does not (yet) support TLS-encrypted connections");
3207 }
3208
--- src/main.c
+++ src/main.c
@@ -3067,10 +3067,11 @@
3067 const char *zFossilCmd =0; /* Name of "fossil" binary on remote system */
3068 #if FOSSIL_ENABLE_SSL
3069 const char *zCertFile =0; /* Internal - TLS/SSL cert filename of the --tls-cert-file option */
3070 int zTls =0; /* Internal - 1 = use a TLS/SSL cert that has been previously loaded by ssl-config load-cert command or 0 if no TLS / SSL has been loaeded */
3071 #endif
3072 const char *zHttps =0; /* Internal - set if if --https is present */
3073 #if defined(_WIN32)
3074 const char *zStopperFile; /* Name of file used to terminate server */
3075 zStopperFile = find_option("stopper", 0, 1);
3076 #endif
3077
@@ -3148,10 +3149,11 @@
3149 #if !defined(_WIN32)
3150 /* Disable the timeout during debugging */
3151 zTimeout = "100000000";
3152 #endif
3153 }
3154 zHttps = find_option("https",0,0);
3155 /* We should be done with options.. */
3156 verify_all_options();
3157
3158 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
3159 if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
@@ -3197,11 +3199,11 @@
3199 ** The database has only just been found and made available
3200 */
3201 #if FOSSIL_ENABLE_SSL
3202 init_ssl_decoder(zCertFile, zTls);
3203 #endif
3204 if( zHttps !=0 || g.httpUseSSL ){
3205 cgi_replace_parameter("HTTPS","on");
3206 }
3207 if( g.httpUseSSL && (flags & HTTP_SERVER_SCGI)!=0 ){
3208 fossil_fatal("SCGI does not (yet) support TLS-encrypted connections");
3209 }
3210

Keyboard Shortcuts

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