[PATCH 2/3] substitutes: Properly construct URLs.

DoneSubmitted by Hartmut Goebel.
Details
2 participants
  • Hartmut Goebel
  • Hartmut Goebel
Owner
unassigned
Severity
normal
H
H
Hartmut Goebel wrote on 9 Jul 10:38 +0200
26c8bb31c4d468e770e35cd743aca736f5ccd093.1625819848.git.h.goebel@crazy-compilers.com
Use relative URIs and "resolve-uri-reference" (which implements the algorithmspecified in RFC 3986 section 5.2.2) for building the URL, instead of justappending strings. This avoids issued if the cache-url ends with a slash.
* guix/substitutes.scm (narinfo-request): Use resolve-uri-reference for constructing the url.--- guix/substitutes.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Toggle diff (33 lines)diff --git a/guix/substitutes.scm b/guix/substitutes.scmindex 4987cda165..a5c554acff 100644--- a/guix/substitutes.scm+++ b/guix/substitutes.scm@@ -37,7 +37,8 @@ #:use-module ((guix build utils) #:select (mkdir-p dump-port)) #:use-module ((guix build download) #:select ((open-connection-for-uri- . guix:open-connection-for-uri)))+ . guix:open-connection-for-uri)+ resolve-uri-reference)) #:use-module (guix progress) #:use-module (ice-9 rdelim) #:use-module (ice-9 regex)@@ -155,10 +156,12 @@ indicates that PATH is unavailable at CACHE-URL." (define (narinfo-request cache-url path) "Return an HTTP request for the narinfo of PATH at CACHE-URL."- (let ((url (string-append cache-url "/" (store-path-hash-part path)- ".narinfo"))- (headers '((User-Agent . "GNU Guile"))))- (build-request (string->uri url) #:method 'GET #:headers headers)))+ (let* ((base (string->uri cache-url))+ (ref (build-relative-ref+ #:path (string-append (store-path-hash-part path) ".narinfo")))+ (url (resolve-uri-reference ref base))+ (headers '((User-Agent . "GNU Guile"))))+ (build-request url #:method 'GET #:headers headers))) (define (narinfo-from-file file url) "Attempt to read a narinfo from FILE, using URL as the cache URL. Return #f-- 2.30.2
H
H
Hartmut Goebel wrote on 16 Jul 20:01 +0200
close
(name . control)(address . control@debbugs.gnu.org)
70ff8106-955c-ccd8-e9cc-a054c3391791@goebel-consult.de
close 49483
close 49482
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 49483@debbugs.gnu.org