Don't send a QUERY_STRING header to (S)CGI applications when a query was not present in the original URL #15

Closed
opened 2020-12-01 20:10:26 +00:00 by Alch-Emi · 2 comments

Currently, and request to molly brown is forwarded to any (S)CGI applications with a QUERY_STRING header. When no query string was present on the original request, this value is simply an empty string.

gemini://example.com/
becomes
PATH_INFO ""
QUERY_STRING ""

gemini://example.com/?
becomes
PATH_INFO ""
QUERY_STRING ""

gemini://example.com/?hello
becomes
PATH_INFO ""
QUERY_STRING "hello"

This makes it quite difficult to tell the difference between receiving an empty input from the user and receiving no input from the user. This becomes important when processing an input route, since an application would need to check to see if an input was received before deciding to process that input or send an 1X response.

This can be worked around by treating an empty input as no input, but this is slightly unintuitive, and prevents the application from receiving an empty input, which some users way want.

Currently, and request to molly brown is forwarded to any (S)CGI applications with a `QUERY_STRING` header. When no query string was present on the original request, this value is simply an empty string. ``` gemini://example.com/ becomes PATH_INFO "" QUERY_STRING "" gemini://example.com/? becomes PATH_INFO "" QUERY_STRING "" gemini://example.com/?hello becomes PATH_INFO "" QUERY_STRING "hello" ``` This makes it quite difficult to tell the difference between receiving an empty input from the user and receiving no input from the user. This becomes important when processing an input route, since an application would need to check to see if an input was received before deciding to process that input or send an `1X` response. This can be worked around by treating an empty input as no input, but this is slightly unintuitive, and prevents the application from receiving an empty input, which some users way want.
Author

Update: I just checked the spec on this, and while I still think it would be easier if it were optional, the official spec has this to say:

The server MUST set this variable; if the Script-URI does not include a query component, the QUERY_STRING MUST be defined as an empty string ("").

So if this were a change to be made, we'd probably need some formal Gemini sub-spec of the CGI spec.

Given that, I'm going to close this issue for now.

Update: I just checked the spec on this, and while I still think it would be easier if it were optional, [the official spec](https://tools.ietf.org/html/rfc3875#section-4.1.7) has this to say: > The server MUST set this variable; if the Script-URI does not include a query component, the QUERY_STRING MUST be defined as an empty string (""). So if this were a change to be made, we'd probably need some formal Gemini sub-spec of the CGI spec. Given that, I'm going to close this issue for now.
Author

As a standin, it might be worth setting the semi-standard GEMINI_URL header, which clients could check for the presence of a query string, but I think that would be a seperate issue

As a standin, it might be worth setting the semi-standard `GEMINI_URL` header, which clients could check for the presence of a query string, but I think that would be a seperate issue
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: solderpunk/molly-brown#15
No description provided.