durusmail: quixote-users: Inconsistency between mod_scgi behavior and published scgi protocol?
Inconsistency between mod_scgi behavior and published scgi protocol?
2008-06-23
Inconsistency between mod_scgi behavior and published scgi protocol?
Inconsistency between mod_scgi behavior and published scgi protocol?
2008-06-23
2008-06-24
Inconsistency between mod_scgi behavior and published scgi protocol?
Al Pacifico
2008-06-23
On Mon, Jun 23, 2008 at 3:14 PM, Neil Schemenauer  wrote:

> Al Pacifico  wrote:
> > I've been writing a SCGI server program in C (for use as a web service)
> and
> > while testing, I came across the following when fetching the URL '
> > http://localhost/dynamic': mod_scgi passes a SCGI header with name
> > QUERY_STRING and an empty value (i.e. name NUL  NUL).
>
> I'm not sure what is specified by the HTTP RFC but the vast majority
> of web sites, AFAIK, treat an emtpy query string the same as no
> query string.  The behavior of mod_scgi is the same as mod_cgi in
> regards to QUERY_STRING.  If you really want to distinguish between
> no query string and an empty query string, I guess you could look


You raise an interesting point! Previously, I thought empty query string and
no query string would be synonymous, that the query string is just the part
of the URL following '?'. Fetching
'http://localhost/dynamic?',
mod_scgi sends the same SCGI request as when fetching '
http://localhost/dynamic' as I would have expected.


>
> for a '?' character in REQUEST_URI.
>

> > I wonder if mod_scgi should be modified. I think mod_scgi should
> > omit the query string header if there is no query string.
>

I pretty much took the SCGI specification as gospel and was surprised when I
saw this behavior. My inexperience with CGI is showing. I've rarely used
CGI, having used mod_perl and mod_scgi/Quixote for the most part. It's no
big deal to change my code to accept empty values... just didn't want to
make a mistake I'd later regret.

I don't mean to nitpick, but shouldn't the SCGI protocol specification state
that an empty value in the header is acceptable, then?

Currently, http://python.ca/scgi/protocol.txt describes the header as BNF:

    A request consists of a number of headers and a body.  The format of
    the headers is:

        headers ::= header*
        header ::= name NUL value NUL
        name ::= notnull+
        value ::= notnull+
        notnull ::= <01> | <02> | <03> | ... | 
        NUL = <00>



>
> I don't think so.  That behavior would be surprising to people
> coming from other systems.  Is there some use case you foresee?


I don't foresee one, but don't feel experienced enough to know that there
isn't one. It's easy to understand how changing mod_scgi could break
existing code, but on the other hand, when writing a backend, one usually
has some knowledge of the frontend and what to expect.


>
> Regards,
>
>  Neil
>

Thanks so much. I will make a change to my code to allow empty values for
fields in the header and call it good.
-al

>
> _______________________________________________
> Quixote-users mailing list
> Quixote-users@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/quixote-users
>



--
Al Pacifico
Seattle, WA
reply