From 8196f8b53e0ec406a6a8bb1be0381892db52312a Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 13 May 2020 17:00:34 -0400 Subject: [PATCH] in debug mode, disable https checking --- activity.go | 12 ++++++++++++ honk.go | 1 + web.go | 1 - 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/activity.go b/activity.go index eab27bd..5d1ce94 100644 --- a/activity.go +++ b/activity.go @@ -18,6 +18,7 @@ package main import ( "bytes" "context" + "crypto/tls" "database/sql" "fmt" "html" @@ -56,12 +57,23 @@ func friendorfoe(ct string) bool { return false } +var debugClient = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + }, +} + func PostJunk(keyname string, key httpsig.PrivateKey, url string, j junk.Junk) error { return PostMsg(keyname, key, url, j.ToBytes()) } func PostMsg(keyname string, key httpsig.PrivateKey, url string, msg []byte) error { client := http.DefaultClient + if debugMode { + client = debugClient + } req, err := http.NewRequest("POST", url, bytes.NewReader(msg)) if err != nil { return err diff --git a/honk.go b/honk.go index 9bff113..cad4862 100644 --- a/honk.go +++ b/honk.go @@ -260,6 +260,7 @@ func main() { } getconfig("usersep", &userSep) getconfig("honksep", &honkSep) + getconfig("debug", &debugMode) prepareStatements(db) switch cmd { case "admin": diff --git a/web.go b/web.go index 84def27..7cda832 100644 --- a/web.go +++ b/web.go @@ -2357,7 +2357,6 @@ func serve() { go bgmonitor() w100 := wait100ms() - getconfig("debug", &debugMode) readviews = templates.Load(debugMode, viewDir+"/views/honkpage.html", viewDir+"/views/honkfrags.html",