From c47fc0f81f5d945bd886c955c91389211c82ad88 Mon Sep 17 00:00:00 2001 From: John Papandriopoulos Date: Mon, 21 Sep 2020 23:18:39 -0700 Subject: [PATCH 1/2] Fix Marshal error for asn1 by passing struct, not pointer to struct. --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index 304cd56..ce82b91 100644 --- a/client.go +++ b/client.go @@ -32,7 +32,7 @@ func NewClient(url string) *Client { // This will not verify the response. It is the caller's responsibility // to call resp.Verify() on the returned TimeStampResp. func (client *Client) Do(tsq *TimeStampReq) (*TimeStampResp, error) { - der, err := asn1.Marshal(tsq) + der, err := asn1.Marshal(*tsq) if err != nil { return nil, err } From 10235dfde14998b4754c0d66477cdcb7fb786725 Mon Sep 17 00:00:00 2001 From: John Papandriopoulos Date: Mon, 21 Sep 2020 23:18:44 -0700 Subject: [PATCH 2/2] Fix for crash when HTTP client connection fails. --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index ce82b91..ab80114 100644 --- a/client.go +++ b/client.go @@ -44,10 +44,10 @@ func (client *Client) Do(tsq *TimeStampReq) (*TimeStampResp, error) { req.Header.Set("Content-Type", "application/timestamp-query") resp, err := client.HTTPClient.Do(req) - defer resp.Body.Close() if err != nil { return nil, err } + defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil {