README.gmi 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Size parameter extension
  2. From: Marek Küthe (m.k@mk16.de)
  3. Last updated: 29.08.2022
  4. ## 1. Overview
  5. ### 1.1 Motivation
  6. The Gemini protocol can be used to deliver files. In contrast to Gopher, there is no line with a dot to indicate the end of a transfer. Therefore, it can happen that only parts of large files are transferred. This can happen especially with unstable or slow connections. One way to prevent this is to pass the length of the content as meta information to the client.
  7. ## 2. Extension
  8. When a file is successfully delivered from a Gemini server, it returns a 2x status code. The meta information returned is the mimetype with some other parameters. These parameters are currently described in paragraph 3.3 and 5.2 of the Gemini specification.
  9. This extension introduces the new parameter `size`. This specifies the length in bytes of the file that will be delivered.
  10. ## 2.1 Client support
  11. This extension is optional and not mandatory. Gemini clients that do not support this extension can ignore the parameter. Thus, it is possible that a server supports the extension, but the client does not.
  12. Note: A test with the popular Lagrange client showed that it simply ignores unknown parameters.
  13. ## 2.2 Long life connections
  14. It can happen that you want to open a page with the Gemini protocol as a kind of stream. The server keeps the connection open and sends new data sporadically. The client should not close the connection. In this case the parameter `size` can be set to a negative number, typically `-1`.
  15. ## 3. Example
  16. A client requests a file from server:
  17. ```
  18. gemini://gemini.example.com/mybib.bin
  19. ```
  20. The server responds and specifies the size of the file:
  21. ```
  22. 20 application/octet-stream; size=1073741824
  23. <... some binary data ...>
  24. ```
  25. ## 4. See also
  26. => gemini://twins.rocketnine.space/proposals.gmi