Skip to content

Commit

Permalink
Improve debugging
Browse files Browse the repository at this point in the history
- Print DEBUG_IO OUT as repr (in case it's binary).
- Log the hostname in case of unknown SNI request.
  • Loading branch information
arnout committed Feb 27, 2021
1 parent acebb94 commit 685f1b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pagekite/proto/conns.py
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,7 @@ def ProcessTls(self, data, domain=None):
self.conns.SetIdle(self, 120)
return True
else:
self.LogInfo("TLS unknown SNI host %s" % domains[0])
self.Send(TLS_Unavailable(unavailable=True), try_flush=True)
return False

Expand Down
2 changes: 1 addition & 1 deletion pagekite/proto/selectables.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def Send(self, data, try_flush=False, activity=False,
sent = self.fd.send(send_buffer)
if logging.DEBUG_IO:
print(('==> OUT =[%s: %d/%d bytes]==(\n%s)=='
) % (self, sent, send_bytes, send_buffer[:min(320, sent)]))
) % (self, sent, send_bytes, repr(send_buffer[:min(320, sent)])))
self.wrote_bytes += sent
break
except (SSL.WantWriteError, SSL.WantReadError) as err:
Expand Down

0 comments on commit 685f1b2

Please sign in to comment.