Pass extra information to _handle_cert_request
This fixes a bug introduced in f45630 when handling a certificate request was factored out of _fetch_over_network. Also make the options consistent in terms of grammar.
This commit is contained in:
parent
265a69a6ed
commit
92da876795
10
av98.py
10
av98.py
|
@ -484,7 +484,7 @@ you'll be able to transparently follow links to Gopherspace!""")
|
||||||
|
|
||||||
# Client cert
|
# Client cert
|
||||||
elif status.startswith("6"):
|
elif status.startswith("6"):
|
||||||
self._handle_cert_request(meta)
|
self._handle_cert_request(meta, status, gi.host)
|
||||||
return self._fetch_over_network(gi)
|
return self._fetch_over_network(gi)
|
||||||
|
|
||||||
# Invalid status
|
# Invalid status
|
||||||
|
@ -700,7 +700,7 @@ you'll be able to transparently follow links to Gopherspace!""")
|
||||||
for _, filename in self.cache.values():
|
for _, filename in self.cache.values():
|
||||||
assert os.path.isfile(filename)
|
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
|
# 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
|
# it could be used to fill up the disk by creating a whole lot of
|
||||||
|
@ -719,7 +719,7 @@ you'll be able to transparently follow links to Gopherspace!""")
|
||||||
print("The server did not accept your certificate.")
|
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.")
|
print("You may need to e.g. coordinate with the admin to get your certificate fingerprint whitelisted.")
|
||||||
else:
|
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.")
|
print("This will allow the site to recognise you across requests.")
|
||||||
|
|
||||||
# Give the user choices
|
# Give the user choices
|
||||||
|
@ -727,8 +727,8 @@ you'll be able to transparently follow links to Gopherspace!""")
|
||||||
print("1. Give up.")
|
print("1. Give up.")
|
||||||
print("2. Generate a new transient certificate.")
|
print("2. Generate a new transient certificate.")
|
||||||
print("3. Generate a new persistent certificate.")
|
print("3. Generate a new persistent certificate.")
|
||||||
print("4. Load a previously generated persistent.")
|
print("4. Load a previously generated certificate.")
|
||||||
print("5. Load certificate from an external file.")
|
print("5. Load a certificate from an external file.")
|
||||||
choice = input("> ").strip()
|
choice = input("> ").strip()
|
||||||
if choice == "2":
|
if choice == "2":
|
||||||
self._generate_transient_cert_cert()
|
self._generate_transient_cert_cert()
|
||||||
|
|
Loading…
Reference in New Issue