Fossil SCM
Fix the build on Windows and on builds that omit OpenSSL. Improved error messages.
Commit
637516c447d6e01f3aae84adfc219f6fbf3b148de381c842edd268016af505f1
Parent
977fa519d365f77…
2 files changed
+2
-1
+17
-1
+2
-1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -2350,11 +2350,12 @@ | ||
| 2350 | 2350 | } |
| 2351 | 2351 | } |
| 2352 | 2352 | if( iPort>mxPort ) return 1; |
| 2353 | 2353 | listen(listener,10); |
| 2354 | 2354 | fossil_print("Listening for %s requests on TCP port %d\n", |
| 2355 | - (flags & HTTP_SERVER_SCGI)!=0?"SCGI":"HTTP", iPort); | |
| 2355 | + (flags & HTTP_SERVER_SCGI)!=0 ? "SCGI" : | |
| 2356 | + g.httpUseSSL?"TLS-encrypted HTTPS":"HTTP", iPort); | |
| 2356 | 2357 | fflush(stdout); |
| 2357 | 2358 | if( zBrowser ){ |
| 2358 | 2359 | assert( strstr(zBrowser,"%d")!=0 ); |
| 2359 | 2360 | zBrowser = mprintf(zBrowser /*works-like:"%d"*/, iPort); |
| 2360 | 2361 | #if defined(__CYGWIN__) |
| 2361 | 2362 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -2350,11 +2350,12 @@ | |
| 2350 | } |
| 2351 | } |
| 2352 | if( iPort>mxPort ) return 1; |
| 2353 | listen(listener,10); |
| 2354 | fossil_print("Listening for %s requests on TCP port %d\n", |
| 2355 | (flags & HTTP_SERVER_SCGI)!=0?"SCGI":"HTTP", iPort); |
| 2356 | fflush(stdout); |
| 2357 | if( zBrowser ){ |
| 2358 | assert( strstr(zBrowser,"%d")!=0 ); |
| 2359 | zBrowser = mprintf(zBrowser /*works-like:"%d"*/, iPort); |
| 2360 | #if defined(__CYGWIN__) |
| 2361 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -2350,11 +2350,12 @@ | |
| 2350 | } |
| 2351 | } |
| 2352 | if( iPort>mxPort ) return 1; |
| 2353 | listen(listener,10); |
| 2354 | fossil_print("Listening for %s requests on TCP port %d\n", |
| 2355 | (flags & HTTP_SERVER_SCGI)!=0 ? "SCGI" : |
| 2356 | g.httpUseSSL?"TLS-encrypted HTTPS":"HTTP", iPort); |
| 2357 | fflush(stdout); |
| 2358 | if( zBrowser ){ |
| 2359 | assert( strstr(zBrowser,"%d")!=0 ); |
| 2360 | zBrowser = mprintf(zBrowser /*works-like:"%d"*/, iPort); |
| 2361 | #if defined(__CYGWIN__) |
| 2362 |
+17
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2841,16 +2841,18 @@ | ||
| 2841 | 2841 | /* |
| 2842 | 2842 | ** Check for options to "fossil server" or "fossil ui" that imply that |
| 2843 | 2843 | ** SSL should be used, and initialize the SSL decoder. |
| 2844 | 2844 | */ |
| 2845 | 2845 | static void decode_ssl_options(void){ |
| 2846 | +#if FOSSIL_ENABLE_SSL | |
| 2846 | 2847 | const char *zCertFile = 0; |
| 2847 | 2848 | zCertFile = find_option("tls-cert-file",0,1); |
| 2848 | 2849 | if( zCertFile ){ |
| 2849 | 2850 | g.httpUseSSL = 1; |
| 2850 | 2851 | ssl_init_server(zCertFile, zCertFile); |
| 2851 | 2852 | } |
| 2853 | +#endif | |
| 2852 | 2854 | } |
| 2853 | 2855 | |
| 2854 | 2856 | /* |
| 2855 | 2857 | ** COMMAND: server* |
| 2856 | 2858 | ** COMMAND: ui |
| @@ -3044,16 +3046,22 @@ | ||
| 3044 | 3046 | ** very first incoming TCP/IP connection to be processed. Used for |
| 3045 | 3047 | ** debugging, since debugging across a fork() can be tricky |
| 3046 | 3048 | */ |
| 3047 | 3049 | if( find_option("debug-nofork",0,0)!=0 ){ |
| 3048 | 3050 | flags |= HTTP_SERVER_NOFORK; |
| 3051 | +#if !defined(_WIN32) | |
| 3052 | + /* Disable the timeout during debugging */ | |
| 3049 | 3053 | zTimeout = "100000000"; |
| 3054 | +#endif | |
| 3050 | 3055 | } |
| 3051 | 3056 | /* We should be done with options.. */ |
| 3052 | 3057 | verify_all_options(); |
| 3053 | 3058 | |
| 3054 | 3059 | if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?"); |
| 3060 | + if( g.httpUseSSL && (flags & HTTP_SERVER_SCGI)!=0 ){ | |
| 3061 | + fossil_fatal("SCGI does not (yet) support TLS-encrypted connections"); | |
| 3062 | + } | |
| 3055 | 3063 | if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){ |
| 3056 | 3064 | /* If REPOSITORY arg is the root of a checkout, |
| 3057 | 3065 | ** chdir to that checkout so that the current version |
| 3058 | 3066 | ** gets highlighted in the timeline by default. */ |
| 3059 | 3067 | const char * zDir = g.argv[2]; |
| @@ -3215,26 +3223,34 @@ | ||
| 3215 | 3223 | } |
| 3216 | 3224 | } |
| 3217 | 3225 | if( flags & HTTP_SERVER_SCGI ){ |
| 3218 | 3226 | cgi_handle_scgi_request(); |
| 3219 | 3227 | }else if( g.httpUseSSL ){ |
| 3228 | +#if FOSSIL_ENABLE_SSL | |
| 3220 | 3229 | g.httpSSLConn = ssl_new_server(0,-1); |
| 3230 | +#endif | |
| 3221 | 3231 | cgi_handle_http_request(0); |
| 3222 | 3232 | }else{ |
| 3223 | 3233 | cgi_handle_http_request(0); |
| 3224 | 3234 | } |
| 3225 | 3235 | process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList); |
| 3226 | 3236 | if( g.fAnyTrace ){ |
| 3227 | 3237 | fprintf(stderr, "/***** Webpage finished in subprocess %d *****/\n", |
| 3228 | 3238 | getpid()); |
| 3229 | 3239 | } |
| 3240 | +#if FOSSIL_ENABLE_SSL | |
| 3230 | 3241 | if( g.httpUseSSL && g.httpSSLConn ){ |
| 3231 | 3242 | ssl_close_server(g.httpSSLConn); |
| 3232 | 3243 | g.httpSSLConn = 0; |
| 3233 | 3244 | } |
| 3234 | -#else | |
| 3245 | +#endif /* FOSSIL_ENABLE_SSL */ | |
| 3246 | + | |
| 3247 | +#else /* WIN32 */ | |
| 3235 | 3248 | /* Win32 implementation */ |
| 3249 | + if( g.httpUseSSL ){ | |
| 3250 | + fossil_fatal("TLS-encrypted server is not (yet) supported on Windows"); | |
| 3251 | + } | |
| 3236 | 3252 | if( allowRepoList ){ |
| 3237 | 3253 | flags |= HTTP_SERVER_REPOLIST; |
| 3238 | 3254 | } |
| 3239 | 3255 | if( win32_http_service(iPort, zAltBase, zNotFound, zFileGlob, flags) ){ |
| 3240 | 3256 | win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, |
| 3241 | 3257 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2841,16 +2841,18 @@ | |
| 2841 | /* |
| 2842 | ** Check for options to "fossil server" or "fossil ui" that imply that |
| 2843 | ** SSL should be used, and initialize the SSL decoder. |
| 2844 | */ |
| 2845 | static void decode_ssl_options(void){ |
| 2846 | const char *zCertFile = 0; |
| 2847 | zCertFile = find_option("tls-cert-file",0,1); |
| 2848 | if( zCertFile ){ |
| 2849 | g.httpUseSSL = 1; |
| 2850 | ssl_init_server(zCertFile, zCertFile); |
| 2851 | } |
| 2852 | } |
| 2853 | |
| 2854 | /* |
| 2855 | ** COMMAND: server* |
| 2856 | ** COMMAND: ui |
| @@ -3044,16 +3046,22 @@ | |
| 3044 | ** very first incoming TCP/IP connection to be processed. Used for |
| 3045 | ** debugging, since debugging across a fork() can be tricky |
| 3046 | */ |
| 3047 | if( find_option("debug-nofork",0,0)!=0 ){ |
| 3048 | flags |= HTTP_SERVER_NOFORK; |
| 3049 | zTimeout = "100000000"; |
| 3050 | } |
| 3051 | /* We should be done with options.. */ |
| 3052 | verify_all_options(); |
| 3053 | |
| 3054 | if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?"); |
| 3055 | if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){ |
| 3056 | /* If REPOSITORY arg is the root of a checkout, |
| 3057 | ** chdir to that checkout so that the current version |
| 3058 | ** gets highlighted in the timeline by default. */ |
| 3059 | const char * zDir = g.argv[2]; |
| @@ -3215,26 +3223,34 @@ | |
| 3215 | } |
| 3216 | } |
| 3217 | if( flags & HTTP_SERVER_SCGI ){ |
| 3218 | cgi_handle_scgi_request(); |
| 3219 | }else if( g.httpUseSSL ){ |
| 3220 | g.httpSSLConn = ssl_new_server(0,-1); |
| 3221 | cgi_handle_http_request(0); |
| 3222 | }else{ |
| 3223 | cgi_handle_http_request(0); |
| 3224 | } |
| 3225 | process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList); |
| 3226 | if( g.fAnyTrace ){ |
| 3227 | fprintf(stderr, "/***** Webpage finished in subprocess %d *****/\n", |
| 3228 | getpid()); |
| 3229 | } |
| 3230 | if( g.httpUseSSL && g.httpSSLConn ){ |
| 3231 | ssl_close_server(g.httpSSLConn); |
| 3232 | g.httpSSLConn = 0; |
| 3233 | } |
| 3234 | #else |
| 3235 | /* Win32 implementation */ |
| 3236 | if( allowRepoList ){ |
| 3237 | flags |= HTTP_SERVER_REPOLIST; |
| 3238 | } |
| 3239 | if( win32_http_service(iPort, zAltBase, zNotFound, zFileGlob, flags) ){ |
| 3240 | win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, |
| 3241 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2841,16 +2841,18 @@ | |
| 2841 | /* |
| 2842 | ** Check for options to "fossil server" or "fossil ui" that imply that |
| 2843 | ** SSL should be used, and initialize the SSL decoder. |
| 2844 | */ |
| 2845 | static void decode_ssl_options(void){ |
| 2846 | #if FOSSIL_ENABLE_SSL |
| 2847 | const char *zCertFile = 0; |
| 2848 | zCertFile = find_option("tls-cert-file",0,1); |
| 2849 | if( zCertFile ){ |
| 2850 | g.httpUseSSL = 1; |
| 2851 | ssl_init_server(zCertFile, zCertFile); |
| 2852 | } |
| 2853 | #endif |
| 2854 | } |
| 2855 | |
| 2856 | /* |
| 2857 | ** COMMAND: server* |
| 2858 | ** COMMAND: ui |
| @@ -3044,16 +3046,22 @@ | |
| 3046 | ** very first incoming TCP/IP connection to be processed. Used for |
| 3047 | ** debugging, since debugging across a fork() can be tricky |
| 3048 | */ |
| 3049 | if( find_option("debug-nofork",0,0)!=0 ){ |
| 3050 | flags |= HTTP_SERVER_NOFORK; |
| 3051 | #if !defined(_WIN32) |
| 3052 | /* Disable the timeout during debugging */ |
| 3053 | zTimeout = "100000000"; |
| 3054 | #endif |
| 3055 | } |
| 3056 | /* We should be done with options.. */ |
| 3057 | verify_all_options(); |
| 3058 | |
| 3059 | if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?"); |
| 3060 | if( g.httpUseSSL && (flags & HTTP_SERVER_SCGI)!=0 ){ |
| 3061 | fossil_fatal("SCGI does not (yet) support TLS-encrypted connections"); |
| 3062 | } |
| 3063 | if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){ |
| 3064 | /* If REPOSITORY arg is the root of a checkout, |
| 3065 | ** chdir to that checkout so that the current version |
| 3066 | ** gets highlighted in the timeline by default. */ |
| 3067 | const char * zDir = g.argv[2]; |
| @@ -3215,26 +3223,34 @@ | |
| 3223 | } |
| 3224 | } |
| 3225 | if( flags & HTTP_SERVER_SCGI ){ |
| 3226 | cgi_handle_scgi_request(); |
| 3227 | }else if( g.httpUseSSL ){ |
| 3228 | #if FOSSIL_ENABLE_SSL |
| 3229 | g.httpSSLConn = ssl_new_server(0,-1); |
| 3230 | #endif |
| 3231 | cgi_handle_http_request(0); |
| 3232 | }else{ |
| 3233 | cgi_handle_http_request(0); |
| 3234 | } |
| 3235 | process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList); |
| 3236 | if( g.fAnyTrace ){ |
| 3237 | fprintf(stderr, "/***** Webpage finished in subprocess %d *****/\n", |
| 3238 | getpid()); |
| 3239 | } |
| 3240 | #if FOSSIL_ENABLE_SSL |
| 3241 | if( g.httpUseSSL && g.httpSSLConn ){ |
| 3242 | ssl_close_server(g.httpSSLConn); |
| 3243 | g.httpSSLConn = 0; |
| 3244 | } |
| 3245 | #endif /* FOSSIL_ENABLE_SSL */ |
| 3246 | |
| 3247 | #else /* WIN32 */ |
| 3248 | /* Win32 implementation */ |
| 3249 | if( g.httpUseSSL ){ |
| 3250 | fossil_fatal("TLS-encrypted server is not (yet) supported on Windows"); |
| 3251 | } |
| 3252 | if( allowRepoList ){ |
| 3253 | flags |= HTTP_SERVER_REPOLIST; |
| 3254 | } |
| 3255 | if( win32_http_service(iPort, zAltBase, zNotFound, zFileGlob, flags) ){ |
| 3256 | win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, |
| 3257 |