Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGI scripts not creating links correctly with cgimod (with tentative solution) #131

Open
jaapb opened this issue Aug 21, 2017 · 0 comments

Comments

@jaapb
Copy link

jaapb commented Aug 21, 2017

Some CGI scripts (Gitweb and ikiwiki are the ones I'm tried) don't quite work with Ocsigen's cgimod. When they generate links, they seem to paste SERVER_NAME and REQUEST_URI together, but then you get links that look like http://www.server.comcgi-bin/path since REQUEST_URI is relative rather than absolute (at least in Ocsigen's cgimod)

Not sure whether it is OK with the standard, but the following patch solves the problem for me.

--- a/src/extensions/cgimod.ml
+++ b/src/extensions/cgimod.ml
@@ -271,7 +271,7 @@ let array_environment filename re doc_root ri hostname =
 
         (* Neither in the CGI's spec nor in the HTTP headers but used, e.g., by PHP *)
         Printf.sprintf "REMOTE_PORT=%d" (Ocsigen_request_info.remote_port ri);
-        Printf.sprintf "REQUEST_URI=%s" (Ocsigen_request_info.url_string ri);
+        Printf.sprintf "REQUEST_URI=%s" (string_conform0 (Ocsigen_request_info.url_string ri));
         (* FIXME: URI instead of URL ? *)
         Printf.sprintf "SCRIPT_FILENAME=%s" filename ] ;
       additionnal_headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant