in debug mode, disable https checking

This commit is contained in:
Ted Unangst 2020-05-13 17:00:34 -04:00
parent 4721226402
commit 8196f8b53e
3 changed files with 13 additions and 1 deletions

View File

@ -18,6 +18,7 @@ package main
import ( import (
"bytes" "bytes"
"context" "context"
"crypto/tls"
"database/sql" "database/sql"
"fmt" "fmt"
"html" "html"
@ -56,12 +57,23 @@ func friendorfoe(ct string) bool {
return false 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 { func PostJunk(keyname string, key httpsig.PrivateKey, url string, j junk.Junk) error {
return PostMsg(keyname, key, url, j.ToBytes()) return PostMsg(keyname, key, url, j.ToBytes())
} }
func PostMsg(keyname string, key httpsig.PrivateKey, url string, msg []byte) error { func PostMsg(keyname string, key httpsig.PrivateKey, url string, msg []byte) error {
client := http.DefaultClient client := http.DefaultClient
if debugMode {
client = debugClient
}
req, err := http.NewRequest("POST", url, bytes.NewReader(msg)) req, err := http.NewRequest("POST", url, bytes.NewReader(msg))
if err != nil { if err != nil {
return err return err

View File

@ -260,6 +260,7 @@ func main() {
} }
getconfig("usersep", &userSep) getconfig("usersep", &userSep)
getconfig("honksep", &honkSep) getconfig("honksep", &honkSep)
getconfig("debug", &debugMode)
prepareStatements(db) prepareStatements(db)
switch cmd { switch cmd {
case "admin": case "admin":

1
web.go
View File

@ -2357,7 +2357,6 @@ func serve() {
go bgmonitor() go bgmonitor()
w100 := wait100ms() w100 := wait100ms()
getconfig("debug", &debugMode)
readviews = templates.Load(debugMode, readviews = templates.Load(debugMode,
viewDir+"/views/honkpage.html", viewDir+"/views/honkpage.html",
viewDir+"/views/honkfrags.html", viewDir+"/views/honkfrags.html",