💾 Archived View for gemi.dev › gemini-mailing-list › 000566.gmi captured on 2024-06-16 at 13:44:36. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-12-28)
-=-=-=-=-=-=-
Hi! I think a lot of guesswork is needed (line finding link lines with gemini scheme?), for example, to discriminate between markdown and gemini file format. I wonder if a magic number (three, maybe four chars?) could be added on the first line of each file. Bye! C.
On Sat Dec 26, 2020 at 4:32 PM CET, cage wrote: > I think a lot of guesswork is needed (line finding link lines with > gemini scheme?), for example, to discriminate between markdown and > gemini file format. When is this really necessary? Both Gemini and HTTP provide a means to inform the client what's coming down the pipe. For files distributed otherwise, filename conventions would seem to do the trick. > I wonder if a magic number (three, maybe four chars?) could be added > on the first line of each file. This feels like too much complexity for too little benefit to me. Plenty of people write their text/gemini content by hand with a standard text editor. Many of them will forget to add the magic number. What should a client do when it receives a file which the server declares as text/gemini but which doesn't have the magic number? This creates more questions/problems than it solves. Cheers, Solderpunk
> On Dec 26, 2020, at 16:32, cage <cage-dev at twistfold.it> wrote: > > I wonder if a magic number (three, maybe four chars?) could be added > on the first line of each file. No*. We still pay the price for that BOM abomination. No need to double down. That said, there are other signs, such as link sequences '=> '. Otherwise, text/gemini is, rightly, identified as text/plain;charset=utf-8;. Why do you need more?
On Sat, Dec 26, 2020 at 04:34:25PM +0100, Solderpunk wrote: > On Sat Dec 26, 2020 at 4:32 PM CET, cage wrote: > > > I think a lot of guesswork is needed (line finding link lines with > > gemini scheme?), for example, to discriminate between markdown and > > gemini file format. > > When is this really necessary? Both Gemini and HTTP provide a means to > inform the client what's coming down the pipe. For files distributed > otherwise, filename conventions would seem to do the trick. I was thinking abot file(1) and libmagic in general. > > I wonder if a magic number (three, maybe four chars?) could be added > > on the first line of each file. > > This feels like too much complexity for too little benefit to me. > Plenty of people write their text/gemini content by hand with a standard > text editor. Many of them will forget to add the magic number. What > should a client do when it receives a file which the server declares as > text/gemini but which doesn't have the magic number? This creates more > questions/problems than it solves. Anyway i agree this was a silly proposal, thank you for you reply! :) Bye! C.
It was thus said that the Great cage once stated: > On Sat, Dec 26, 2020 at 04:34:25PM +0100, Solderpunk wrote: > > On Sat Dec 26, 2020 at 4:32 PM CET, cage wrote: > > > > > I think a lot of guesswork is needed (line finding link lines with > > > gemini scheme?), for example, to discriminate between markdown and > > > gemini file format. > > > > When is this really necessary? Both Gemini and HTTP provide a means to > > inform the client what's coming down the pipe. For files distributed > > otherwise, filename conventions would seem to do the trick. > > I was thinking abot file(1) and libmagic in general. I use libmagic for my server [1] and yet, I still use an extension to mark a Gemini text file. -spc [1] https://github.com/spc476/GLV-1.12556
On Sat, Dec 26, 2020 at 06:25:43PM -0500, Sean Conner wrote: [...] > > I was thinking abo[u]t file(1) and libmagic in general. > > I use libmagic for my server [1] and yet, I still use an extension to mark > a Gemini text file. Do you mean you check the file extension for recognize a gemini file? Or you use same kind of heuristic to prevent libmagic to returns gemini file as text? Bye! C.
It was thus said that the Great cage once stated: > On Sat, Dec 26, 2020 at 06:25:43PM -0500, Sean Conner wrote: > > [...] > > > > I was thinking abo[u]t file(1) and libmagic in general. > > > > I use libmagic for my server [1] and yet, I still use an extension to mark > > a Gemini text file. > > Do you mean you check the file extension for recognize a gemini file? > Or you use same kind of heuristic to prevent libmagic to returns > gemini file as text? In the configuration file, the user can specify a mapping of extensions to MIME type, to which the default extension type that identifies a Gemini index file is added (which for my server is ".gemini" but that can be changed). During a request, the extension is checked against this mapping. If (for a non-Gemini file) this doesn't exist, only then is libmagic queried. -spc
On Sun, Dec 27, 2020 at 05:18:08PM -0500, Sean Conner wrote: [...] > > In the configuration file, the user can specify a mapping of extensions to > MIME type, to which the default extension type that identifies a Gemini > index file is added (which for my server is ".gemini" but that can be > changed). > > During a request, the extension is checked against this mapping. If (for > a non-Gemini file) this doesn't exist, only then is libmagic queried. > > -spc Crystal clear, thank you! :) C.
---