It appears that $REQUEST_URI doesn't actually work quite right yet:

* Connected to www.openbsd.org (129.128.5.194) port 80 (#1)
> GET /cgi-bin/man.cgi?query=test&sektion= HTTP/1.1
> User-Agent: curl/7.26.0
> Host: www.openbsd.org
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 301 Moved Permanently
< Date: Thu, 12 May 2016 16:59:28 GMT
< Server: OpenBSD httpd
< Connection: close
< Content-Type: text/html
< Content-Length: 443
< Location: http://man.openbsd.org/cgi-bin/man.cgi?query=test%26sektion=
<
* Closing connection #1



It looks like it's because the query gets URL encoded:

http://bxr.su/o/usr.sbin/httpd/server_http.c#server_expand_http

986    if (strstr(val, "$REQUEST_URI") != NULL) {
987        if ((path = url_encode(desc->http_path)) == NULL)
988            return (NULL);
989        if (desc->http_query == NULL) {
990            str = path;
991        } else {
992            if ((query = url_encode(desc->http_query)) == NULL) {
993                free(path);
994                return (NULL);
995            }
996            ret = asprintf(&str, "%s?%s", path, query);



I think it is incorrect to ever encode it (happens in a few other
places, too), because it doesn't appear that it ever gets decoded from
the URL format in the first place.


Cheers,
Constantine.SU.


On 12 May 2016 at 06:48, Bob Beck <b...@openbsd.org> wrote:
> CVSROOT:        /cvs
> Module name:    www
> Changes by:     b...@cvs.openbsd.org    2016/05/12 07:48:55
>
> Modified files:
>         .              : ftp.html
> Added files:
>         .              : httpd.conf
>
> Log message:
> Add a suggested httpd.conf configuration for mirrors, to
> encourage not screwing up mime types and other things

Reply via email to