Re: Gopher over TLS

Sebastiaan Deckers <[email protected]>
Newsgroups gmane.network.gopher.general
Message-ID <CADVGGb-uJcQ=ePqX1Zre_GvdoGZ9uM0AEbAMwgMBoGs26AphSg@mail.gmail.com>
On Sat, Mar 14, 2020 at 7:28 AM James Tomasino <[email protected]> wrote:

> gopher://cosmic.voyage serves TLS on port 7070. Previous discussions had
> some people suggesting port 7443, 7000, or 71. A server that serves over
> port 70 is likely to break things for non TLS clients.
>

A server that supports both TLS and plaintext can auto-detect the client's
support.

Two methods:
A. Detect TLS: First byte of ClientHello is 0x16 -> process packet as TLS
handshake (bytes 2-3 are the TLS version IIRC)
B. Detect plaintext: First TCP packet ends with `\r\n` -> process packet as
plaintext Gopher request

Proof: I have implemented and deployed method B. Feel free to send both
plaintext or TLS handshakes to commons.host:70 (multi-homed with GeoDNS but
all nodes running the same code)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.