Count redirects in black box recorder.
This commit is contained in:
parent
480f2cc15f
commit
67729fb711
3
av98.py
3
av98.py
|
@ -289,6 +289,7 @@ class GeminiClient(cmd.Cmd):
|
|||
"reset_connections": 0,
|
||||
"timeouts": 0,
|
||||
"cache_hits": 0,
|
||||
"redirects_followed": 0
|
||||
}
|
||||
|
||||
self.tofu_store = TofuStore(self.config_dir)
|
||||
|
@ -450,6 +451,7 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
|
|||
ui_out.debug("Following redirect to %s." % new_gi.url)
|
||||
ui_out.debug("This is consecutive redirect number %d." % len(previous_redirectors))
|
||||
previous_redirectors.add(gi.url)
|
||||
self.log["redirects_followed"] += 1
|
||||
if status == "31":
|
||||
# Permanent redirect
|
||||
self.permanent_redirects[gi.url] = new_gi.url
|
||||
|
@ -1417,6 +1419,7 @@ current gemini browsing session."""
|
|||
lines.append(("Refused connections:", self.log["refused_connections"]))
|
||||
lines.append(("Reset connections:", self.log["reset_connections"]))
|
||||
lines.append(("Cache hits:", self.log["cache_hits"]))
|
||||
lines.append(("Redirects followed:", self.log["redirects_followed"]))
|
||||
# Print
|
||||
for key, value in lines:
|
||||
print(key.ljust(24) + str(value).rjust(8))
|
||||
|
|
Loading…
Reference in New Issue