Iapetus (eye-app-etus) is a sister protocol for Gemini influenced by Titan (hence the name, another moon of Saturn). Whereas Titan is meant to be used mainly without client certificates Iapetus keeps them mandatory and follows the Gemini protocol pattern more closely.
In the same format as the Gemini documentation:
C: Opens connection to the host eg.
S: Accepts connection
C/S: Complete TLS handshake
C: Validates server certificate
C: Sends file upload intent data (one CRLF terminated line) (see File Intent below)
S: Sends response header (one CRLF terminated line), under non-success conditions closes connection (see Initial Response below)
C: Sends file data
S: Sends response header (one CRLF terminated line) (See Confirmation below)
C: Handles response
This follows the same pattern as Gemini, the client and server do the usual Gemini TLS checks, but where in Gemini the client now writes the uri of the entity it's requesting, in Iapetus the client writes it's file intent:
iapetus://oppen.digital/memex/posts/mu/filename.gmi 123\r\n - the full file path followed by the filesize in bytes.
Once the server has the file intent it can choose to accept or deny. If the client certificate is authorised to upload the server responds with a continue line:
10 Continue\r\n, if the client certificate is missing or not recognised the server responds with an error line and closes the socket:
60 Invalid certificate\r\n or
60 Client certificate required\r\n, or for muti-user servers possibly:
50 You are not authorised to create a file outside of /~oppen/\r\n
When the client has sent the file data successfully the server completes the transaction before closing the connection:
20 Success\r\n, or for an error:
50 Error writing file: some exception\r\n
- How to handle directory creation, maybe
iapetus://oppen.digital/new/folder/path/ 0\r\nis enough