💾 Archived View for gemi.dev › gemini-mailing-list › 000297.gmi captured on 2024-08-31 at 16:33:01. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-12-28)

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

Status Codes Question (Forbidden/Internal Server Error)

1. Caranatar (caranatar (a) riseup.net)

Hi folks, 

I came across Gemini a couple days ago when I was looking things up in 
preparation to write a gopher server for practice in a language I'm 
learning, and decided to crank out a Gemini server instead. I'll probably 
send an announce for the code and my server tomorrow, but in the meantime...

I have a pretty simple question that I wasn't able to find anywhere on the 
mailing list or elsewhere:

Are there equivalents to the forbidden and internal server error status 
codes in HTTP? Alternatively, what extant status codes would y'all 
recommend using to indicate those errors?

It's mostly for debugging sake, but I found myself wanting a way to say 
"oops! File permissions are screwed up!" or "oops! I wrote some bad code 
and there's an unexpected error somewhere". Right now I use 51 for 
permissions and 59 for a catch all error, but I feel like they're 
semantically different enough that it irks me to use them.

Thanks and look forward to talking with y'all more,

--Caranatar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.orbitalfox.eu/archives/gemini/attachments/20200716/98cc
8498/attachment.htm>

Link to individual message.

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

It was thus said that the Great Caranatar once stated:
> Hi folks, 

  Howdy.

> I have a pretty simple question that I wasn't able to find anywhere on the
> mailing list or elsewhere:
> 
> Are there equivalents to the forbidden and internal server error status
> codes in HTTP? Alternatively, what extant status codes would y'all
> recommend using to indicate those errors?

  It's there, but probably under a different subject line.  There's this
message I sent last year:

	gemini://gemi.dev/gemini-mailing-list/messages/000107.gmi

It's for running web-based CGI scripts under Gemini [1].  Here's the table I
presented:

        HTTP status     Gemini status
        ---------       --------
        200-299         20
        301             31
        300-399         30
        403             60
        404             51
        405             59
        400-499         50
        500-599         40
        000-999         50

> It's mostly for debugging sake, but I found myself wanting a way to say
> "oops! File permissions are screwed up!" or "oops! I wrote some bad code
> and there's an unexpected error somewhere". Right now I use 51 for
> permissions and 59 for a catch all error, but I feel like they're
> semantically different enough that it irks me to use them.

  What I do is use the most generic status code I can, and log (via syslog()
but use whatever mechanism works for you) the actual error to prevent
information from leaking out to a Gemini client.

  -spc

[1]	GLV-1.12556 [2] can run web-based SCGI/CGI scripts, and I had to set
	up a mapping of status values.

[2]	https://github.com/spc476/GLV-1.12556

Link to individual message.

---

Previous Thread: [ANN] Announcing gemcert, a simple certificate generator

Next Thread: The Transjovian Vault: moving my Wikipedia Proxy to a separate domain