[PATCHv2] httpd: don't drop QUERY_STRING when /cgi-bin/index.cgi is used

Denys Vlasenko vda.linux at googlemail.com
Mon Dec 19 01:45:07 UTC 2011


On Sunday 18 December 2011 21:57, Peter Korsgaard wrote:
> >>>>> "Denys" == Denys Vlasenko <vda.linux at googlemail.com> writes:
> 
> Hi,
> 
>  Denys> I propose to move it to the site of aforementioned appending:
> 
>  Denys> This way, it's more obvoius, and only done when needed (=> only
>  Denys> for dirs).
> 
> Yes, that makes sense.
> 
>  Denys> However, there is another problem. Check
>  Denys> /usr/srcdevel/bbox/fix/busybox.3/networking/httpd_indexcgi.c
>  Denys> See how it is determining _which directory_ to list.
>  Denys> It looks at $QUERY_STRING.
> 
>  Denys> IOW: "g_query = urlcopy;" assignment you nuked wasn't a quick fix
>  Denys> for "query string is overwritten" bug. It was a way to give
>  Denys> cgi-bin/index.cgi a way to find the directory it is meant to list.
> 
> Ahh, I didn't know that. I do find the
> pass-original-request-in-QUERY_STRING quite nonstandard and limiting
> (E.G. it means you cannot easily support Apache-style selectable
> directory sorting by DIR/?..). I personally don't use the
> /cgi-bin/index.cgi fallback for directory listing, but simply to have a
> nicer looking URL for the main (CGI based) webpage, without having to
> mess with a dummy index.html and a HTML level redirect.
> 
> I think a better approach would be to let REQUEST_URI be the original
> (DIR/) location requested, and then leave QUERY_STRING for arguments
> like normal. Alternatively we could add SCRIPT_URL, which seems to be
> what Apache's mod_rewrite provides:
> 
> https://httpd.apache.org/docs/current/mod/mod_rewrite.html#EnvVar

Both look sensible to me. Pick whatever solution you like.

Please change networking/httpd_indexcgi.c correspondingly (and test it).

-- 
vda


More information about the busybox mailing list