* [PATCHv4] gitweb: make static files accessible with PATH_INFO
@ 2009-01-28 0:52 Giuseppe Bilotta
2009-01-28 1:07 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Giuseppe Bilotta @ 2009-01-28 0:52 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski, Junio C Hamano, Giuseppe Bilotta
When PATH_INFO is defined, static files such as the default CSS or the
shortcut icon are not accessible beyond the summary page (e.g. in
shortlog or commit view).
Fix this by adding a <base> tag pointing to the script's own URL.
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
gitweb/gitweb.perl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 931db4f..55e3081 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2901,6 +2901,11 @@ sub git_header_html {
<meta name="robots" content="index, nofollow"/>
<title>$title</title>
EOF
+# the stylesheet, favicon etc urls won't work correctly with path_info unless we
+# set the appropriate base URL
+ if ($ENV{'PATH_INFO'}) {
+ print "<base href=\"$my_url\" />\n";
+ }
# print out each stylesheet that exist
if (defined $stylesheet) {
#provides backwards capability for those people who define style sheet in a config file
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv4] gitweb: make static files accessible with PATH_INFO
2009-01-28 0:52 [PATCHv4] gitweb: make static files accessible with PATH_INFO Giuseppe Bilotta
@ 2009-01-28 1:07 ` Junio C Hamano
2009-01-28 1:47 ` Jakub Narebski
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2009-01-28 1:07 UTC (permalink / raw)
To: Giuseppe Bilotta; +Cc: git, Jakub Narebski
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
> When PATH_INFO is defined, static files such as the default CSS or the
> shortcut icon are not accessible beyond the summary page (e.g. in
> shortlog or commit view).
>
> Fix this by adding a <base> tag pointing to the script's own URL.
>
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> ---
> gitweb/gitweb.perl | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 931db4f..55e3081 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -2901,6 +2901,11 @@ sub git_header_html {
> <meta name="robots" content="index, nofollow"/>
> <title>$title</title>
> EOF
> +# the stylesheet, favicon etc urls won't work correctly with path_info unless we
> +# set the appropriate base URL
> + if ($ENV{'PATH_INFO'}) {
> + print "<base href=\"$my_url\" />\n";
> + }
Perhaps this is a stupid question, but is $my_url already safe to include
in the output without any further quoting at this point in the codepath?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv4] gitweb: make static files accessible with PATH_INFO
2009-01-28 1:07 ` Junio C Hamano
@ 2009-01-28 1:47 ` Jakub Narebski
2009-01-28 10:02 ` Giuseppe Bilotta
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2009-01-28 1:47 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Giuseppe Bilotta, git
On Wed, 28 Jan 2009, Junio C Hamano wrote:
> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>
> > When PATH_INFO is defined,
I other words: when using PATH_INFO gitweb URL
> > static files such as the default CSS or the
> > shortcut icon are not accessible beyond the summary page (e.g. in
> > shortlog or commit view).
To be more exact: if static files, such as the default CSS (and also
other stylesheets, if defined), the gitweb favicon / shortcut icon,
or the gitweb logo locations (URIs) are defined using relative URL
with relative path (and default Makefile rule to generate gitweb.cgi
uses basenames like 'gitweb.css', which are relative paths) _THEN_
those static files are not accessible beyond 'summary' and projects
list view (e.g. in 'shortlog' or 'commit' view).
> >
> > Fix this by adding a <base> tag pointing to the script's own URL.
Which defines base URL for all relative links in gitweb.
/Note that this makes the document hierarchy non-portable, but I don't
think we care.../
> >
> > Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> > ---
> > gitweb/gitweb.perl | 5 +++++
> > 1 files changed, 5 insertions(+), 0 deletions(-)
> >
> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index 931db4f..55e3081 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -2901,6 +2901,11 @@ sub git_header_html {
> > <meta name="robots" content="index, nofollow"/>
> > <title>$title</title>
> > EOF
> > +# the stylesheet, favicon etc urls won't work correctly with path_info unless we
> > +# set the appropriate base URL
+# the stylesheet, favicon, etc URLs won't work correctly with path_info,
+# unless we set the appropriate base URL
By the way, I think those comments should be indented aligned to
accompanying code, but this is issue of separate whitespace cleanup,
independent of the issue this commit tries to solve.
> > + if ($ENV{'PATH_INFO'}) {
> > + print "<base href=\"$my_url\" />\n";
> > + }
>
> Perhaps this is a stupid question, but is $my_url already safe to include
> in the output without any further quoting at this point in the codepath?
Hmmmm... to be safe we probably should use either esc_url($my_url) here
(like in git_feed subroutine).
--
Jakub Narebski
Poland
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv4] gitweb: make static files accessible with PATH_INFO
2009-01-28 1:47 ` Jakub Narebski
@ 2009-01-28 10:02 ` Giuseppe Bilotta
0 siblings, 0 replies; 4+ messages in thread
From: Giuseppe Bilotta @ 2009-01-28 10:02 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Junio C Hamano, git
On Wed, Jan 28, 2009 at 2:47 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> On Wed, 28 Jan 2009, Junio C Hamano wrote:
>> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>>
>> > When PATH_INFO is defined,
>
> I other words: when using PATH_INFO gitweb URL
Notice that gitweb accepts PATH_INFO even whe it's not set to produce them
>> > static files such as the default CSS or the
>> > shortcut icon are not accessible beyond the summary page (e.g. in
>> > shortlog or commit view).
>
> To be more exact: if static files, such as the default CSS (and also
> other stylesheets, if defined), the gitweb favicon / shortcut icon,
> or the gitweb logo locations (URIs) are defined using relative URL
> with relative path (and default Makefile rule to generate gitweb.cgi
> uses basenames like 'gitweb.css', which are relative paths) _THEN_
> those static files are not accessible beyond 'summary' and projects
> list view (e.g. in 'shortlog' or 'commit' view).
I'll rewrite the commit message.
>> >
>> > Fix this by adding a <base> tag pointing to the script's own URL.
>
> Which defines base URL for all relative links in gitweb.
(is this one really necessary)
> /Note that this makes the document hierarchy non-portable, but I don't
> think we care.../
In what sense it becomes non-portable?
>> > + if ($ENV{'PATH_INFO'}) {
>> > + print "<base href=\"$my_url\" />\n";
>> > + }
>>
>> Perhaps this is a stupid question, but is $my_url already safe to include
>> in the output without any further quoting at this point in the codepath?
>
> Hmmmm... to be safe we probably should use either esc_url($my_url) here
> (like in git_feed subroutine).
I"ll do that.
--
Giuseppe "Oblomov" Bilotta
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-28 10:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-28 0:52 [PATCHv4] gitweb: make static files accessible with PATH_INFO Giuseppe Bilotta
2009-01-28 1:07 ` Junio C Hamano
2009-01-28 1:47 ` Jakub Narebski
2009-01-28 10:02 ` Giuseppe Bilotta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).