bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH][Feature request] global.cgi: Add a fallback redirect method


From: Shigio YAMAGUCHI
Subject: Re: [PATCH][Feature request] global.cgi: Add a fallback redirect method for webservers which do not support CGI redirects
Date: Fri, 8 Feb 2013 13:54:10 +0900

Great!
This function is certainly help for those who feel troublesome
to setup apache.

I have committed your patch to the CVS repository previously,
since it works well and seems to have no problem in it.
The next version of GLOBAL will include it.

Thank you for the fine patch!

Shigio

On Fri, 08 Feb 2013 00:10:56 +0100
Alain Kalker <address@hidden> wrote:

> It is possible (and very convenient :-) ) to serve the website generated 
> by `htags --suggest2` using nothing more than:
> 
> $ pwd > GTAGSROOT # to enable global.cgi to find the tags files
> $ (cd HTML; python -m http.server --cgi) # Python 3.x
>    or
> $ (cd HTML; python -m CGIHTTPServer) # Python 2.x
> 
> and browsing to: http://localhost:8000/index.html
> (The .../index.html is required, as Python doesn't map / path to 
> /index.html automatically.)
> 
> However, Python's built-in webserver (and possibly some others) doesn't 
> support redirects issued from CGI scripts, so when a search returns only 
> 1 result, users will see a blank page instead of the source page with 
> the result.
> This patch addresses this problem by sending an HTML snippet in the 
> response body (yes, the standards allow for this!) to make the browser 
> perform the redirect on its own, using the "META Refresh" method.
> The extra data sent shouldn't have any effect on servers which do 
> support CGI redirects.
> I've left room for a secondary fallback by including a link in the 
> <body></body> block, in case the refresh method doesn't work either. The 
> refresh method is deprecated, but I hope that by the time it isn't 
> supported anymore, the CGI redirection problem will be fixed in the 
> webservers anyway.
> 
> Tested using:
> OS: Arch Linux (rolling release)
> Packages: GNU GLOBAL 6.2.7, Perl v5.16.2
> Servers: Apache 2.2.23, Python 2.7.3, Python 3.3.0
> Browsers: Chromium 24.0.1312.68, Firefox 18.0.2, Opera 12.14.1738
> 
> Signed-off-by: Alain Kalker <address@hidden>
> 
> diff -aur global-6.2.7.pristine/htags/global.cgi.tmpl.in 
> global-6.2.7.new/htags/global.cgi.tmpl.in
> --- global-6.2.7.pristine/htags/global.cgi.tmpl.in    2012-12-22 
> 01:43:58.000000000 +0100
> +++ global-6.2.7.new/htags/global.cgi.tmpl.in    2013-02-07 
> 14:56:38.317009059 +0100
> @@ -181,6 +181,10 @@
>       # direct jump
>       ($fid, $tag, $lno, $filename) = split(/[ \t]+/, shift @line);
>       print "Location: $basedir/S/$fid.$html#L$lno\n\n";
> +    print "<html>\n";
> +    print qq(<head><meta http-equiv="Refresh" content="0; 
> url=$basedir/S/$fid.$html#L$lno" /></head>\n);
> +    print "<body></body>\n";
> +    print "</html>\n";
>       exit 0;
>   }
>   print header();
> 
> 
> _______________________________________________
> Bug-global mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-global


-- 
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



reply via email to

[Prev in Thread] Current Thread [Next in Thread]