{"thread":{"id":"17370","subject":"[PATCHv2] gitweb: make static files accessible with PATH_INFO","startedAt":"2009-01-26T12:45:37Z","lastAt":"2009-01-28T00:33:35Z","messageCount":3,"participants":["Giuseppe Bilotta","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"101982","messageId":"1232973937-23875-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17370","inReplyTo":null,"subject":"[PATCHv2] gitweb: make static files accessible with PATH_INFO","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-26T12:45:37Z","receivedAt":"2009-01-26T12:45:37Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"When PATH_INFO is defined, static files such as the defalt CSS or the\nshortcut icon are not accessible beyond the summary page (e.g. in\nshortlog or commit view).\n\nFix this by adding a <base> tag pointing to the script base URL.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\nIt's sick that $cgi->url() has no way to print the script base url\nwithout path_info information (or that, if it has, it's very well\nhidden).\n\n gitweb/gitweb.perl |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 931db4f..910da35 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2901,6 +2901,14 @@ sub git_header_html {\n <meta name=\"robots\" content=\"index, nofollow\"/>\n <title>$title</title>\n EOF\n+# the stylesheet, favicon etc urls won't work correctly with path_info unless we set the appropriate base URL\n+\tif ($ENV{'PATH_INFO'}) {\n+\t\tmy $base = $my_uri;\n+\t\tmy $sname = $ENV{'SCRIPT_NAME'};\n+\t\t$base =~ s,\\Q$sname\\E$,,;\n+\t\t$base .= \"/\";\n+\t\tprint \"<base href=\\\"$base\\\"/>\\n\";\n+\t}\n # print out each stylesheet that exist\n \tif (defined $stylesheet) {\n #provides backwards capability for those people who define style sheet in a config file\n-- \n1.5.6.5\n"},{"id":"102205","messageId":"200901280120.38985.jnareb@gmail.com","threadId":"17370","inReplyTo":"1232973937-23875-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCHv2] gitweb: make static files accessible with PATH_INFO","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-28T00:20:38Z","receivedAt":"2009-01-28T00:20:38Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Mon, 26 Jan 2009, Giuseppe Bilotta wrote:\n\n> It's sick that $cgi->url() has no way to print the script base url\n> without path_info information (or that, if it has, it's very well\n> hidden).\n\nActually:\n\nhttp://localhost/cgi-bin/gitweb/printenv.cgi/path/info?query=a;string=b;c=c;c=a\n\nurl(-absolute=>1)  = /cgi-bin/gitweb/printenv.cgi\nurl(-relative=>1)  = /cgi-bin/gitweb/printenv.cgi\nurl(-full=>1)      = http://localhost/cgi-bin/gitweb/printenv.cgi\nurl(-path_info=>1) = http://localhost/cgi-bin/gitweb/printenv.cgi/path/info\nurl(-query=>1)     = http://localhost/cgi-bin/gitweb/printenv.cgi?query=a;string=b;c=c;c=a\nurl(-base=>1)      = http://localhost \n\n$ENV{'SCRIPT_NAME'} = /cgi-bin/gitweb/printenv.cgi\n$ENV{'PATH_INFO'}   = /path/info\n\nWith CGI.pm version 3.10\n-- \nJakub Narebski\nPoland\n"},{"id":"102206","messageId":"cb7bb73a0901271633meb3be90k173ec3cf1a6e33de@mail.gmail.com","threadId":"17370","inReplyTo":"200901280120.38985.jnareb@gmail.com","subject":"Re: [PATCHv2] gitweb: make static files accessible with PATH_INFO","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-28T00:33:35Z","receivedAt":"2009-01-28T00:33:35Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Wed, Jan 28, 2009 at 1:20 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Mon, 26 Jan 2009, Giuseppe Bilotta wrote:\n>\n>> It's sick that $cgi->url() has no way to print the script base url\n>> without path_info information (or that, if it has, it's very well\n>> hidden).\n>\n> Actually:\n>\n> http://localhost/cgi-bin/gitweb/printenv.cgi/path/info?query=a;string=b;c=c;c=a\n>\n> url(-absolute=>1)  = /cgi-bin/gitweb/printenv.cgi\n> url(-relative=>1)  = /cgi-bin/gitweb/printenv.cgi\n> url(-full=>1)      = http://localhost/cgi-bin/gitweb/printenv.cgi\n> url(-path_info=>1) = http://localhost/cgi-bin/gitweb/printenv.cgi/path/info\n> url(-query=>1)     = http://localhost/cgi-bin/gitweb/printenv.cgi?query=a;string=b;c=c;c=a\n> url(-base=>1)      = http://localhost\n>\n> $ENV{'SCRIPT_NAME'} = /cgi-bin/gitweb/printenv.cgi\n> $ENV{'PATH_INFO'}   = /path/info\n\nYeah, but all of these have the script name in it, I was looking for\none without the script name. But more about this in the other reply.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"}]}