Merge pull request 'Pass extra information to _handle_cert_request' (#29) from govynnus/AV-98:fix-cert-request into master

Reviewed-on: #29
This commit is contained in:
Solderpunk 2023-11-12 10:37:28 +00:00
commit 522047a209
1 changed files with 5 additions and 5 deletions

10
av98.py
View File

@ -492,7 +492,7 @@ you'll be able to transparently follow links to Gopherspace!""")
# Client cert
elif status.startswith("6"):
self._handle_cert_request(meta)
self._handle_cert_request(meta, status, gi.host)
return self._fetch_over_network(gi)
# Invalid status
@ -717,7 +717,7 @@ you'll be able to transparently follow links to Gopherspace!""")
for _, filename in self.cache.values():
assert os.path.isfile(filename)
def _handle_cert_request(self, meta):
def _handle_cert_request(self, meta, status, host):
# Don't do client cert stuff in restricted mode, as in principle
# it could be used to fill up the disk by creating a whole lot of
@ -736,7 +736,7 @@ you'll be able to transparently follow links to Gopherspace!""")
print("The server did not accept your certificate.")
print("You may need to e.g. coordinate with the admin to get your certificate fingerprint whitelisted.")
else:
print("The site {} is requesting a client certificate.".format(gi.host))
print("The site {} is requesting a client certificate.".format(host))
print("This will allow the site to recognise you across requests.")
# Give the user choices
@ -744,8 +744,8 @@ you'll be able to transparently follow links to Gopherspace!""")
print("1. Give up.")
print("2. Generate a new transient certificate.")
print("3. Generate a new persistent certificate.")
print("4. Load a previously generated persistent.")
print("5. Load certificate from an external file.")
print("4. Load a previously generated certificate.")
print("5. Load a certificate from an external file.")
choice = input("> ").strip()
if choice == "2":
self._generate_transient_cert_cert()