Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Dec 2008 at 23:34 UTC
Updated:
21 Dec 2015 at 13:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
hass commentedAnd the D7 patch for the tests :-).
Comment #2
hass commentedI'm not yet sure if we also need to set
$_GET['q']indrupal_init_path()to the same value, but globalredirect works now without endless loops.Aside, this is a follow up of #166095: IIS <=6 with ISAPI_ Rewrite & clean_url ends with endless loop.
Comment #3
nicholasthompsonThose patches look sensible enough to me...
Just a thought... instead of:
Why not just set
$uriand do an "elseif" like this...At least this way, we're not buggering about with the $_SERVER array which *might* cause unexpected behaviour in modules designed to work with IIS, but at the same time we're still returning the correct (aka wanted) value from request_url...
Any thoughts?
Comment #4
nicholasthompsonSomething like this....
Comment #5
hass commentedI think we should provide the same value in $_SERVER['REQUEST_URI'] on all webservers if possible. Here with my solution this is possible and we make IIS acting like Apache what is really the best solution.
Comment #6
damien tournoud commentedIt's really easy to forge a HTTP_X_REWRITE_URL, so this obviously needs some work.
Please also see #298016: No query string added to form action attribute on IIS 7 so some context about how this works in IIS7.
Comment #7
hass commentedCould you please bring some light to us? I have no idea what you are talking about - if the path a user entered in a browser cannot found we give a 404 page back. It is only the called URL you get from this variable. Apache also gives you this URL in $_SERVER['REQUEST_URI']. If there could something be "forged" - it can be on all servers including Apache.
Comment #8
hass commentedPatch in linked issue of #6 looks 100% same like patches in #4. Setting back status.
Comment #9
damien tournoud commentedI already noted that it's easy to forge anything in HTTP_X_REWRITE_URL, at least when running a website on Apache. So REQUEST_URL should either takes precedence or a strict condition that checks for ISAPI_Rewrite be added to HTTP_X_REWRITE_URL.
Comment #10
hass commented@Damien: I think we cannot change the order of the "if" as REQUEST_URL is also set on IIS, but contains something we don't need and that produces the endless loop in globalredirect. So the order need to be as - first check if HTTP_X_REWRITE_URL exists - if not use Apache's REQUEST_URL.
Please provide detailed information how this can be forged.
Comment #11
nicholasthompsonI've googled and cant find anything... In fake googling for the phrase "
how to forge HTTP_X_REWRITE_URL" brings this post up as the number 1 result for me ;-)Claiming that it can easily be forged and yet there being nothing in the google index about it kind of implies an exaggerated claim... Can you enlighten us please.
Comment #12
damien tournoud commented@hass, nicholasThompson: the "HTTP_*" values are assigned by PHP using the request headers from the client, without any verification.
It's easy to pass a "X-Rewrite-Url: stuff" value to the server, and this value will be assigned to HTTP_X_REWRITE_URL.
You will need to add server type sniffing if you want to put the HTTP_X_REWRITE_URL test in front.
Comment #13
hass commentedNew patches attached.
Comment #14
dries commentedThe patch looks good, and should prevent the forging problem.
1. Looking at the code, I'd still be tempted to switch the if-statements so the 'normal' statement is in the fast code path. Apparently, that is not possible, however, that wasn't clear from the code comments. Might be useful to extend the code comments so that we remember this.
2. 'For more information ...' should not start on a new line.
Comment #15
hass commented@Dries: Are you able to provide some feedback if you'd like to follow the Helicon recommendation to set
$_SERVER['REQUEST_URI'](see #1) that would allow us to provide 100% compatibility with Apache on IIS or the variant in #13? I'm not sure what nicholasThompson said about unexpected behaviour with setting $_SERVER variables, but I would like to have the same values in all variables nevertheless it's a $_SERVER variable. I'm not a strong fan of #13.After we have a clear decision about this I will re-role with your suggestions.
Comment #16
effulgentsia commented@hass: Is this still stuck on needing feedback from Dries, or has something changed in the last 3 years that should be reflected here first?
Also, if anyone here can help provide info for #1547294: Documentation for request_uri() incorrectly says that only Apache provides $_SERVER['REQUEST_URI'], I'd appreciate it. Thanks.
Comment #17
dawehnerSee https://www.drupal.org/node/1547310#comment-10643716