Closed (duplicate)
Project:
Drupal core
Version:
6.2
Component:
forms system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 Oct 2010 at 13:52 UTC
Updated:
26 Oct 2015 at 12:04 UTC
Jump to comment: Most recent
Comments
Comment #1
applepie commentedHi,
I got exactly the same problem with 6.20
If you have any suggestion to fix the problem I would be happy to hear it.
Comment #2
applepie commentedhi,
I narrowed the problem to theme_form($element) in file:form.inc.
The input parameter $element['#action'] has /http://.....
Some other part of the program ( I don't exactly know where) called this function and pass an illegal parameter with the leading slash.
I don't know how to find the root cause but manage to apply a band-aid to theme_form function to get rid of the leading slash that caused the problem.
Here is my fix. Hope it is useful for others. Please let me know if there is a better method.
function theme_form($element) {
// Anonymous div to satisfy XHTML compliance.
if (strncmp($element['#action'],'/http:/',7)==0) // this added to remove unwanted leading slash.
{
$element['#action'] = substr($element['#action'],1);
}
$action = $element['#action'] ? 'action="'. check_url($element['#action']) .'" ' : '';
return '
KC
Comment #3
morgan_jennevret commentedI have this same issue in 6.22. I have found the root cause is in bootstrap.inc request_uri() when using Apache server (at least, it's all I have tried).
When a request comes using a full URL such as
GET http://www.example.com/ HTTP/1.0
instead us the expected
GET / HTTP/1.0
That gives the environment variable $_SERVER["REQUEST_URI"] the absolute URL instead of the expected relative-to-root.
function request_uri() {
if (isset($_SERVER['REQUEST_URI'])) {
$uri = $_SERVER['REQUEST_URI'];
}
.......
$uri = '/'. ltrim($uri, '/');
return $uri;
}
Comment #4
Anonymous (not verified) commentedAs a newcomer to Drupal, I was surprised to find such an old post for a problem that I have only recently encountered with both Drupal 6 and Drupal 7 on Windows 7.
I could use the front-end without any trouble, and the back-end administrator pages were fine when used for display only. But when I tried to update any content or config I was presented with a error message similar to "Forbidden You don't have permission to access / on this server". I took this to be a server configuration issue, but I couldn't find one. I also checked database permissions, but nothing awry there.
Then I chose to inspect the code behind the troublesome form, and found the leading slash mentioned by debaetsr. Another search online lead me to this post. From which Capt. Morgan's reference to the bootstrap.inc helped me to find a solution to an irksome problem. And it's quite simple.
Replace
$uri = '/'. ltrim($uri, '/');
by
$uri = preg_replace("/^(\/){1,}/", '/', $uri);
This caters for any number of leading slashes, and works for both relative and absolute paths.
Both Drupal installations on my Windows 7 laptop now work as required. (Windows 7, Apache 2.0.63, PHP 5.3.5, MySQL 5.0.7.)
Comment #5
gaele commented#677958: Invalid REQUEST_URI construnction in request_uri - Fails when using reverse proxy