[lxc-devel] [lxd/master] shared/simplestreams: Fix stream's index download url

sladkani on Github lxc-bot at linuxcontainers.org
Sat Oct 3 09:19:27 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 787 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201003/83435316/attachment.bin>
-------------- next part --------------
From 961a1c019ea700cbbc692686979b20fd2f489b0b Mon Sep 17 00:00:00 2001
From: Shmulik Ladkani <shmulik.ladkani at gmail.com>
Date: Thu, 1 Oct 2020 12:51:53 +0300
Subject: [PATCH] shared/simplestreams: Fix stream's index download url

Since commit aef8f1928 ("shared/simplestreams: Implement caching support")
the index url contains double '/' between the host part and the path part,
so the resulting url looks like:
  https://STREAMSERVER//streams/v1/index.json

Certain servers will literaly take '/streams/v1/index.json' as the path,
and therefore return 404 or 403.

Fix parseStream(), by removing the prepended '/' passed to
s.cachedDownload().

Signed-off-by: Shmulik Ladkani <shmulik.ladkani at gmail.com>
---
 shared/simplestreams/simplestreams.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shared/simplestreams/simplestreams.go b/shared/simplestreams/simplestreams.go
index 59841b419e..fd420326a3 100644
--- a/shared/simplestreams/simplestreams.go
+++ b/shared/simplestreams/simplestreams.go
@@ -148,7 +148,7 @@ func (s *SimpleStreams) parseStream() (*Stream, error) {
 		return s.cachedStream, nil
 	}
 
-	body, err := s.cachedDownload("/streams/v1/index.json")
+	body, err := s.cachedDownload("streams/v1/index.json")
 	if err != nil {
 		return nil, err
 	}


More information about the lxc-devel mailing list