Ensure absolute paths in client certificate store
This commit is contained in:
parent
4c5167f590
commit
e6072d8bbc
6
cert.go
6
cert.go
|
@ -77,6 +77,12 @@ type ClientCertificateStore struct {
|
||||||
|
|
||||||
func (c *ClientCertificateStore) Lookup(hostname, urlPath string) (*tls.Certificate, error) {
|
func (c *ClientCertificateStore) Lookup(hostname, urlPath string) (*tls.Certificate, error) {
|
||||||
urlPath = path.Clean(urlPath)
|
urlPath = path.Clean(urlPath)
|
||||||
|
if urlPath == "." {
|
||||||
|
urlPath = "/"
|
||||||
|
}
|
||||||
|
if urlPath[0] != '/' {
|
||||||
|
urlPath = "/" + urlPath
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
cert, err := c.CertificateStore.Lookup(hostname + urlPath)
|
cert, err := c.CertificateStore.Lookup(hostname + urlPath)
|
||||||
switch err {
|
switch err {
|
||||||
|
|
|
@ -77,8 +77,8 @@ func sendRequest(req *gemini.Request) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.Status.Class() == gemini.StatusClassSuccess {
|
if resp.Status.Class() == gemini.StatusClassSuccess {
|
||||||
defer resp.Body.Close()
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
|
resp.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user