💾 Archived View for gem.graypegg.com › gor › connections captured on 2023-04-26 at 12:55:54. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
represent the current connection to the client, and are generally something you won't have to deal with except inside implementations of Persistent#on_conncetion.
conn.request
The request from the client, as parsed by Ruby's URI module. Gemini clients only send a URI to servers, so this is all the information we have about the client.
conn.body = 'Hi'
conn.body
Sets or gets the current body that will be sent when this transaction completes. The body can be anything textual, but no binary data is allowed.
conn.mime_type = 'text/plain'
conn.mime_type
Sets or gets the current body that will be sent when this transaction completes. The body can be anything textual, but no binary data is allowed.
conn.status = 51
conn.status
Sets or gets the current Gemini status code that will be sent when this transaction completes. This should be an integer.
See Gemini spec, Section 3.2 Status codes
conn.send
Sends the current body + status for this connection to the client, and closes the connection. Note that you can only send once, and future calls to send on this connection will do nothing. This allows you to stub connections in a presistent if you'd like.
conn.started_at
Timestamp of when this connection was initially processed. It's a standard Ruby Time object
conn.source_ip
The originating IP for this connection in a string. Useful for IP blocking.