On Sat, Mar 16, 2013 at 12:29:35PM +0100, Michele La Monaca wrote: > Oddly and inconveniently enough, (setup-proxy uri) does not not accept > well-formed URIs: > > http_proxy=http://<IP>:<PORT> > > (it accepts only the short form http_proxy=<IP>:<PORT>)
That's annoying indeed. There isn't a proper standard for this, but I think most modern programs allow full URIs (which is why I chose to allow just full URIs for http-client). Find a simplified and signed off version of your patch attached. Thanks! Cheers, Peter -- http://www.more-magic.net
>From 96015c97be92e8bd5d508daed8d14eafd8969fb2 Mon Sep 17 00:00:00 2001 From: Michele La Monaca <[email protected]> Date: Sat, 16 Mar 2013 11:35:01 +0100 Subject: [PATCH] Fix setup-proxy to accept http URIs Signed-off-by: Peter Bex <[email protected]> --- NEWS | 2 ++ chicken-install.scm | 16 ++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index c21c7cf..c2d16fb 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ - Tools - csc: added "-oi"/"-ot" options as alternatives to "-emit-inline-file" and "-emit-type-file", respectively; "-n" has been deprecated. + - chicken-install now also accepts full URI syntax for proxy environment + variables (thanks to Michele La Monaca) - Core libraries - read-line no longer returns trailing CRs in rare cases on TCP ports (#568) diff --git a/chicken-install.scm b/chicken-install.scm index 714cf74..1ba5b97 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -798,16 +798,12 @@ EOF (exit code)) (define (setup-proxy uri) - (if (string? uri) - (begin - (set! *proxy-user-pass* (get-environment-variable "proxy_auth")) - (cond ((irregex-match "(.+)\\:([0-9]+)" uri) => - (lambda (m) - (set! *proxy-host* (irregex-match-substring m 1)) - (set! *proxy-port* (string->number (irregex-match-substring m 2)))) - (else - (set! *proxy-host* uri) - (set! *proxy-port* 80))))))) + (and-let* (((string? uri)) + (m (irregex-match "(http://)?([^:]+):?([0-9]*)" uri)) + (port (irregex-match-substring m 3))) + (set! *proxy-user-pass* (get-environment-variable "proxy_auth")) + (set! *proxy-host* (irregex-match-substring m 2)) + (set! *proxy-port* (or (string->number port) 80)))) (define (info->egg info) (if (member (cdr info) '("" "unknown" "trunk")) -- 1.8.0.1
_______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
