Fossil SCM
Minor changes to option handling for the `ui' command: (A) Abort early with an error message if the specified port number is invalid (instead of later with an assertion failure); (B) Add short form -p for --page; (C) Add short form -B for --nobrowser.
Commit
1431ebae3d3397488986b919a4776e3a2b4a1bf48230d90f941f4e44cb3b5eee
Parent
1a668d359a9615e…
1 file changed
+5
-4
+5
-4
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -3048,19 +3048,19 @@ | ||
| 3048 | 3048 | ** result in fewer HTTP requests than the separate mode. |
| 3049 | 3049 | ** --mainmenu FILE Override the mainmenu config setting with the contents |
| 3050 | 3050 | ** of the given file. |
| 3051 | 3051 | ** --max-latency N Do not let any single HTTP request run for more than N |
| 3052 | 3052 | ** seconds (only works on unix) |
| 3053 | -** --nobrowser Do not automatically launch a web-browser for the | |
| 3053 | +** -B|--nobrowser Do not automatically launch a web-browser for the | |
| 3054 | 3054 | ** "fossil ui" command. |
| 3055 | 3055 | ** --nocompress Do not compress HTTP replies |
| 3056 | 3056 | ** --nojail Drop root privileges but do not enter the chroot jail |
| 3057 | 3057 | ** --nossl do not force redirects to SSL even if the repository |
| 3058 | 3058 | ** setting "redirect-to-https" requests it. This is set |
| 3059 | 3059 | ** by default for the "ui" command. |
| 3060 | 3060 | ** --notfound URL Redirect to URL if a page is not found. |
| 3061 | -** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" | |
| 3061 | +** -p|--page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" | |
| 3062 | 3062 | ** --pkey FILE Read the private key used for TLS from FILE. |
| 3063 | 3063 | ** -P|--port TCPPORT listen to request on port TCPPORT |
| 3064 | 3064 | ** --repolist If REPOSITORY is dir, URL "/" lists repos. |
| 3065 | 3065 | ** --scgi Accept SCGI rather than HTTP |
| 3066 | 3066 | ** --skin LABEL Use override skin LABEL |
| @@ -3124,11 +3124,11 @@ | ||
| 3124 | 3124 | g.useLocalauth = find_option("localauth", 0, 0)!=0; |
| 3125 | 3125 | Th_InitTraceLog(); |
| 3126 | 3126 | zPort = find_option("port", "P", 1); |
| 3127 | 3127 | isUiCmd = g.argv[1][0]=='u'; |
| 3128 | 3128 | if( isUiCmd ){ |
| 3129 | - zInitPage = find_option("page", 0, 1); | |
| 3129 | + zInitPage = find_option("page", "p", 1); | |
| 3130 | 3130 | if( zInitPage && zInitPage[0]=='/' ) zInitPage++; |
| 3131 | 3131 | zFossilCmd = find_option("fossilcmd", 0, 1); |
| 3132 | 3132 | } |
| 3133 | 3133 | zNotFound = find_option("notfound", 0, 1); |
| 3134 | 3134 | allowRepoList = find_option("repolist",0,0)!=0; |
| @@ -3138,11 +3138,11 @@ | ||
| 3138 | 3138 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 3139 | 3139 | if( zAltBase ){ |
| 3140 | 3140 | set_base_url(zAltBase); |
| 3141 | 3141 | } |
| 3142 | 3142 | g.sslNotAvailable = find_option("nossl", 0, 0)!=0 || isUiCmd; |
| 3143 | - fNoBrowser = find_option("nobrowser", 0, 0)!=0; | |
| 3143 | + fNoBrowser = find_option("nobrowser", "B", 0)!=0; | |
| 3144 | 3144 | decode_ssl_options(); |
| 3145 | 3145 | if( find_option("https",0,0)!=0 || g.httpUseSSL ){ |
| 3146 | 3146 | cgi_replace_parameter("HTTPS","on"); |
| 3147 | 3147 | } |
| 3148 | 3148 | if( find_option("localhost", 0, 0)!=0 ){ |
| @@ -3230,10 +3230,11 @@ | ||
| 3230 | 3230 | } |
| 3231 | 3231 | zPort += i+1; |
| 3232 | 3232 | } |
| 3233 | 3233 | } |
| 3234 | 3234 | iPort = mxPort = atoi(zPort); |
| 3235 | + if( iPort<=0 ) fossil_fatal("port number must be greater than zero"); | |
| 3235 | 3236 | }else{ |
| 3236 | 3237 | iPort = db_get_int("http-port", 8080); |
| 3237 | 3238 | mxPort = iPort+100; |
| 3238 | 3239 | } |
| 3239 | 3240 | if( isUiCmd && !fNoBrowser ){ |
| 3240 | 3241 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3048,19 +3048,19 @@ | |
| 3048 | ** result in fewer HTTP requests than the separate mode. |
| 3049 | ** --mainmenu FILE Override the mainmenu config setting with the contents |
| 3050 | ** of the given file. |
| 3051 | ** --max-latency N Do not let any single HTTP request run for more than N |
| 3052 | ** seconds (only works on unix) |
| 3053 | ** --nobrowser Do not automatically launch a web-browser for the |
| 3054 | ** "fossil ui" command. |
| 3055 | ** --nocompress Do not compress HTTP replies |
| 3056 | ** --nojail Drop root privileges but do not enter the chroot jail |
| 3057 | ** --nossl do not force redirects to SSL even if the repository |
| 3058 | ** setting "redirect-to-https" requests it. This is set |
| 3059 | ** by default for the "ui" command. |
| 3060 | ** --notfound URL Redirect to URL if a page is not found. |
| 3061 | ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" |
| 3062 | ** --pkey FILE Read the private key used for TLS from FILE. |
| 3063 | ** -P|--port TCPPORT listen to request on port TCPPORT |
| 3064 | ** --repolist If REPOSITORY is dir, URL "/" lists repos. |
| 3065 | ** --scgi Accept SCGI rather than HTTP |
| 3066 | ** --skin LABEL Use override skin LABEL |
| @@ -3124,11 +3124,11 @@ | |
| 3124 | g.useLocalauth = find_option("localauth", 0, 0)!=0; |
| 3125 | Th_InitTraceLog(); |
| 3126 | zPort = find_option("port", "P", 1); |
| 3127 | isUiCmd = g.argv[1][0]=='u'; |
| 3128 | if( isUiCmd ){ |
| 3129 | zInitPage = find_option("page", 0, 1); |
| 3130 | if( zInitPage && zInitPage[0]=='/' ) zInitPage++; |
| 3131 | zFossilCmd = find_option("fossilcmd", 0, 1); |
| 3132 | } |
| 3133 | zNotFound = find_option("notfound", 0, 1); |
| 3134 | allowRepoList = find_option("repolist",0,0)!=0; |
| @@ -3138,11 +3138,11 @@ | |
| 3138 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 3139 | if( zAltBase ){ |
| 3140 | set_base_url(zAltBase); |
| 3141 | } |
| 3142 | g.sslNotAvailable = find_option("nossl", 0, 0)!=0 || isUiCmd; |
| 3143 | fNoBrowser = find_option("nobrowser", 0, 0)!=0; |
| 3144 | decode_ssl_options(); |
| 3145 | if( find_option("https",0,0)!=0 || g.httpUseSSL ){ |
| 3146 | cgi_replace_parameter("HTTPS","on"); |
| 3147 | } |
| 3148 | if( find_option("localhost", 0, 0)!=0 ){ |
| @@ -3230,10 +3230,11 @@ | |
| 3230 | } |
| 3231 | zPort += i+1; |
| 3232 | } |
| 3233 | } |
| 3234 | iPort = mxPort = atoi(zPort); |
| 3235 | }else{ |
| 3236 | iPort = db_get_int("http-port", 8080); |
| 3237 | mxPort = iPort+100; |
| 3238 | } |
| 3239 | if( isUiCmd && !fNoBrowser ){ |
| 3240 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3048,19 +3048,19 @@ | |
| 3048 | ** result in fewer HTTP requests than the separate mode. |
| 3049 | ** --mainmenu FILE Override the mainmenu config setting with the contents |
| 3050 | ** of the given file. |
| 3051 | ** --max-latency N Do not let any single HTTP request run for more than N |
| 3052 | ** seconds (only works on unix) |
| 3053 | ** -B|--nobrowser Do not automatically launch a web-browser for the |
| 3054 | ** "fossil ui" command. |
| 3055 | ** --nocompress Do not compress HTTP replies |
| 3056 | ** --nojail Drop root privileges but do not enter the chroot jail |
| 3057 | ** --nossl do not force redirects to SSL even if the repository |
| 3058 | ** setting "redirect-to-https" requests it. This is set |
| 3059 | ** by default for the "ui" command. |
| 3060 | ** --notfound URL Redirect to URL if a page is not found. |
| 3061 | ** -p|--page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" |
| 3062 | ** --pkey FILE Read the private key used for TLS from FILE. |
| 3063 | ** -P|--port TCPPORT listen to request on port TCPPORT |
| 3064 | ** --repolist If REPOSITORY is dir, URL "/" lists repos. |
| 3065 | ** --scgi Accept SCGI rather than HTTP |
| 3066 | ** --skin LABEL Use override skin LABEL |
| @@ -3124,11 +3124,11 @@ | |
| 3124 | g.useLocalauth = find_option("localauth", 0, 0)!=0; |
| 3125 | Th_InitTraceLog(); |
| 3126 | zPort = find_option("port", "P", 1); |
| 3127 | isUiCmd = g.argv[1][0]=='u'; |
| 3128 | if( isUiCmd ){ |
| 3129 | zInitPage = find_option("page", "p", 1); |
| 3130 | if( zInitPage && zInitPage[0]=='/' ) zInitPage++; |
| 3131 | zFossilCmd = find_option("fossilcmd", 0, 1); |
| 3132 | } |
| 3133 | zNotFound = find_option("notfound", 0, 1); |
| 3134 | allowRepoList = find_option("repolist",0,0)!=0; |
| @@ -3138,11 +3138,11 @@ | |
| 3138 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 3139 | if( zAltBase ){ |
| 3140 | set_base_url(zAltBase); |
| 3141 | } |
| 3142 | g.sslNotAvailable = find_option("nossl", 0, 0)!=0 || isUiCmd; |
| 3143 | fNoBrowser = find_option("nobrowser", "B", 0)!=0; |
| 3144 | decode_ssl_options(); |
| 3145 | if( find_option("https",0,0)!=0 || g.httpUseSSL ){ |
| 3146 | cgi_replace_parameter("HTTPS","on"); |
| 3147 | } |
| 3148 | if( find_option("localhost", 0, 0)!=0 ){ |
| @@ -3230,10 +3230,11 @@ | |
| 3230 | } |
| 3231 | zPort += i+1; |
| 3232 | } |
| 3233 | } |
| 3234 | iPort = mxPort = atoi(zPort); |
| 3235 | if( iPort<=0 ) fossil_fatal("port number must be greater than zero"); |
| 3236 | }else{ |
| 3237 | iPort = db_get_int("http-port", 8080); |
| 3238 | mxPort = iPort+100; |
| 3239 | } |
| 3240 | if( isUiCmd && !fNoBrowser ){ |
| 3241 |