Diff
Not logged in

Differences From:

File src/url.c part of check-in [1dbf332352] - Fix the HOST: header to use the original URL, not the proxy URL. by drh on 2008-05-05 19:08:43. [view]

To:

File src/url.c part of check-in [f652599003] - Add the --proxy command-line option that can be used to enable or disable an http proxy on a case by case basis. by drh on 2008-05-06 12:24:22. [view]

@@ -115,8 +115,9 @@
 ** 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]);
@@ -136,15 +137,34 @@
   }
 }
 
 /*
+** 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;