Fossil SCM
Handle --once preference and prevent sending HTTP Authorization when the URL is named on the command line.
Commit
2600f59f2d1e983439e55a38717c2de12245a710
Parent
906cfae4442bec5…
4 files changed
+14
-8
+4
-8
+1
+2
-3
+14
-8
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -116,18 +116,17 @@ | ||
| 116 | 116 | ** See also: init |
| 117 | 117 | */ |
| 118 | 118 | void clone_cmd(void){ |
| 119 | 119 | char *zPassword; |
| 120 | 120 | const char *zDefaultUser; /* Optional name of the default user */ |
| 121 | - int fUseHttpAuth; /* Use HTTP auth if requested by user */ | |
| 122 | 121 | int nErr = 0; |
| 123 | 122 | int bPrivate = 0; /* Also clone private branches */ |
| 124 | 123 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 125 | 124 | |
| 126 | 125 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 127 | 126 | if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; |
| 128 | - fUseHttpAuth = find_option("httpauth","B",0)!=0; | |
| 127 | + g.fUseHttpAuth = find_option("httpauth","B",0)!=0; | |
| 129 | 128 | zDefaultUser = find_option("admin-user","A",1); |
| 130 | 129 | clone_ssh_find_options(); |
| 131 | 130 | url_proxy_options(); |
| 132 | 131 | if( g.argc < 4 ){ |
| 133 | 132 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| @@ -162,11 +161,11 @@ | ||
| 162 | 161 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 163 | 162 | user_select(); |
| 164 | 163 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 165 | 164 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 166 | 165 | db_set("rebuilt", get_version(), 0); |
| 167 | - remember_http_auth(fUseHttpAuth,g.argv[2]); | |
| 166 | + remember_or_get_http_auth(urlFlags & URL_REMEMBER, g.argv[2]); | |
| 168 | 167 | url_remember(); |
| 169 | 168 | if( g.zSSLIdentity!=0 ){ |
| 170 | 169 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 171 | 170 | Blob fn; |
| 172 | 171 | blob_zero(&fn); |
| @@ -204,16 +203,23 @@ | ||
| 204 | 203 | |
| 205 | 204 | /* |
| 206 | 205 | ** If user chooses to use HTTP Authentication over unencrypted HTTP, |
| 207 | 206 | ** remember decision. Otherwise, if the URL is being changed and no preference |
| 208 | 207 | ** has been indicated, err on the safe side and revert the decision. |
| 208 | +** Set the global preference if the URL is not being changed. | |
| 209 | 209 | */ |
| 210 | -void remember_http_auth(int fUseHttpAuth, const char *zUrl){ | |
| 211 | - if( fUseHttpAuth==1 ){ | |
| 212 | - db_set_int("use-http-auth", 1, 0); | |
| 213 | - }else if( zUrl && zUrl[0] ){ | |
| 214 | - db_unset("use-http-auth", 0); | |
| 210 | +void remember_or_get_http_auth(int fRemember, const char *zUrl){ | |
| 211 | + if( fRemember ){ | |
| 212 | + if( g.fUseHttpAuth==1 ){ | |
| 213 | + db_set_int("use-http-auth", 1, 0); | |
| 214 | + }else if( zUrl && zUrl[0] ){ | |
| 215 | + db_unset("use-http-auth", 0); | |
| 216 | + }else{ | |
| 217 | + g.fUseHttpAuth = db_get_boolean("use-http-auth",0)!=0; | |
| 218 | + } | |
| 219 | + }else if( g.fUseHttpAuth==0 && zUrl==0 ){ | |
| 220 | + g.fUseHttpAuth = db_get_boolean("use-http-auth",0)!=0; | |
| 215 | 221 | } |
| 216 | 222 | } |
| 217 | 223 | |
| 218 | 224 | /* |
| 219 | 225 | ** Look for SSH clone command line options and setup in globals. |
| 220 | 226 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -116,18 +116,17 @@ | |
| 116 | ** See also: init |
| 117 | */ |
| 118 | void clone_cmd(void){ |
| 119 | char *zPassword; |
| 120 | const char *zDefaultUser; /* Optional name of the default user */ |
| 121 | int fUseHttpAuth; /* Use HTTP auth if requested by user */ |
| 122 | int nErr = 0; |
| 123 | int bPrivate = 0; /* Also clone private branches */ |
| 124 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 125 | |
| 126 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 127 | if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; |
| 128 | fUseHttpAuth = find_option("httpauth","B",0)!=0; |
| 129 | zDefaultUser = find_option("admin-user","A",1); |
| 130 | clone_ssh_find_options(); |
| 131 | url_proxy_options(); |
| 132 | if( g.argc < 4 ){ |
| 133 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| @@ -162,11 +161,11 @@ | |
| 162 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 163 | user_select(); |
| 164 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 165 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 166 | db_set("rebuilt", get_version(), 0); |
| 167 | remember_http_auth(fUseHttpAuth,g.argv[2]); |
| 168 | url_remember(); |
| 169 | if( g.zSSLIdentity!=0 ){ |
| 170 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 171 | Blob fn; |
| 172 | blob_zero(&fn); |
| @@ -204,16 +203,23 @@ | |
| 204 | |
| 205 | /* |
| 206 | ** If user chooses to use HTTP Authentication over unencrypted HTTP, |
| 207 | ** remember decision. Otherwise, if the URL is being changed and no preference |
| 208 | ** has been indicated, err on the safe side and revert the decision. |
| 209 | */ |
| 210 | void remember_http_auth(int fUseHttpAuth, const char *zUrl){ |
| 211 | if( fUseHttpAuth==1 ){ |
| 212 | db_set_int("use-http-auth", 1, 0); |
| 213 | }else if( zUrl && zUrl[0] ){ |
| 214 | db_unset("use-http-auth", 0); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | /* |
| 219 | ** Look for SSH clone command line options and setup in globals. |
| 220 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -116,18 +116,17 @@ | |
| 116 | ** See also: init |
| 117 | */ |
| 118 | void clone_cmd(void){ |
| 119 | char *zPassword; |
| 120 | const char *zDefaultUser; /* Optional name of the default user */ |
| 121 | int nErr = 0; |
| 122 | int bPrivate = 0; /* Also clone private branches */ |
| 123 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 124 | |
| 125 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 126 | if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; |
| 127 | g.fUseHttpAuth = find_option("httpauth","B",0)!=0; |
| 128 | zDefaultUser = find_option("admin-user","A",1); |
| 129 | clone_ssh_find_options(); |
| 130 | url_proxy_options(); |
| 131 | if( g.argc < 4 ){ |
| 132 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| @@ -162,11 +161,11 @@ | |
| 161 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 162 | user_select(); |
| 163 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 164 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 165 | db_set("rebuilt", get_version(), 0); |
| 166 | remember_or_get_http_auth(urlFlags & URL_REMEMBER, g.argv[2]); |
| 167 | url_remember(); |
| 168 | if( g.zSSLIdentity!=0 ){ |
| 169 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 170 | Blob fn; |
| 171 | blob_zero(&fn); |
| @@ -204,16 +203,23 @@ | |
| 203 | |
| 204 | /* |
| 205 | ** If user chooses to use HTTP Authentication over unencrypted HTTP, |
| 206 | ** remember decision. Otherwise, if the URL is being changed and no preference |
| 207 | ** has been indicated, err on the safe side and revert the decision. |
| 208 | ** Set the global preference if the URL is not being changed. |
| 209 | */ |
| 210 | void remember_or_get_http_auth(int fRemember, const char *zUrl){ |
| 211 | if( fRemember ){ |
| 212 | if( g.fUseHttpAuth==1 ){ |
| 213 | db_set_int("use-http-auth", 1, 0); |
| 214 | }else if( zUrl && zUrl[0] ){ |
| 215 | db_unset("use-http-auth", 0); |
| 216 | }else{ |
| 217 | g.fUseHttpAuth = db_get_boolean("use-http-auth",0)!=0; |
| 218 | } |
| 219 | }else if( g.fUseHttpAuth==0 && zUrl==0 ){ |
| 220 | g.fUseHttpAuth = db_get_boolean("use-http-auth",0)!=0; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | /* |
| 225 | ** Look for SSH clone command line options and setup in globals. |
| 226 |
+4
-8
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -76,15 +76,10 @@ | ||
| 76 | 76 | blob_reset(&pw); |
| 77 | 77 | blob_reset(&sig); |
| 78 | 78 | blob_reset(&nonce); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | -/* | |
| 82 | -** Use HTTP Basic Authorization if a 401 is seen. | |
| 83 | -*/ | |
| 84 | -static int fUseHttpAuth = 0; | |
| 85 | - | |
| 86 | 81 | /* |
| 87 | 82 | ** Construct an appropriate HTTP request header. Write the header |
| 88 | 83 | ** into pHdr. This routine initializes the pHdr blob. pPayload is |
| 89 | 84 | ** the complete payload (including the login card) already compressed. |
| 90 | 85 | */ |
| @@ -101,11 +96,11 @@ | ||
| 101 | 96 | } |
| 102 | 97 | blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep); |
| 103 | 98 | if( g.urlProxyAuth ){ |
| 104 | 99 | blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth); |
| 105 | 100 | } |
| 106 | - if( g.urlPasswd && g.urlUser && fUseHttpAuth ){ | |
| 101 | + if( g.urlPasswd && g.urlUser && g.fUseHttpAuth ){ | |
| 107 | 102 | char *zCredentials = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 108 | 103 | char *zEncoded = encode64(zCredentials, -1); |
| 109 | 104 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 110 | 105 | fossil_free(zEncoded); |
| 111 | 106 | fossil_free(zCredentials); |
| @@ -205,12 +200,13 @@ | ||
| 205 | 200 | while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){ |
| 206 | 201 | /* printf("[%s]\n", zLine); fflush(stdout); */ |
| 207 | 202 | if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){ |
| 208 | 203 | if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err; |
| 209 | 204 | if( rc==401 ){ |
| 210 | - if( g.urlIsHttps || db_get_boolean("use-http-auth",0)!=0 ){ | |
| 211 | - fUseHttpAuth = 1; | |
| 205 | + if( g.urlIsHttps || g.fUseHttpAuth ){ | |
| 206 | + /* set g.fUseHttpAuth to avoid loop when doing HTTPS */ | |
| 207 | + g.fUseHttpAuth = 1; | |
| 212 | 208 | transport_close(GLOBAL_URL()); |
| 213 | 209 | if( --maxRedirect == 0 ){ |
| 214 | 210 | fossil_fatal("http authorization limit exceeded"); |
| 215 | 211 | } |
| 216 | 212 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 217 | 213 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -76,15 +76,10 @@ | |
| 76 | blob_reset(&pw); |
| 77 | blob_reset(&sig); |
| 78 | blob_reset(&nonce); |
| 79 | } |
| 80 | |
| 81 | /* |
| 82 | ** Use HTTP Basic Authorization if a 401 is seen. |
| 83 | */ |
| 84 | static int fUseHttpAuth = 0; |
| 85 | |
| 86 | /* |
| 87 | ** Construct an appropriate HTTP request header. Write the header |
| 88 | ** into pHdr. This routine initializes the pHdr blob. pPayload is |
| 89 | ** the complete payload (including the login card) already compressed. |
| 90 | */ |
| @@ -101,11 +96,11 @@ | |
| 101 | } |
| 102 | blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep); |
| 103 | if( g.urlProxyAuth ){ |
| 104 | blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth); |
| 105 | } |
| 106 | if( g.urlPasswd && g.urlUser && fUseHttpAuth ){ |
| 107 | char *zCredentials = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 108 | char *zEncoded = encode64(zCredentials, -1); |
| 109 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 110 | fossil_free(zEncoded); |
| 111 | fossil_free(zCredentials); |
| @@ -205,12 +200,13 @@ | |
| 205 | while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){ |
| 206 | /* printf("[%s]\n", zLine); fflush(stdout); */ |
| 207 | if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){ |
| 208 | if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err; |
| 209 | if( rc==401 ){ |
| 210 | if( g.urlIsHttps || db_get_boolean("use-http-auth",0)!=0 ){ |
| 211 | fUseHttpAuth = 1; |
| 212 | transport_close(GLOBAL_URL()); |
| 213 | if( --maxRedirect == 0 ){ |
| 214 | fossil_fatal("http authorization limit exceeded"); |
| 215 | } |
| 216 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 217 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -76,15 +76,10 @@ | |
| 76 | blob_reset(&pw); |
| 77 | blob_reset(&sig); |
| 78 | blob_reset(&nonce); |
| 79 | } |
| 80 | |
| 81 | /* |
| 82 | ** Construct an appropriate HTTP request header. Write the header |
| 83 | ** into pHdr. This routine initializes the pHdr blob. pPayload is |
| 84 | ** the complete payload (including the login card) already compressed. |
| 85 | */ |
| @@ -101,11 +96,11 @@ | |
| 96 | } |
| 97 | blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep); |
| 98 | if( g.urlProxyAuth ){ |
| 99 | blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth); |
| 100 | } |
| 101 | if( g.urlPasswd && g.urlUser && g.fUseHttpAuth ){ |
| 102 | char *zCredentials = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 103 | char *zEncoded = encode64(zCredentials, -1); |
| 104 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 105 | fossil_free(zEncoded); |
| 106 | fossil_free(zCredentials); |
| @@ -205,12 +200,13 @@ | |
| 200 | while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){ |
| 201 | /* printf("[%s]\n", zLine); fflush(stdout); */ |
| 202 | if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){ |
| 203 | if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err; |
| 204 | if( rc==401 ){ |
| 205 | if( g.urlIsHttps || g.fUseHttpAuth ){ |
| 206 | /* set g.fUseHttpAuth to avoid loop when doing HTTPS */ |
| 207 | g.fUseHttpAuth = 1; |
| 208 | transport_close(GLOBAL_URL()); |
| 209 | if( --maxRedirect == 0 ){ |
| 210 | fossil_fatal("http authorization limit exceeded"); |
| 211 | } |
| 212 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 213 |
+1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -139,10 +139,11 @@ | ||
| 139 | 139 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 140 | 140 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 141 | 141 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 142 | 142 | int fQuiet; /* True if -quiet flag is present */ |
| 143 | 143 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 144 | + int fUseHttpAuth; /* True if user requests HTTP Authorization */ | |
| 144 | 145 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 145 | 146 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 146 | 147 | int fSshClient; /* HTTP client flags for SSH client */ |
| 147 | 148 | char *zSshCmd; /* SSH command string */ |
| 148 | 149 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| 149 | 150 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -139,10 +139,11 @@ | |
| 139 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 140 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 141 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 142 | int fQuiet; /* True if -quiet flag is present */ |
| 143 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 144 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 145 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 146 | int fSshClient; /* HTTP client flags for SSH client */ |
| 147 | char *zSshCmd; /* SSH command string */ |
| 148 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| 149 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -139,10 +139,11 @@ | |
| 139 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 140 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 141 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 142 | int fQuiet; /* True if -quiet flag is present */ |
| 143 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 144 | int fUseHttpAuth; /* True if user requests HTTP Authorization */ |
| 145 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 146 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 147 | int fSshClient; /* HTTP client flags for SSH client */ |
| 148 | char *zSshCmd; /* SSH command string */ |
| 149 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| 150 |
+2
-3
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -83,19 +83,18 @@ | ||
| 83 | 83 | ** of a server to sync against. If no argument is given, use the |
| 84 | 84 | ** most recently synced URL. Remember the current URL for next time. |
| 85 | 85 | */ |
| 86 | 86 | static void process_sync_args(unsigned *pConfigFlags, unsigned *pSyncFlags){ |
| 87 | 87 | const char *zUrl = 0; |
| 88 | - int fUseHttpAuth; /* Use HTTP auth if requested by user */ | |
| 89 | 88 | unsigned configSync = 0; |
| 90 | 89 | unsigned urlFlags = URL_REMEMBER | URL_PROMPT_PW; |
| 91 | 90 | int urlOptional = 0; |
| 92 | 91 | if( find_option("autourl",0,0)!=0 ){ |
| 93 | 92 | urlOptional = 1; |
| 94 | 93 | urlFlags = 0; |
| 95 | 94 | } |
| 96 | - fUseHttpAuth = find_option("httpauth",0,0)!=0; | |
| 95 | + g.fUseHttpAuth = find_option("httpauth",0,0)!=0; | |
| 97 | 96 | if( find_option("once",0,0)!=0 ) urlFlags &= ~URL_REMEMBER; |
| 98 | 97 | if( find_option("private",0,0)!=0 ){ |
| 99 | 98 | *pSyncFlags |= SYNC_PRIVATE; |
| 100 | 99 | } |
| 101 | 100 | if( find_option("verbose","v",0)!=0 ){ |
| @@ -118,11 +117,11 @@ | ||
| 118 | 117 | } |
| 119 | 118 | if( urlFlags & URL_REMEMBER ){ |
| 120 | 119 | clone_ssh_db_set_options(); |
| 121 | 120 | } |
| 122 | 121 | url_parse(zUrl, urlFlags); |
| 123 | - remember_http_auth(fUseHttpAuth,zUrl); | |
| 122 | + remember_or_get_http_auth(urlFlags & URL_REMEMBER, zUrl); | |
| 124 | 123 | url_remember(); |
| 125 | 124 | if( g.urlProtocol==0 ){ |
| 126 | 125 | if( urlOptional ) fossil_exit(0); |
| 127 | 126 | usage("URL"); |
| 128 | 127 | } |
| 129 | 128 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -83,19 +83,18 @@ | |
| 83 | ** of a server to sync against. If no argument is given, use the |
| 84 | ** most recently synced URL. Remember the current URL for next time. |
| 85 | */ |
| 86 | static void process_sync_args(unsigned *pConfigFlags, unsigned *pSyncFlags){ |
| 87 | const char *zUrl = 0; |
| 88 | int fUseHttpAuth; /* Use HTTP auth if requested by user */ |
| 89 | unsigned configSync = 0; |
| 90 | unsigned urlFlags = URL_REMEMBER | URL_PROMPT_PW; |
| 91 | int urlOptional = 0; |
| 92 | if( find_option("autourl",0,0)!=0 ){ |
| 93 | urlOptional = 1; |
| 94 | urlFlags = 0; |
| 95 | } |
| 96 | fUseHttpAuth = find_option("httpauth",0,0)!=0; |
| 97 | if( find_option("once",0,0)!=0 ) urlFlags &= ~URL_REMEMBER; |
| 98 | if( find_option("private",0,0)!=0 ){ |
| 99 | *pSyncFlags |= SYNC_PRIVATE; |
| 100 | } |
| 101 | if( find_option("verbose","v",0)!=0 ){ |
| @@ -118,11 +117,11 @@ | |
| 118 | } |
| 119 | if( urlFlags & URL_REMEMBER ){ |
| 120 | clone_ssh_db_set_options(); |
| 121 | } |
| 122 | url_parse(zUrl, urlFlags); |
| 123 | remember_http_auth(fUseHttpAuth,zUrl); |
| 124 | url_remember(); |
| 125 | if( g.urlProtocol==0 ){ |
| 126 | if( urlOptional ) fossil_exit(0); |
| 127 | usage("URL"); |
| 128 | } |
| 129 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -83,19 +83,18 @@ | |
| 83 | ** of a server to sync against. If no argument is given, use the |
| 84 | ** most recently synced URL. Remember the current URL for next time. |
| 85 | */ |
| 86 | static void process_sync_args(unsigned *pConfigFlags, unsigned *pSyncFlags){ |
| 87 | const char *zUrl = 0; |
| 88 | unsigned configSync = 0; |
| 89 | unsigned urlFlags = URL_REMEMBER | URL_PROMPT_PW; |
| 90 | int urlOptional = 0; |
| 91 | if( find_option("autourl",0,0)!=0 ){ |
| 92 | urlOptional = 1; |
| 93 | urlFlags = 0; |
| 94 | } |
| 95 | g.fUseHttpAuth = find_option("httpauth",0,0)!=0; |
| 96 | if( find_option("once",0,0)!=0 ) urlFlags &= ~URL_REMEMBER; |
| 97 | if( find_option("private",0,0)!=0 ){ |
| 98 | *pSyncFlags |= SYNC_PRIVATE; |
| 99 | } |
| 100 | if( find_option("verbose","v",0)!=0 ){ |
| @@ -118,11 +117,11 @@ | |
| 117 | } |
| 118 | if( urlFlags & URL_REMEMBER ){ |
| 119 | clone_ssh_db_set_options(); |
| 120 | } |
| 121 | url_parse(zUrl, urlFlags); |
| 122 | remember_or_get_http_auth(urlFlags & URL_REMEMBER, zUrl); |
| 123 | url_remember(); |
| 124 | if( g.urlProtocol==0 ){ |
| 125 | if( urlOptional ) fossil_exit(0); |
| 126 | usage("URL"); |
| 127 | } |
| 128 |