working commit

This commit is contained in:
2026-02-11 12:53:31 +02:00
parent 517c518df2
commit 6fe7f7c15e
12 changed files with 392 additions and 186 deletions
+25
View File
@@ -12,6 +12,8 @@ package client
import (
"crypto/tls"
"net/http"
"net/url"
"strings"
)
type roundTripper struct{}
@@ -25,3 +27,26 @@ func (t *roundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
}
return httpTransport.RoundTrip(r)
}
func repackReference(ref string) (string, string, string, error) {
var err error
var username string
var password string
if !strings.Contains(ref, `://`) {
ref = "https://" + ref
}
uri, err := url.Parse(ref)
if err != nil {
return ref, username, password, err
}
username = uri.User.Username()
password, _ = uri.User.Password()
uri.User = nil
uri.Path, _ = url.JoinPath("/", uri.Path)
if err != nil {
return ref, username, password, err
}
ref = uri.Host + uri.Path
return ref, username, password, err
}