Autocomplete, trailing space, Apache configuration
Hi,
I tried to find any solution to my problem for last two days, but I'm stuck. No idea how to solve problem.
The problem is following:
Lets have an autocomplete function like that
function entities_ac ($string) {
$matches = array();
if ($string) {
$matches = ... get array of strings ...
}
drupal_json($matches);
}and the function is connected to entities/entities_ac in the menu by
$items['entities/entities_ac'] = array(
'title' => 'Entities autocomplete',
'page callback' => 'entities_ac',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);Everything works fine for any character. Only problem is with space!
Insert single space you obtain HTTP 403 error.
The testing results in the following observations:
Problems seem to be that the apache does not send the address, e.g. http://localhost/?q=entities/entities_ac/%20 further. Results into the error:
[Tue Jun 30 14:38:48 2009] [error] [client 127.0.0.1] (20024)The given path is misformatted or contained invalid characters: Cannot map GET /entities/entities_ac/%20 HTTP/1.1 to file
The rewrite module does not get a chance to call drupal to serve the url.
If you try direct calling of http://localhost/?q=entities/entities_ac/%20 everything works fine.
Moreover, if you switch off Clean URLs, everything works also fine in forms.
There must be a answer how to solve this problem because http://drupal.api use clean URLs and form autocomplete works fine even space.
The issue is discussed also in http://drupal.org/node/226730. I agree that it is not an issue of drupal, however, I have to solve it due to the drupal ;]
