~ chicken-core (chicken-5) 0e83e4990d4ae0d77e1ccb7cc099ceef0f2cb6a4


commit 0e83e4990d4ae0d77e1ccb7cc099ceef0f2cb6a4
Author:     Michele La Monaca <mikele.chicken@lamonaca.net>
AuthorDate: Sat Mar 16 11:35:01 2013 +0100
Commit:     Jim Ursetto <zbigniewsz@gmail.com>
CommitDate: Sat Mar 16 14:36:30 2013 -0500

    Fix setup-proxy to accept http URIs
    
    Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
    Signed-off-by: Jim Ursetto <zbigniewsz@gmail.com>

diff --git a/NEWS b/NEWS
index c21c7cf9..c2d16fb0 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 714cf74b..1ba5b978 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"))
Trap