in debug mode, disable https checking

master
Ted Unangst 4 years ago
parent 4721226402
commit 8196f8b53e

@ -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

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

@ -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",

Loading…
Cancel
Save