From 3f986a0e50c72c1035779d6a8179d53de01f4fa5 Mon Sep 17 00:00:00 2001 From: Vladislav Yarmak Date: Thu, 25 Mar 2021 20:45:48 +0200 Subject: [PATCH] WIP --- main.go | 28 ++++++++++++++++++++++++++++ seclient/seclient.go | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..da20006 --- /dev/null +++ b/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "context" + "log" + + se "github.com/Snawoot/opera-proxy/seclient" +) + +const ( + username = "se0316" + password = "SILrMEPBmJuhomxWkfm3JalqHX2Eheg1YhlEZiMh8II" +) + +func main() { + seclient, err := se.NewSEClient(username, password, nil) + if err != nil { + log.Fatalln(err) + } + log.Printf("seclient = %#v", seclient) + + log.Println("------------ DOING REGISTRATION ------------") + err = seclient.AnonRegister(context.TODO()) + if err != nil { + log.Fatalln(err) + } + log.Printf("seclient = %#v", seclient) +} diff --git a/seclient/seclient.go b/seclient/seclient.go index 15c5da9..a3b1bec 100644 --- a/seclient/seclient.go +++ b/seclient/seclient.go @@ -168,8 +168,8 @@ func (c *SEClient) populateRequest(req *http.Request) { // Does cleanup of HTTP response in order to make it reusable by keep-alive // logic of HTTP client func cleanupBody(body io.ReadCloser) { - io.Copy(io.Discard, io.LimitedReader{ - R: resp.Body, + io.Copy(ioutil.Discard, &io.LimitedReader{ + R: body, N: READ_LIMIT, }) body.Close()