Merge: - tls: allow_unencrypted_doh and strict_sni_check settings were reset after POST /control/tls/configure

Close #1484

Squashed commit of the following:

commit 2daae88b80d83889238eaf4808b8a4da4fd8b102
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Wed Mar 18 13:16:23 2020 +0300

    minor

commit 99fa4e27ad45e515c8faef14a77304c2a9687875
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Mar 17 13:46:46 2020 +0300

    - tls: allow_unencrypted_doh and strict_sni_check settings were reset after POST /control/tls/configure
This commit is contained in:
Simon Zolin 2020-03-18 15:18:15 +03:00
parent 4dba20941d
commit 3303d77dad

View File

@ -253,7 +253,18 @@ func (t *TLSMod) handleTLSConfigure(w http.ResponseWriter, r *http.Request) {
log.Printf("tls config settings have changed, will restart HTTPS server")
restartHTTPS = true
}
t.conf = data
// Note: don't do just `t.conf = data` because we must preserve all other members of t.conf
t.conf.Enabled = data.Enabled
t.conf.ServerName = data.ServerName
t.conf.ForceHTTPS = data.ForceHTTPS
t.conf.PortHTTPS = data.PortHTTPS
t.conf.PortDNSOverTLS = data.PortDNSOverTLS
t.conf.CertificateChain = data.CertificateChain
t.conf.CertificatePath = data.CertificatePath
t.conf.CertificateChainData = data.CertificateChainData
t.conf.PrivateKey = data.PrivateKey
t.conf.PrivateKeyPath = data.PrivateKeyPath
t.conf.PrivateKeyData = data.PrivateKeyData
t.status = status
t.confLock.Unlock()
t.setCertFileTime()