{"thread":{"id":"17402","subject":"[PATCHv4] gitweb: make static files accessible with PATH_INFO","startedAt":"2009-01-28T00:52:12Z","lastAt":"2009-01-28T10:02:40Z","messageCount":4,"participants":["Giuseppe Bilotta","Junio C Hamano","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"102209","messageId":"1233103932-6325-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17402","inReplyTo":null,"subject":"[PATCHv4] gitweb: make static files accessible with PATH_INFO","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-28T00:52:12Z","receivedAt":"2009-01-28T00:52:12Z","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 default 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's own URL.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 931db4f..55e3081 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2901,6 +2901,11 @@ 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\n+# set the appropriate base URL\n+\tif ($ENV{'PATH_INFO'}) {\n+\t\tprint \"<base href=\\\"$my_url\\\" />\\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":"102214","messageId":"7vocxsz19e.fsf@gitster.siamese.dyndns.org","threadId":"17402","inReplyTo":"1233103932-6325-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCHv4] gitweb: make static files accessible with PATH_INFO","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-28T01:07:41Z","receivedAt":"2009-01-28T01:07:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:\n\n> When PATH_INFO is defined, static files such as the default CSS or the\n> shortcut icon are not accessible beyond the summary page (e.g. in\n> shortlog or commit view).\n>\n> Fix this by adding a <base> tag pointing to the script's own URL.\n>\n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> ---\n>  gitweb/gitweb.perl |    5 +++++\n>  1 files changed, 5 insertions(+), 0 deletions(-)\n>\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 931db4f..55e3081 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -2901,6 +2901,11 @@ 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\n> +# set the appropriate base URL\n> +\tif ($ENV{'PATH_INFO'}) {\n> +\t\tprint \"<base href=\\\"$my_url\\\" />\\n\";\n> +\t}\n\nPerhaps this is a stupid question, but is $my_url already safe to include\nin the output without any further quoting at this point in the codepath?\n"},{"id":"102220","messageId":"200901280247.25317.jnareb@gmail.com","threadId":"17402","inReplyTo":"7vocxsz19e.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCHv4] gitweb: make static files accessible with PATH_INFO","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-28T01:47:24Z","receivedAt":"2009-01-28T01:47:24Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Wed, 28 Jan 2009, Junio C Hamano wrote:\n> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:\n> \n> > When PATH_INFO is defined,\n\nI other words: when using PATH_INFO gitweb URL\n\n> > static files such as the default CSS or the \n> > shortcut icon are not accessible beyond the summary page (e.g. in\n> > shortlog or commit view).\n\nTo be more exact: if static files, such as the default CSS (and also\nother stylesheets, if defined), the gitweb favicon / shortcut icon,\nor the gitweb logo locations (URIs) are defined using relative URL\nwith relative path (and default Makefile rule to generate gitweb.cgi\nuses basenames like 'gitweb.css', which are relative paths) _THEN_\nthose static files are not accessible beyond 'summary' and projects\nlist view (e.g. in 'shortlog' or 'commit' view).\n\n> >\n> > Fix this by adding a <base> tag pointing to the script's own URL.\n\nWhich defines base URL for all relative links in gitweb.\n\n\n/Note that this makes the document hierarchy non-portable, but I don't\nthink we care.../\n\n> >\n> > Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n> > ---\n> >  gitweb/gitweb.perl |    5 +++++\n> >  1 files changed, 5 insertions(+), 0 deletions(-)\n> >\n> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> > index 931db4f..55e3081 100755\n> > --- a/gitweb/gitweb.perl\n> > +++ b/gitweb/gitweb.perl\n> > @@ -2901,6 +2901,11 @@ 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\n> > +# set the appropriate base URL\n\n+# the stylesheet, favicon, etc URLs won't work correctly with path_info,\n+# unless we set the appropriate base URL\n\nBy the way, I think those comments should be indented aligned to\naccompanying code, but this is issue of separate whitespace cleanup,\nindependent of the issue this commit tries to solve.\n\n> > +\tif ($ENV{'PATH_INFO'}) {\n> > +\t\tprint \"<base href=\\\"$my_url\\\" />\\n\";\n> > +\t}\n> \n> Perhaps this is a stupid question, but is $my_url already safe to include\n> in the output without any further quoting at this point in the codepath?\n\nHmmmm... to be safe we probably should use either esc_url($my_url) here\n(like in git_feed subroutine).\n\n-- \nJakub Narebski\nPoland\n"},{"id":"102292","messageId":"cb7bb73a0901280202r16a86b18q1fd1e161fa150d0e@mail.gmail.com","threadId":"17402","inReplyTo":"200901280247.25317.jnareb@gmail.com","subject":"Re: [PATCHv4] gitweb: make static files accessible with PATH_INFO","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-28T10:02:40Z","receivedAt":"2009-01-28T10:02:40Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Wed, Jan 28, 2009 at 2:47 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Wed, 28 Jan 2009, Junio C Hamano wrote:\n>> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:\n>>\n>> > When PATH_INFO is defined,\n>\n> I other words: when using PATH_INFO gitweb URL\n\nNotice that gitweb accepts PATH_INFO even whe it's not set to produce them\n\n>> > static files such as the default CSS or the\n>> > shortcut icon are not accessible beyond the summary page (e.g. in\n>> > shortlog or commit view).\n>\n> To be more exact: if static files, such as the default CSS (and also\n> other stylesheets, if defined), the gitweb favicon / shortcut icon,\n> or the gitweb logo locations (URIs) are defined using relative URL\n> with relative path (and default Makefile rule to generate gitweb.cgi\n> uses basenames like 'gitweb.css', which are relative paths) _THEN_\n> those static files are not accessible beyond 'summary' and projects\n> list view (e.g. in 'shortlog' or 'commit' view).\n\nI'll rewrite the commit message.\n\n>> >\n>> > Fix this by adding a <base> tag pointing to the script's own URL.\n>\n> Which defines base URL for all relative links in gitweb.\n\n(is this one really necessary)\n\n> /Note that this makes the document hierarchy non-portable, but I don't\n> think we care.../\n\nIn what sense it becomes non-portable?\n\n>> > +   if ($ENV{'PATH_INFO'}) {\n>> > +           print \"<base href=\\\"$my_url\\\" />\\n\";\n>> > +   }\n>>\n>> Perhaps this is a stupid question, but is $my_url already safe to include\n>> in the output without any further quoting at this point in the codepath?\n>\n> Hmmmm... to be safe we probably should use either esc_url($my_url) here\n> (like in git_feed subroutine).\n\nI\"ll do that.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"}]}