git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCHv4] gitweb: make static files accessible with PATH_INFO

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Jan 28, 2009, 10:02 UTC
Message-ID
<cb7bb73a0901280202r16a86b18q1fd1e161fa150d0e@mail.gmail.com>
In-Reply-To
<200901280247.25317.jnareb@gmail.com>
On Wed, Jan 28, 2009 at 2:47 AM, Jakub Narebski <jnareb@gmail.com> wrote:
Show 6 quoted lines
> 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
Show 11 quoted lines
>> > 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?
Show 9 quoted lines
>> > +   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
Previous: Jakub Narebski
Message 4 of 4 in “[PATCHv4] gitweb: make static files accessible with PATH_INFO”
  1. Giuseppe BilottaJan 28, 2009
  2. Junio C HamanoJan 28, 2009
  3. Jakub NarebskiJan 28, 2009
  4. Giuseppe BilottaJan 28, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.