💾 Archived View for gemi.dev › gemini-mailing-list › 000566.gmi captured on 2024-08-31 at 17:35:02. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-12-28)

-=-=-=-=-=-=-

[spec] adding a "magic number" for gemini files

1. cage (cage-dev (a) twistfold.it)

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.

Link to individual message.

2. Solderpunk (solderpunk (a) posteo.net)

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

Link to individual message.

3. Petite Abeille (petite.abeille (a) gmail.com)



> 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?


Link to individual message.

4. cage (cage-dev (a) twistfold.it)

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.

Link to individual message.

5. Sean Conner (sean (a) conman.org)

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

Link to individual message.

6. cage (cage-dev (a) twistfold.it)

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.

Link to individual message.

7. Sean Conner (sean (a) conman.org)

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

Link to individual message.

8. cage (cage-dev (a) twistfold.it)

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.

Link to individual message.

---

Previous Thread: [spec] <URL> is a UTF-8 erratum

Next Thread: [user] psa: killfile