It certainly seems like a bug to me, and your patch seems correct as far
as I can tell.  However, I don't see the need for supporting a dash or
"noproxy".  With your patch, if you set http_proxy to an empty string
within the URL block, it should do the right thing.  What was missing
before was the code you added to delete the old "proxy" value and set
the pointer to null when proxyURL's length is 0.

Setting http_proxy to an empty string seems like the intutive way to
turn off proxy support, as this attribute is empty by default.  Having
to use a special value to turn off the feature seems less intuitive.

On a related note, I noticed that between the 3.1.x releases and
3.2.0b(something), the following sentence was added to the description
of the http_proxy attribute in attrs.html (i.e. defaults.cc in 3.2):

   Later, this should be able to be overridden by the http_proxy
   environement variable, but it currently cannot.

Typo aside, I can't imagine any point to that sentence in the docs.
htdig does not, to my recollection, ever allow environment variables to
override any config attribute, with the possible exception of CONFIG_DIR
changing the compiled-in equivalent for htsearch (which is a legitimate
special case).  I also don't see any reason why this particular attribute
should be singled out for special treatment in the future in this regard,
or any reason for the expectation that it should be able to be overridden,
so why even mention this at all?  Can anyone explain this one?

According to Gabriele Bartolini:
> - default: set the proxy
> - for particular URLs: unset it
> 
>    With the current proxy it is not possible, because, if we write:
> 
> <url: http://www.po-net.prato.it>
> http_proxy:
> </url>
> 
>    the setting is not considered (it is empty).
> 
>    My suggestion is to use the dash ('-') as special character for
> unsetting this value or the keyword ('noproxy') as follows:
> 
> <url: http://www.po-net.prato.it>
> http_proxy: -
> </url>
> 
> or
> 
> <url: http://www.po-net.prato.it>
> http_proxy: noproxy
> </url>
> 
>    In this case, I slightly need to modify the Document.cc file.
> 
>    I am also concerned about applying this small change to the current
> code or not: I consider this a bug (which prevent the spider to
> correctly work in this case).
> 
>    Here is the small patch.
> 
>    Please let me know, so I can eventually open and close a bug.
> 
> Ciao,
> -Gabriele
> 
> diff -3 -u -p -r1.68 Document.cc
> --- Document.cc 23 Oct 2003 02:10:55 -0000      1.68
> +++ Document.cc 30 Jan 2004 11:01:27 -0000
> @@ -186,10 +186,19 @@ Document::Url(const String &u)
>      url = new URL(u);
>  
>      const String proxyURL = config->Find(url,"http_proxy");
> -    if (proxyURL.length())
> +    // If http_proxy is set to '-' or 'noproxy', the proxy for the
> +    // current URL is unset
> +    if (!proxyURL.length() || !mystrncasecmp(proxyURL.get(), "noproxy",
> 7)
> +        || !mystrncasecmp(proxyURL.get(), "-", 1))
>      {
> -       proxy = new URL(proxyURL);
> -       proxy->normalize();
> +        if (proxy)
> +            delete proxy;
> +        proxy = 0;
> +    }
> +    else
> +    {
> +        proxy = new URL(proxyURL);
> +        proxy->normalize();
>      }
>  
>      const String credentials = config->Find(url,"authorization");
> 
> 
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> ht://Dig Developer mailing list:
> [EMAIL PROTECTED]
> List information (subscribe/unsubscribe, etc.)
> https://lists.sourceforge.net/lists/listinfo/htdig-dev
> 


-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/
Dept. Physiology, U. of Manitoba  Winnipeg, MB  R3E 3J7  (Canada)


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
ht://Dig Developer mailing list:
[EMAIL PROTECTED]
List information (subscribe/unsubscribe, etc.)
https://lists.sourceforge.net/lists/listinfo/htdig-dev

Reply via email to