httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 51517] mod_proxy_fcgi is not RFC 3875 compliant
Date Wed, 03 Dec 2014 20:46:40 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51517

--- Comment #13 from Stefan Rubner <stefan@whocares.de> ---
> apache code is a mess and as a consequence PHP-FPM code concerning fcgi
> variables is a mess too.

Actually, the main problem (as I see it) were two "thinkos" in the relevant
code. The first (as Eric mentions in his comment above) is that there's no
mapping to an actual handler/file extension when using mod_proxy_*.
And since there's no mapping, mod_proxy_* indeed has no way of determining
where the SCRIPT_NAME ends and the PATH_INFO starts.

My code fixes this by "assuming" that anything that contains a dot (".") has to
be a file name and thus marks the "handler". Consequently, everything after the
dot starting with a slash ("/") or a question mark ("?") is considered to be
the "PATH_INFO". While this is ugly and clearly a hack, it most certainly
reflects the reality on the vast majority of web sites out there. The cleaner
solution would be to go through to the list of defined handlers and check
whether on of those is present in the URL. However, I decided to sacrifice
thoroughness for speed in this particular case.

The second "thinko" can be found in util_script.c (I have another patch coming
up for that). Here the original idea obviously was to compare the request URI
against the PATH_INFO and use the result as SCRIPT_NAME. However, the author
seemingly overlooked that the URI passed to the function is already stripped of
the GET parameters while the PATH_INFO is not. So the comparison would always
fail and thus return a wrong SCRIPT_NAME.

> Since nobody from apache wants to take care of this problem I won't add more
> dirty tricks in PHP-FPM code. 

I see your point there, but in this case it would be just one line that would
need to be modified a bit if I remember correctly. I hacked support for
"proxy:balancer:"  into the PHP-FPM we're using so actually this was a request
for the benefit of other users, not for me.

> If you want to use PHP-FPM, stop using apache
> as it sucks and use nginx instead. It's simple, faster and has always been
> working as expected.

Actually I am using Nginx (which btw doesn't conform to RFC 3875 either) on
most of our servers. However, there are some edge cases where I need to use
Apache and for those cases it would be nice to be able to use
mod_proxy_balancer instead of libphp5. That's why I worked on this issue. I
posted my solution to your issue so others can profit from it even in the more
than likely case that the Apache project will reject the patches ;)

> good luck with your patch because after developping you'll have to submit it
> to the apache project. Maybe it'll be done before 2020 :-)

As said above I don't really care whether my patches are included into a
project or not. I just want to make them available so others can use them if
they want to.

-Stefan

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message