Re: TLS in Gopher
Hi,
On 01/03/18 07:18, Alex Schroeder wrote:
> Perhaps I'm wrong and it is in fact trivially easy? Can somebody post
> some sample code, a few lines maybe, illustrating how it would work in a
> simple Gopher server?
Accept connection
Read a few bytes, enough to know if it's a TLS client hello
If it's TLS:
Hand over to TLS library
If it's not TLS:
Handle the query directly
This is not that hard.
In Python you would use the socket.MSG_PEEK option on a recv() call to
take a look at those bytes before passing it off to a TLS library or
handling the request directly.
Thanks,
Iain.
Reply to: