mirror of
https://github.com/makeworld-the-better-one/amfora.git
synced 2024-11-22 07:23:05 +03:00
🐛 Don't rerequest resource when bypassing TOFU
This commit is contained in:
parent
bd6daa5a3c
commit
e8e23c7fe6
@ -105,11 +105,9 @@ func handleTofu(cert *x509.Certificate, port string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// RemoveTofuEntry invalidates the TOFU entry in the database for the given cert and port.
|
||||
// This will make any cert for that domain valid.
|
||||
//
|
||||
// ResetTofuEntry forces the cert passed to be valid, overwriting any previous TOFU entry.
|
||||
// The port string can be empty, to indicate port 1965.
|
||||
func RemoveTofuEntry(cert *x509.Certificate, port string) {
|
||||
func ResetTofuEntry(cert *x509.Certificate, port string) {
|
||||
tofuStore.Set(idKey(cert.Subject.CommonName, port), "")
|
||||
tofuStore.WriteConfig()
|
||||
}
|
||||
|
@ -228,13 +228,14 @@ func handleURL(u string) (string, bool) {
|
||||
if err == client.ErrTofu {
|
||||
if Tofu(parsed.Host) {
|
||||
// They want to continue anyway
|
||||
client.RemoveTofuEntry(res.Cert, parsed.Port())
|
||||
return handleURL(u)
|
||||
client.ResetTofuEntry(res.Cert, parsed.Port())
|
||||
// Response can be used further down
|
||||
} else {
|
||||
// They don't want to continue
|
||||
// Set the bar back to original URL
|
||||
bottomBar.SetText(tabMap[curTab].Url)
|
||||
return "", false
|
||||
}
|
||||
// They don't want to continue
|
||||
// Set the bar back to original URL
|
||||
bottomBar.SetText(tabMap[curTab].Url)
|
||||
return "", false
|
||||
} else if err != nil {
|
||||
Error("URL Fetch Error", err.Error())
|
||||
// Set the bar back to original URL
|
||||
|
Loading…
Reference in New Issue
Block a user