>From 6a3e4b32f99ee3cc7c7c93b4c4bee599ac659278 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Sat, 2 Mar 2013 14:48:16 -0300 Subject: [PATCH] setup-download: fix +url-regex+ and deconstruct-url to match urls with path=/ or no path when port number is provided Without this patch, we get: (deconstruct-url "http://localhost:8080") => (values "http://localhost:8080" 80 "/") (deconstruct-url "http://localhost:8080/") => (values "http://localhost:8080/" 80 "/") That behavior makes chicken-install request port 80, even if another port was requested (8080, in the examples). Also, it returns host as "http://localhost:8080" instead of "localhost". This patch makes deconstruct-url correctly handle / and no path when a port is provided: (deconstruct-url "http://localhost:8080") => (values "localhost" 8080 "/") (deconstruct-url "http://localhost:8080/") => (values "localhost" 8080 "/") --- setup-download.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup-download.scm b/setup-download.scm index 5267b22..30934c4 100644 --- a/setup-download.scm +++ b/setup-download.scm @@ -44,7 +44,7 @@ (define-constant +default-tcp-connect-timeout+ 30000) ; 30 seconds (define-constant +default-tcp-read/write-timeout+ 30000) ; 30 seconds - (define-constant +url-regex+ "(http://)?([^/:]+)(:([^:/]+))?(/.+)") + (define-constant +url-regex+ "(http://)?([^/:]+)(:([^:/]+))?(/.*)?") (tcp-connect-timeout +default-tcp-connect-timeout+) (tcp-read-timeout +default-tcp-read/write-timeout+) @@ -226,7 +226,8 @@ (or (string->number port) (error "not a valid port" port))) 80) - (if m (irregex-match-substring m 5) "/")) ) ) + (or (and m (irregex-match-substring m 5)) + "/")))) (define (locate-egg/http egg url #!optional version destination tests proxy-host proxy-port proxy-user-pass) -- 1.7.10.4