From 3c4a25ad34a02416edffa1f95c906a835e2512ac Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Wed, 19 Sep 2012 06:15:12 -0700 Subject: [PATCH] https client --- README | 1 - src/xx-https-client.go | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/xx-https-client.go diff --git a/README b/README index b1f616c..0149627 100644 --- a/README +++ b/README @@ -54,7 +54,6 @@ gobyexample.com signups * listing files * tls server * tls client -* https client * buffered io * tcp proxy * http streaming server diff --git a/src/xx-https-client.go b/src/xx-https-client.go new file mode 100644 index 0000000..587368d --- /dev/null +++ b/src/xx-https-client.go @@ -0,0 +1,15 @@ +package main + +import ("net/http"; "crypto/tls"; "io/ioutil"; "fmt") + +func main() { + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + client := &http.Client{Transport: tr} + resp, err := client.Get("https://127.0.0.1:5000/") + if err != nil { panic(err) } + defer resp.Body.Close() + body, _ := ioutil.ReadAll(resp.Body) + fmt.Print(string(body)) +}