/*
tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
manager, WARC/geminispace browser
-Copyright (C) 2021-2022 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2021-2023 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
log.Fatalln(err)
}
defer conn.Close()
- conn.Write([]byte(fmt.Sprintf(
- "%s %d %s\r\n\r\n",
- req.Proto,
- http.StatusOK, http.StatusText(http.StatusOK),
- )))
+ fmt.Fprintf(
+ conn, "%s %d %s\r\n\r\n",
+ req.Proto, http.StatusOK, http.StatusText(http.StatusOK),
+ )
host, _, _ := ttls.SplitHostPort(req.Host)
hostCertsM.Lock()
keypair, ok := hostCerts[host]
if !ok || !keypair.cert.NotAfter.After(time.Now().Add(time.Hour)) {
- keypair = newKeypair(host, CACert, CAPrv)
+ keypair = newX509Keypair(host, CACert, CAPrv)
hostCerts[host] = keypair
}
hostCertsM.Unlock()