On 2016-04-14 Tim Baumgard <open...@bmgrd.com> wrote:
> According to convention and httpd.conf(5), the $DOCUMENT_URI macro for
> FastCGI calls should expand to the request path instead of the path
> alias.

FastCGI / CGI is poorly documented. As far as convention goes, at least
nginx uses the rewritten url, too:

$document_uri
    same as $uri 

$uri
    current URI in request, normalized

    The value of $uri may change during request processing, e.g. when
    doing internal redirects, or when using index files.

This behavior has the effect that the CGI script will know the
"canonical" url of the requested ressource, not an alias that the
client happened to request. We call the rewritten, canonical url "alias"
in our code, so that might be confusing.

If you still think httpd is showing unwanted behaviour, please provide
an example.

> This isn't a major issue because only "block return code uri"
> options make use of path aliases at the moment, and those use a
> separate macro-expansion function, server_expand_http(), which
> correctly expands $DOCUMENT_URI.
> 
> Index: server_fcgi.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/httpd/server_fcgi.c,v
> retrieving revision 1.67
> diff -u -p -r1.67 server_fcgi.c
> --- server_fcgi.c     23 Nov 2015 20:56:15 -0000      1.67
> +++ server_fcgi.c     14 Apr 2016 03:41:30 -0000
> @@ -254,7 +254,7 @@ server_fcgi(struct httpd *env, struct cl
>               errstr = "failed to encode param";
>               goto fail;
>       }
> -     if (fcgi_add_param(&param, "DOCUMENT_URI", alias,
> +     if (fcgi_add_param(&param, "DOCUMENT_URI", desc->http_path,
>           clt) == -1) {
>               errstr = "failed to encode param";
>               goto fail;
> 



-- 
http://gmerlin.de
OpenPGP: http://gmerlin.de/christopher.pub
2779 7F73 44FD 0736 B67A  C410 69EC 7922 34B4 2566

Attachment: pgphn3GpSMWJ_.pgp
Description: OpenPGP digital signature

Reply via email to