[PATCH] Defined REQUEST_URI on Microsoft IIS servers

Micah Cowan micah at cowan.name
Wed Oct 31 10:59:46 CDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Ezra.Smith at bentley.com wrote:
> Apologies for the spam. Outlook seems quite adamant about formatting my
> 
> emails after I've hit the send button. This one really should be clean,
> though.

It's not really, though.

The plaintext version is double-spaced, so it really depends on how well
people's mailers can copy/paste the HTML version, and whether the NBSPs
get copied literally or translated into normal spaces, etc.

Best is to send patches as attachments if you have formatting problems
(ideally with an inline disposition).

I'm not a Mercurial developer; but this patch doesn't look entirely
appropriate to me: it doesn't seem at all appropriate that you set both
REQUEST_URI and PATH_INFO to the same value, and a value which is
incorrect for the canonically expected value for PATH_INFO. Your patch
claims to set REQUEST_URI, but it does more than that, it changes
PATH_INFO as well, and I don't see a reason for that. And the value it
sets REQUEST_URI to isn't a complete URI; other code might reasonably
expect it to be. We should keep CGI variables at sane values, so that
modules don't find themselves in a strange, unexpected (and
undocumented) runtime environment.

To properly generate REQUEST_URI from actual environment variables,
you'd need something like (borrowed from current CGI 1.2 draft spec:)

protocol "://" SERVER_NAME ":" SERVER_PORT enc-script
               enc-path-info "?" QUERY_STRING

Where protocol is derived from SERVER_PROTOCOL, and enc-script and
enc-path-info are percent-encoded equivalents to SCRIPT_NAME and
PATH_INFO. The question mark of course should be omitted if QUERY_STRING
is empty.

Also, rather than check explicitly for Microsoft IIS, I suspect it'd be
preferable to check for the lack of a REQUEST_URI. That doesn't seem to
be a CGI variable (at least, I can't find it in the spec:
http://hoohoo.ncsa.uiuc.edu/cgi/env.html; nor in the draft spec), so
odds are good IIS isn't the only server to lack support for it.

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHKKZx7M8hyUobTrERCHgNAJ0dP9FOb+KOvKZZ8dyUHTkvjftBOQCbBC9H
OQsVGSvLnih89ZdthQ8hhH8=
=9nCs
-----END PGP SIGNATURE-----


More information about the Mercurial-devel mailing list