Check-in [f652599003]
Not logged in
Overview

SHA1 Hash:f652599003d139cada15dffdbb6c8587db4a1eef
Date: 2008-05-06 12:24:22
User: drh
Comment:Add the --proxy command-line option that can be used to enable or disable an http proxy on a case by case basis.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/clone.c from [dbac624435] to [0c2a5c8339].

@@ -36,10 +36,11 @@
 **
 ** Make a clone of a repository specified by URL in the local
 ** file named FILENAME.
 */
 void clone_cmd(void){
+  url_proxy_options();
   if( g.argc!=4 ){
     usage("FILE-OR-URL NEW-REPOSITORY");
   }
   db_open_config();
   if( file_size(g.argv[3])>0 ){

Modified src/sync.c from [8dd56b0a12] to [f8524fbcd7].

@@ -71,10 +71,11 @@
 ** of a server to sync against.  If no argument is given, use the
 ** most recently synced URL.  Remember the current URL for next time.
 */
 static void process_sync_args(void){
   const char *zUrl = 0;
+  url_proxy_options();
   db_find_and_open_repository(1);
   if( g.argc==2 ){
     zUrl = db_get("last-sync-url", 0);
   }else if( g.argc==3 ){
     zUrl = g.argv[2];

Modified src/url.c from [8c4adf4994] to [32de843e7c].

@@ -114,10 +114,11 @@
 /*
 ** COMMAND: test-urlparser
 */
 void cmd_test_urlparser(void){
   int i;
+  url_proxy_options();
   if( g.argc!=3 && g.argc!=4 ){
     usage("URL");
   }
   url_parse(g.argv[2]);
   for(i=0; i<2; i++){
@@ -135,17 +136,36 @@
     }
   }
 }
 
 /*
+** Proxy specified on the command-line.
+*/
+static const char *zProxyOpt = 0;
+
+/*
+** Extra any proxy options from the command-line.
+**
+**    --proxy URL|off
+**
+*/
+void url_proxy_options(void){
+  zProxyOpt = find_option("proxy", 0, 1);
+}
+
+/*
 ** If the "proxy" setting is defined, then change the URL to refer
 ** to the proxy server.
 */
 void url_enable_proxy(const char *zMsg){
-  const char *zProxy = db_get("proxy", 0);
-  if( zProxy==0 || zProxy[0] || is_false(zProxy) ){
-    zProxy = getenv("http_proxy");
+  const char *zProxy;
+  zProxy = zProxyOpt;
+  if( zProxy==0 ){
+    zProxy = db_get("proxy", 0);
+    if( zProxy==0 || zProxy[0] || is_false(zProxy) ){
+      zProxy = getenv("http_proxy");
+    }
   }
   if( zProxy && zProxy[0] && !is_false(zProxy) ){
     char *zOriginalUrl = g.urlCanonical;
     char *zOriginalHost = g.urlHostname;
     if( zMsg ) printf("%s%s\n", zMsg, zProxy);

Modified www/quickstart.html from [f0a6ad1585] to [ce3d352b11].

@@ -223,11 +223,21 @@
 
 </blockquote><a name="proxy"></a><h2>HTTP Proxies</h2><blockquote>
 
     <p>If you are behind a restrictive firewall that requires you to use
     an HTTP proxy to reach the internet, then you can configure the proxy
-    in one of two ways.  You can tell fossil about your proxy like this:<p>
+    in three different ways.  You can tell fossil about your proxy using
+    a command-line option on commands that use the network,
+    <b>sync</b>, <b>clone</b>, <b>push</b>, and <b>pull</b>.</p>
+
+    <blockquote>
+    <b>fossil clone </b><i>URL</i>  <b>--proxy</b> <i>Proxy-URL</i>
+    </blockquote>
+
+    <p>It is annoying to have to type in the proxy URL every time you
+    sync your project, though, so you can make the proxy configuration
+    persistent using the <b>setting</b> command:</p>
 
     <blockquote>
     <b>fossil setting proxy </b><i>Proxy-URL</i>
     </blockquote>
 
@@ -242,11 +252,19 @@
     <blockquote>
     <b>fossil setting proxy off</b>
     </blockquote>
 
     <p>Or unset the environment variable.  The fossil setting for the
-    HTTP proxy takes precedence over the environment variable.</p>
+    HTTP proxy takes precedence over the environment variable and the
+    command-line option overrides both.  If you have an persistent
+    proxy setting that you want to override for a one-time sync, that
+    is easily done on the command-line.  For example, to sync with
+    a co-workers repository on your LAN, you might type:</p>
+
+    <blockquote>
+    <b>fossil sync http://192.168.1.36:8080/ --proxy off</b>
+    </blockquote>
 
 </blockquote><h2>More Hints</h2><blockquote>
 
     <p>Try these commands:</p>