2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
|
}
/*
** Check for options to "fossil server" or "fossil ui" that imply that
** SSL should be used, and initialize the SSL decoder.
*/
static void decode_ssl_options(void){
const char *zCertFile = 0;
zCertFile = find_option("tls-cert-file",0,1);
if( zCertFile ){
g.httpUseSSL = 1;
ssl_init_server(zCertFile, zCertFile);
}
}
/*
** COMMAND: server*
** COMMAND: ui
**
** Usage: %fossil server ?OPTIONS? ?REPOSITORY?
|
>
>
|
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
|
}
/*
** Check for options to "fossil server" or "fossil ui" that imply that
** SSL should be used, and initialize the SSL decoder.
*/
static void decode_ssl_options(void){
#if FOSSIL_ENABLE_SSL
const char *zCertFile = 0;
zCertFile = find_option("tls-cert-file",0,1);
if( zCertFile ){
g.httpUseSSL = 1;
ssl_init_server(zCertFile, zCertFile);
}
#endif
}
/*
** COMMAND: server*
** COMMAND: ui
**
** Usage: %fossil server ?OPTIONS? ?REPOSITORY?
|
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
|
**
** This sets the HTTP_SERVER_NOFORK flag, which causes only the
** very first incoming TCP/IP connection to be processed. Used for
** debugging, since debugging across a fork() can be tricky
*/
if( find_option("debug-nofork",0,0)!=0 ){
flags |= HTTP_SERVER_NOFORK;
zTimeout = "100000000";
}
/* We should be done with options.. */
verify_all_options();
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
/* If REPOSITORY arg is the root of a checkout,
** chdir to that checkout so that the current version
** gets highlighted in the timeline by default. */
const char * zDir = g.argv[2];
if(dir_has_ckout_db(zDir)){
if(0!=file_chdir(zDir, 0)){
|
>
>
>
>
>
>
|
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
|
**
** This sets the HTTP_SERVER_NOFORK flag, which causes only the
** very first incoming TCP/IP connection to be processed. Used for
** debugging, since debugging across a fork() can be tricky
*/
if( find_option("debug-nofork",0,0)!=0 ){
flags |= HTTP_SERVER_NOFORK;
#if !defined(_WIN32)
/* Disable the timeout during debugging */
zTimeout = "100000000";
#endif
}
/* We should be done with options.. */
verify_all_options();
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
if( g.httpUseSSL && (flags & HTTP_SERVER_SCGI)!=0 ){
fossil_fatal("SCGI does not (yet) support TLS-encrypted connections");
}
if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
/* If REPOSITORY arg is the root of a checkout,
** chdir to that checkout so that the current version
** gets highlighted in the timeline by default. */
const char * zDir = g.argv[2];
if(dir_has_ckout_db(zDir)){
if(0!=file_chdir(zDir, 0)){
|
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
|
}else{
g.zRepositoryName = enter_chroot_jail(g.zRepositoryName, noJail);
}
}
if( flags & HTTP_SERVER_SCGI ){
cgi_handle_scgi_request();
}else if( g.httpUseSSL ){
g.httpSSLConn = ssl_new_server(0,-1);
cgi_handle_http_request(0);
}else{
cgi_handle_http_request(0);
}
process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList);
if( g.fAnyTrace ){
fprintf(stderr, "/***** Webpage finished in subprocess %d *****/\n",
getpid());
}
if( g.httpUseSSL && g.httpSSLConn ){
ssl_close_server(g.httpSSLConn);
g.httpSSLConn = 0;
}
#else
/* Win32 implementation */
if( allowRepoList ){
flags |= HTTP_SERVER_REPOLIST;
}
if( win32_http_service(iPort, zAltBase, zNotFound, zFileGlob, flags) ){
win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile,
zAltBase, zNotFound, zFileGlob, zIpAddr, flags);
}
|
>
>
>
>
>
|
>
>
>
|
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
|
}else{
g.zRepositoryName = enter_chroot_jail(g.zRepositoryName, noJail);
}
}
if( flags & HTTP_SERVER_SCGI ){
cgi_handle_scgi_request();
}else if( g.httpUseSSL ){
#if FOSSIL_ENABLE_SSL
g.httpSSLConn = ssl_new_server(0,-1);
#endif
cgi_handle_http_request(0);
}else{
cgi_handle_http_request(0);
}
process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList);
if( g.fAnyTrace ){
fprintf(stderr, "/***** Webpage finished in subprocess %d *****/\n",
getpid());
}
#if FOSSIL_ENABLE_SSL
if( g.httpUseSSL && g.httpSSLConn ){
ssl_close_server(g.httpSSLConn);
g.httpSSLConn = 0;
}
#endif /* FOSSIL_ENABLE_SSL */
#else /* WIN32 */
/* Win32 implementation */
if( g.httpUseSSL ){
fossil_fatal("TLS-encrypted server is not (yet) supported on Windows");
}
if( allowRepoList ){
flags |= HTTP_SERVER_REPOLIST;
}
if( win32_http_service(iPort, zAltBase, zNotFound, zFileGlob, flags) ){
win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile,
zAltBase, zNotFound, zFileGlob, zIpAddr, flags);
}
|