1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-11-10 00:32:11 +01:00

Ensure absolute paths in client certificate store

This commit is contained in:
adnano 2020-10-27 23:47:13 -04:00
parent 748967867f
commit 80e2f783c3
2 changed files with 7 additions and 1 deletions

@ -77,6 +77,12 @@ type ClientCertificateStore struct {
func (c *ClientCertificateStore) Lookup(hostname, urlPath string) (*tls.Certificate, error) {
urlPath = path.Clean(urlPath)
if urlPath == "." {
urlPath = "/"
}
if urlPath[0] != '/' {
urlPath = "/" + urlPath
}
for {
cert, err := c.CertificateStore.Lookup(hostname + urlPath)
switch err {

@ -77,8 +77,8 @@ func sendRequest(req *gemini.Request) error {
}
if resp.Status.Class() == gemini.StatusClassSuccess {
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return err
}