Skip to content
Snippets Groups Projects
Commit 870e7b84 authored by Niall Sheridan's avatar Niall Sheridan
Browse files

Ensure the /sign url is valid before use

parent a869e39e
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import (
"log"
"net"
"net/http"
"net/url"
"os"
"os/user"
"path"
......@@ -49,7 +50,12 @@ func send(s []byte, token, ca string, ValidateTLSCertificate bool) (*lib.SignRes
TLSClientConfig: &tls.Config{InsecureSkipVerify: !ValidateTLSCertificate},
}
client := &http.Client{Transport: transport}
req, err := http.NewRequest("POST", ca+"/sign", bytes.NewReader(s))
u, err := url.Parse(ca)
if err != nil {
return nil, err
}
u.Path = path.Join(u.Path, "/sign")
req, err := http.NewRequest("POST", u.String(), bytes.NewReader(s))
if err != nil {
return nil, err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment