# RE: gitweb not friendly to firefox?

24 messages from 2007-03-01 to 2007-03-08. Participants: Raimund Bauer, Eygene Ryabinkin, Li Yang-r58472, Junio C Hamano, Oleg Verych, Jakub Narebski, Nicolas Pitre, Johannes Schindelin, Uwe Kleine-König, sf.
Thread: https://gitlist.dev/t/7038

## Eygene Ryabinkin, 2007-03-01 14:00

Subject: Re: gitweb not friendly to firefox?
Message-ID: <20070301140046.GM57456@codelabs.ru>
URL: https://gitlist.dev/e/20070301140046.GM57456%40codelabs.ru
In-Reply-To: <000f01c75c06$555d5e50$0b0aa8c0@abf.local>

```
> > Line Number 43, Column 38:<tr><td>author</td><td>Li Yang
> <LeoLi@freescale.com></td></tr> -------------------------------------^
> 
> Try to save the output and verify it with some other xml-parser. The
> "<LeoLi@freescale.com>" seems to be the culprit here, since "@" is no
> allowed character for a xml-tag, and there maybe is some html-escaping of
> the email address missing?

I think that the situation is simpler: <LeoLi@....> is taken as the
XML/HTML tag and it
- does not closed anywhere,
- has the wrong syntax, since "@" and "." can not live inside the
tag name if memory serves me right.

The proper thing is to replace "<" with "&lt;" and ">" with "&gt;".
-- 
Eygene

```

## Raimund Bauer, 2007-03-01 14:26

Subject: RE: gitweb not friendly to firefox?
Message-ID: <001001c75c0d$a2840600$0b0aa8c0@abf.local>
URL: https://gitlist.dev/e/001001c75c0d%24a2840600%240b0aa8c0%40abf.local
In-Reply-To: <20070301140046.GM57456@codelabs.ru>

```
> I think that the situation is simpler: <LeoLi@....> is taken 
> as the XML/HTML tag and it
> - does not closed anywhere,
> - has the wrong syntax, since "@" and "." can not live inside 
> the tag name if memory serves me right.
> 
> The proper thing is to replace "<" with "&lt;" and ">" with "&gt;".

Yes ... I should learn to write out what I mean and not only hint at it ;-)

-- 
best regards

  Ray

```

## Li Yang-r58472, 2007-03-02 02:28

Subject: RE: gitweb not friendly to firefox?
Message-ID: <989B956029373F45A0B8AF02970818902DA75D@zch01exm26.fsl.freescale.net>
URL: https://gitlist.dev/e/989B956029373F45A0B8AF02970818902DA75D%40zch01exm26.fsl.freescale.net
In-Reply-To: <20070301140046.GM57456@codelabs.ru>

```
> -----Original Message-----
> From: rea-git@codelabs.ru [mailto:rea-git@codelabs.ru]
> Sent: Thursday, March 01, 2007 10:01 PM
> To: Raimund Bauer
> Cc: Li Yang-r58472; git@vger.kernel.org
> Subject: Re: gitweb not friendly to firefox?
> 
> > > Line Number 43, Column 38:<tr><td>author</td><td>Li Yang
> > <LeoLi@freescale.com></td></tr>
-------------------------------------^
> >
> > Try to save the output and verify it with some other xml-parser. The
> > "<LeoLi@freescale.com>" seems to be the culprit here, since "@" is
no
> > allowed character for a xml-tag, and there maybe is some
html-escaping of
> > the email address missing?
> 
> I think that the situation is simpler: <LeoLi@....> is taken as the
> XML/HTML tag and it
> - does not closed anywhere,
> - has the wrong syntax, since "@" and "." can not live inside the
> tag name if memory serves me right.
> 
> The proper thing is to replace "<" with "&lt;" and ">" with "&gt;".

Yes, you are right.  But why gitweb didn't do that for me?  I observed
that some early version of gitweb doesn't have this problem.  Is it
possible that some new change caused this?

- Leo

```

## Junio C Hamano, 2007-03-02 04:40

Subject: Re: gitweb not friendly to firefox?
Message-ID: <7v4pp4ntpo.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v4pp4ntpo.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <989B956029373F45A0B8AF02970818902DA75D@zch01exm26.fsl.freescale.net>

```
"Li Yang-r58472" <LeoLi@freescale.com> writes:

>> The proper thing is to replace "<" with "&lt;" and ">" with "&gt;".
>
> Yes, you are right.  But why gitweb didn't do that for me?  I observed
> that some early version of gitweb doesn't have this problem.  Is it
> possible that some new change caused this?

It's very possible.

```

## Li Yang-r58472, 2007-03-02 06:47

Subject: RE: gitweb not friendly to firefox?
Message-ID: <989B956029373F45A0B8AF02970818902DA7E4@zch01exm26.fsl.freescale.net>
URL: https://gitlist.dev/e/989B956029373F45A0B8AF02970818902DA7E4%40zch01exm26.fsl.freescale.net
In-Reply-To: <7v4pp4ntpo.fsf@assigned-by-dhcp.cox.net>

```
> -----Original Message-----
> From: Junio C Hamano [mailto:junkio@cox.net]
> Sent: Friday, March 02, 2007 12:41 PM
> To: Li Yang-r58472
> Cc: rea-git@codelabs.ru; Raimund Bauer; git@vger.kernel.org
> Subject: Re: gitweb not friendly to firefox?
> 
> "Li Yang-r58472" <LeoLi@freescale.com> writes:
> 
> >> The proper thing is to replace "<" with "&lt;" and ">" with "&gt;".
> >
> > Yes, you are right.  But why gitweb didn't do that for me?  I
observed
> > that some early version of gitweb doesn't have this problem.  Is it
> > possible that some new change caused this?
> 
> It's very possible.

Well, I had found out that the escapeHTML() is not functioning on my
server.  It leaves the "<", ">", "@" unchanged.  Does anyone have a clue
about it?  I'm using Redhat 9.0 full installation.

- Leo

```

## Junio C Hamano, 2007-03-02 06:51

Subject: Re: gitweb not friendly to firefox?
Message-ID: <7v1wk8i1et.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v1wk8i1et.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <989B956029373F45A0B8AF02970818902DA7E4@zch01exm26.fsl.freescale.net>

```
"Li Yang-r58472" <LeoLi@freescale.com> writes:

>> > Yes, you are right.  But why gitweb didn't do that for me?  I
> observed
>> > that some early version of gitweb doesn't have this problem.  Is it
>> > possible that some new change caused this?
>> 
>> It's very possible.
>
> Well, I had found out that the escapeHTML() is not functioning on my
> server.  It leaves the "<", ">", "@" unchanged.  Does anyone have a clue
> about it?  I'm using Redhat 9.0 full installation.

I am not sure offhand if escapeHTML implementation is wrong or
the call site is calling escapeHTML when it should be using some
other kinds of escape.

The person who knows about this issue the best, if I have to
guess, would be Jakub Narebski.

```

## Li Yang-r58472, 2007-03-02 09:36

Subject: RE: gitweb not friendly to firefox?
Message-ID: <989B956029373F45A0B8AF02970818902DA81B@zch01exm26.fsl.freescale.net>
URL: https://gitlist.dev/e/989B956029373F45A0B8AF02970818902DA81B%40zch01exm26.fsl.freescale.net
In-Reply-To: <7v1wk8i1et.fsf@assigned-by-dhcp.cox.net>

```
Hi Jakub,

Problem sovled, using the following patch.  I'm not an expert of perl,
so I don't know if it is problem of the gitweb or problem with my perl
environment.  My environment is perl-5.8.0 and perl-CGI-2.81.

Signed-off-by: Li Yang<leoli@freecale.com>
---
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 653ca3c..8c9a291 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -591,7 +591,7 @@ sub esc_html ($;%) {
        my %opts = @_;

        $str = to_utf8($str);
-       $str = escapeHTML($str);
+       $str = $cgi->escapeHTML($str);
        if ($opts{'-nbsp'}) {
                $str =~ s/ /&nbsp;/g;
        }


> -----Original Message-----
> From: Junio C Hamano [mailto:junkio@cox.net]
> Sent: Friday, March 02, 2007 2:51 PM
> To: Li Yang-r58472
> Cc: rea-git@codelabs.ru; Raimund Bauer; git@vger.kernel.org; Jakub
Narebski
> Subject: Re: gitweb not friendly to firefox?
> 
> "Li Yang-r58472" <LeoLi@freescale.com> writes:
> 
> >> > Yes, you are right.  But why gitweb didn't do that for me?  I
> > observed
> >> > that some early version of gitweb doesn't have this problem.  Is
it
> >> > possible that some new change caused this?
> >>
> >> It's very possible.
> >
> > Well, I had found out that the escapeHTML() is not functioning on my
> > server.  It leaves the "<", ">", "@" unchanged.  Does anyone have a
clue
> > about it?  I'm using Redhat 9.0 full installation.
> 
> I am not sure offhand if escapeHTML implementation is wrong or
> the call site is calling escapeHTML when it should be using some
> other kinds of escape.
> 
> The person who knows about this issue the best, if I have to
> guess, would be Jakub Narebski.
> 

```

## Junio C Hamano, 2007-03-02 10:17

Subject: Re: gitweb not friendly to firefox?
Message-ID: <7vabyweypw.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vabyweypw.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <989B956029373F45A0B8AF02970818902DA81B@zch01exm26.fsl.freescale.net>

```
"Li Yang-r58472" <LeoLi@freescale.com> writes:

> Hi Jakub,
>
> Problem sovled, using the following patch.  I'm not an expert of perl,
> so I don't know if it is problem of the gitweb or problem with my perl
> environment.  My environment is perl-5.8.0 and perl-CGI-2.81.
>
> Signed-off-by: Li Yang<leoli@freecale.com>
> ---
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 653ca3c..8c9a291 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -591,7 +591,7 @@ sub esc_html ($;%) {
>         my %opts = @_;
>
>         $str = to_utf8($str);
> -       $str = escapeHTML($str);
> +       $str = $cgi->escapeHTML($str);
>         if ($opts{'-nbsp'}) {
>                 $str =~ s/ /&nbsp;/g;
>         }
>

This is puzzling....

 (1) we have two call sites of escapeHTML(), but your patch
     touches only one.

 (2) we do "use CGI qw(:standard :escapeHTML -nosticky);"
     upfront, presumably after doing this when we say
     escapeHTML() it means the same as CGI::escapeHTML().

 (3) we do "$cgi = new CGI" upfront.

So I am wondering how the patch can have any effect...

I am not saying that I do not believe you when you say the patch
fixes the problem for you.  I just do not understand why and I
hate not knowing why something works.

```

## Li Yang-r58472, 2007-03-02 10:27

Subject: RE: gitweb not friendly to firefox?
Message-ID: <989B956029373F45A0B8AF02970818902DA81D@zch01exm26.fsl.freescale.net>
URL: https://gitlist.dev/e/989B956029373F45A0B8AF02970818902DA81D%40zch01exm26.fsl.freescale.net
In-Reply-To: <7vabyweypw.fsf@assigned-by-dhcp.cox.net>

```
> -----Original Message-----
> From: Junio C Hamano [mailto:junkio@cox.net]
> Sent: Friday, March 02, 2007 6:18 PM
> To: Li Yang-r58472
> Cc: Jakub Narebski; rea-git@codelabs.ru; Raimund Bauer;
git@vger.kernel.org
> Subject: Re: gitweb not friendly to firefox?
> 
> "Li Yang-r58472" <LeoLi@freescale.com> writes:
> 
> > Hi Jakub,
> >
> > Problem sovled, using the following patch.  I'm not an expert of
perl,
> > so I don't know if it is problem of the gitweb or problem with my
perl
> > environment.  My environment is perl-5.8.0 and perl-CGI-2.81.
> >
> > Signed-off-by: Li Yang<leoli@freecale.com>
> > ---
> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index 653ca3c..8c9a291 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -591,7 +591,7 @@ sub esc_html ($;%) {
> >         my %opts = @_;
> >
> >         $str = to_utf8($str);
> > -       $str = escapeHTML($str);
> > +       $str = $cgi->escapeHTML($str);
> >         if ($opts{'-nbsp'}) {
> >                 $str =~ s/ /&nbsp;/g;
> >         }
> >
> 
> This is puzzling....
> 
>  (1) we have two call sites of escapeHTML(), but your patch
>      touches only one.
> 
>  (2) we do "use CGI qw(:standard :escapeHTML -nosticky);"
>      upfront, presumably after doing this when we say
>      escapeHTML() it means the same as CGI::escapeHTML().
> 
>  (3) we do "$cgi = new CGI" upfront.
> 
> So I am wondering how the patch can have any effect...
> 
> I am not saying that I do not believe you when you say the patch
> fixes the problem for you.  I just do not understand why and I
> hate not knowing why something works.

Here is the phenomenon I observed. In CGI.pm,
# Escape HTML -- used internally
'escapeHTML' => <<'END_OF_FUNC',
sub escapeHTML {
         # hack to work around  earlier hacks
         push @_,$_[0] if @_==1 && $_[0] eq 'CGI';
         my ($self,$toencode,$newlinestoo) = CGI::self_or_default(@_);
         return undef unless defined($toencode);
         return $toencode if ref($self) && !$self->{'escape'};
         $toencode =~ s{&}{&amp;}gso;
         $toencode =~ s{<}{&lt;}gso;
         $toencode =~ s{>}{&gt;}gso;
         $toencode =~ s{"}{&quot;}gso;
         my $latin = uc $self->{'.charset'} eq 'ISO-8859-1' ||
                     uc $self->{'.charset'} eq 'WINDOWS-1252';
         if ($latin) {  # bug in some browsers
                $toencode =~ s{'}{&#39;}gso;
                $toencode =~ s{\x8b}{&#8249;}gso;
                $toencode =~ s{\x9b}{&#8250;}gso;
                if (defined $newlinestoo && $newlinestoo) {
                     $toencode =~ s{\012}{&#10;}gso;
                     $toencode =~ s{\015}{&#13;}gso;
                }
         }
         return $toencode;
}
END_OF_FUNC

The escapeHTML() returns on " return $toencode if ref($self) &&
!$self->{'escape'};".  So the $self->{'ecscape'} = 0.  However,
$cgi->{'escape'} = 1.  So I know, the $self is not the $cgi in gitweb,
but another CGI with 'escape' undefined.

- Leo

```

## Oleg Verych, 2007-03-02 16:19

Subject: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <E1HNATn-0005Y6-HW@flower>
URL: https://gitlist.dev/e/E1HNATn-0005Y6-HW%40flower
In-Reply-To: <7vabyweypw.fsf@assigned-by-dhcp.cox.net>

```
> From: Junio C Hamano
> Newsgroups: gmane.comp.version-control.git
> Subject: Re: gitweb not friendly to firefox?
> Date: Fri, 02 Mar 2007 02:17:31 -0800
[]
>
> This is puzzling....

Hallo.

Guys, changing content to "application/xhtml+xml" was a bad idea.
Here i see FF doesn't working, but i have lynx not working at all :(

"text/html" is OK, unless you have shiny modern AJAX sh1t on board...
____

```

## Jakub Narebski, 2007-03-03 02:57

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <200703030357.18822.jnareb@gmail.com>
URL: https://gitlist.dev/e/200703030357.18822.jnareb%40gmail.com
In-Reply-To: <E1HNATn-0005Y6-HW@flower>

```
Oleg Verych wrote:
>> From: Junio C Hamano
>> Newsgroups: gmane.comp.version-control.git
>> Subject: Re: gitweb not friendly to firefox?
>> Date: Fri, 02 Mar 2007 02:17:31 -0800
>[]
>>
>> This is puzzling....
> 
> Guys, changing content to "application/xhtml+xml" was a bad idea.
> Here i see FF doesn't working, but i have lynx not working at all :(
> 
> "text/html" is OK, unless you have shiny modern AJAX sh1t on board...

Well, change from text/html to (sometimes) application/xhtml+xml was
made in commit f6801d669 by Alp Toker with the following explanation:

    "The 'text/html' media type [RFC2854] is primarily for HTML, not for
    XHTML. In general, this media type is NOT suitable for XHTML."
    
    This patch makes gitweb use content negotiation to conservatively send
    pages as Content-Type 'application/xhtml+xml' when the user agent
    explicitly claims to support it.

By "conservatively" it means that it uses 'application/xhtml+xml' only when
client explicitly claims that it accepts its, and it is not due to for
example */* accept globbing.

So if lynx isn't working, it is its damn fault...
-- 
Jakub Narebski
Poland

```

## Nicolas Pitre, 2007-03-03 03:25

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <alpine.LRH.0.82.0703022223060.29426@xanadu.home>
URL: https://gitlist.dev/e/alpine.LRH.0.82.0703022223060.29426%40xanadu.home
In-Reply-To: <200703030357.18822.jnareb@gmail.com>

```
On Sat, 3 Mar 2007, Jakub Narebski wrote:

> By "conservatively" it means that it uses 'application/xhtml+xml' only when
> client explicitly claims that it accepts its, and it is not due to for
> example */* accept globbing.
> 
> So if lynx isn't working, it is its damn fault...

I absolutely don't care.

I use lynx, and lynx worked perfectly fine before.  So it is not lynx 
that broke it.  Please fix gitweb.


Nicolas

```

## Jakub Narebski, 2007-03-03 03:41

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <200703030441.36627.jnareb@gmail.com>
URL: https://gitlist.dev/e/200703030441.36627.jnareb%40gmail.com
In-Reply-To: <alpine.LRH.0.82.0703022223060.29426@xanadu.home>

```
Nicolas Pitre wrote:
> On Sat, 3 Mar 2007, Jakub Narebski wrote:
> 
>> By "conservatively" it means that it uses 'application/xhtml+xml' only when
>> client explicitly claims that it accepts its, and it is not due to for
>> example */* accept globbing.
>> 
>> So if lynx isn't working, it is its damn fault...
> 
> I absolutely don't care.
> 
> I use lynx, and lynx worked perfectly fine before.  So it is not lynx 
> that broke it.  Please fix gitweb.

WORKSFORME.

Lynx Version 2.8.5rel.1 (04 Feb 2004)
libwww-FM 2.14, SSL-MM 1.4.1, OpenSSL 0.9.7f

git web interface version 1.5.0.rc3.gc0bbd

(and application/xhtml+xml is _not_ among Accept's).
-- 
Jakub Narebski
Poland

```

## Nicolas Pitre, 2007-03-03 03:49

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <alpine.LRH.0.82.0703022242570.29426@xanadu.home>
URL: https://gitlist.dev/e/alpine.LRH.0.82.0703022242570.29426%40xanadu.home
In-Reply-To: <200703030441.36627.jnareb@gmail.com>

```
On Sat, 3 Mar 2007, Jakub Narebski wrote:

> Nicolas Pitre wrote:
> > On Sat, 3 Mar 2007, Jakub Narebski wrote:
> > 
> >> By "conservatively" it means that it uses 'application/xhtml+xml' only when
> >> client explicitly claims that it accepts its, and it is not due to for
> >> example */* accept globbing.
> >> 
> >> So if lynx isn't working, it is its damn fault...
> > 
> > I absolutely don't care.
> > 
> > I use lynx, and lynx worked perfectly fine before.  So it is not lynx 
> > that broke it.  Please fix gitweb.
> 
> WORKSFORME.
> 
> Lynx Version 2.8.5rel.1 (04 Feb 2004)
> libwww-FM 2.14, SSL-MM 1.4.1, OpenSSL 0.9.7f
> 
> git web interface version 1.5.0.rc3.gc0bbd
> 
> (and application/xhtml+xml is _not_ among Accept's).

This is Lynx 2.8.5rel.1 (04 Feb 2004) on Fedora Core 6:

$ lynx http://www.kernel.org/git
[...]
application/xhtml+xml  D)ownload, or C)ancel


Nicolas

```

## Jakub Narebski, 2007-03-03 03:58

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <200703030458.58616.jnareb@gmail.com>
URL: https://gitlist.dev/e/200703030458.58616.jnareb%40gmail.com
In-Reply-To: <alpine.LRH.0.82.0703022242570.29426@xanadu.home>

```
[some Cc dropped]

Nicolas Pitre wrote:
> On Sat, 3 Mar 2007, Jakub Narebski wrote:
>> Nicolas Pitre wrote:
>>> On Sat, 3 Mar 2007, Jakub Narebski wrote:
>>> 
>>>> By "conservatively" it means that it uses 'application/xhtml+xml' only when
>>>> client explicitly claims that it accepts its, and it is not due to for
>>>> example */* accept globbing.
>>>> 
>>>> So if lynx isn't working, it is its damn fault...
>>> 
>>> I absolutely don't care.
>>> 
>>> I use lynx, and lynx worked perfectly fine before.  So it is not lynx 
>>> that broke it.  Please fix gitweb.
>> 
>> WORKSFORME.
>> 
>> Lynx Version 2.8.5rel.1 (04 Feb 2004)
>> libwww-FM 2.14, SSL-MM 1.4.1, OpenSSL 0.9.7f
>> 
>> git web interface version 1.5.0.rc3.gc0bbd
>> 
>> (and application/xhtml+xml is _not_ among Accept's).
> 
> This is Lynx 2.8.5rel.1 (04 Feb 2004) on Fedora Core 6:
> 
> $ lynx http://www.kernel.org/git
> [...]
> application/xhtml+xml  D)ownload, or C)ancel

$ lynx http://www.kernel.org/git
[...]
#                                                          Kernel.org - Git Repo (p1 of 26)

   #Kernel.org - Git Repo projects list Kernel.org - Git Repo projects feeds
[...]

Could you check if "application/xhtml+xml" is in "Accept:"
HTTP Request Header sent by _your_ lynx, e.g. as seen via
  http://web-sniffer.net/?url=http://www.kernel.org/git

-- 
Jakub Narebski
Poland

```

## Nicolas Pitre, 2007-03-03 04:34

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <alpine.LRH.0.82.0703022328460.29426@xanadu.home>
URL: https://gitlist.dev/e/alpine.LRH.0.82.0703022328460.29426%40xanadu.home
In-Reply-To: <200703030458.58616.jnareb@gmail.com>

```
On Sat, 3 Mar 2007, Jakub Narebski wrote:

> Could you check if "application/xhtml+xml" is in "Accept:"
> HTTP Request Header sent by _your_ lynx, e.g. as seen via
>   http://web-sniffer.net/?url=http://www.kernel.org/git

Accept: text/html, text/plain, application/pdf, application/msword, audio/mod, image/*, application/postscript, text/sgml, */*;q=0.01[CRLF]
User-Agent: Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8b 


Nicolas

```

## Nicolas Pitre, 2007-03-03 05:09

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <alpine.LRH.0.82.0703030005320.29426@xanadu.home>
URL: https://gitlist.dev/e/alpine.LRH.0.82.0703030005320.29426%40xanadu.home
In-Reply-To: <alpine.LRH.0.82.0703022242570.29426@xanadu.home>

```
On Fri, 2 Mar 2007, Nicolas Pitre wrote:

> This is Lynx 2.8.5rel.1 (04 Feb 2004) on Fedora Core 6:
> 
> $ lynx http://www.kernel.org/git
> [...]
> application/xhtml+xml  D)ownload, or C)ancel

I also tried with elinks and it works fine.

Then I tried links2 and it gives:

|?? Unknown type 
|????????????????????????????????????????????????????????????????
|
|Content type is application/xhtml+xml.
|Do you want to save or display this file?
|
|[ Save ]  [ Display ]  [ Cancel ]

So gitweb is now broken for 2 out of 3 text based browsers that used to 
just work fine before.


Nicolas

```

## Oleg Verych, 2007-03-03 13:04

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <20070303130423.GL16509@flower.upol.cz>
URL: https://gitlist.dev/e/20070303130423.GL16509%40flower.upol.cz
In-Reply-To: <alpine.LRH.0.82.0703030005320.29426@xanadu.home>

```
On Sat, Mar 03, 2007 at 12:09:02AM -0500, Nicolas Pitre wrote:
[]
> So gitweb is now broken for 2 out of 3 text based browsers that used to 
> just work fine before.

Maybe there's a patch to have xhtml to be as html.

In the Debian i have:

,-*- bash -*-
|olecom@flower:/tmp$ nc -l -p 8888 localhost
|GET / HTTP/1.0
|Host: localhost:8888
|Accept: text/html, text/plain, application/x-troff-man,
|application/x-tar, application/x-gtar, application/ogg, image/gif,
|image/jpeg, image/pjpeg, image/png, image/tiff, image/bmp, text/*,
|application/x-debian-package, audio/basic, */*;q=0.01
|Accept-Encoding: gzip, compress
|Accept-Language: en, ru, cs
|Accept-Charset: koi8-r, iso-8859-1;q=0.01, us-ascii;q=0.01
|User-Agent: Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.4.4
`-*-

All additional content types, e.g application/*, image/*, are handled by
external software of course.

And maybe this: "*/*;q=0.01" is handled somehow wrong, i.e out of priority.
____

```

## Johannes Schindelin, 2007-03-03 13:25

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <Pine.LNX.4.63.0703031424270.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0703031424270.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <alpine.LRH.0.82.0703030005320.29426@xanadu.home>

```
Hi,

On Sat, 3 Mar 2007, Nicolas Pitre wrote:

> On Fri, 2 Mar 2007, Nicolas Pitre wrote:
> 
> > This is Lynx 2.8.5rel.1 (04 Feb 2004) on Fedora Core 6:
> > 
> > $ lynx http://www.kernel.org/git
> > [...]
> > application/xhtml+xml  D)ownload, or C)ancel
> 
> I also tried with elinks and it works fine.
> 
> Then I tried links2 and it gives:
> 
> |?? Unknown type 
> |????????????????????????????????????????????????????????????????
> |
> |Content type is application/xhtml+xml.
> |Do you want to save or display this file?
> |
> |[ Save ]  [ Display ]  [ Cancel ]
> 
> So gitweb is now broken for 2 out of 3 text based browsers that used to 
> just work fine before.

Just to fuel the fire: w3m also wants to download index.html. It also used 
to work fine before. That makes 3 out of 4.

Ciao,
Dscho

```

## Junio C Hamano, 2007-03-03 13:29

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <7v3b4mbglp.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v3b4mbglp.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <alpine.LRH.0.82.0703022223060.29426@xanadu.home>

```
Nicolas Pitre <nico@cam.org> writes:

> On Sat, 3 Mar 2007, Jakub Narebski wrote:
>
>> By "conservatively" it means that it uses 'application/xhtml+xml' only when
>> client explicitly claims that it accepts its, and it is not due to for
>> example */* accept globbing.
>> 
>> So if lynx isn't working, it is its damn fault...
>
> I absolutely don't care.
>
> I use lynx, and lynx worked perfectly fine before.  So it is not lynx 
> that broke it.  Please fix gitweb.

I think the real question is if gitweb output need to be XHTML.
If everybody's browser is happier with text/html and we do not
have to use things only in xhtml, sending text/html out (both as
content-type and the actual contents) feels like the right thing
to do from compatibility point of view.

```

## Oleg Verych, 2007-03-03 14:19

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <20070303141947.GN16509@flower.upol.cz>
URL: https://gitlist.dev/e/20070303141947.GN16509%40flower.upol.cz
In-Reply-To: <7v3b4mbglp.fsf@assigned-by-dhcp.cox.net>

```
On Sat, Mar 03, 2007 at 05:29:22AM -0800, Junio C Hamano wrote:
> Nicolas Pitre <nico@cam.org> writes:
> 
> > On Sat, 3 Mar 2007, Jakub Narebski wrote:
> >
> >> By "conservatively" it means that it uses 'application/xhtml+xml' only when
> >> client explicitly claims that it accepts its, and it is not due to for
> >> example */* accept globbing.
> >> 
> >> So if lynx isn't working, it is its damn fault...
> >
> > I absolutely don't care.
> >
> > I use lynx, and lynx worked perfectly fine before.  So it is not lynx 
> > that broke it.  Please fix gitweb.
> 
> I think the real question is if gitweb output need to be XHTML.
> If everybody's browser is happier with text/html and we do not
> have to use things only in xhtml, sending text/html out (both as
> content-type and the actual contents) feels like the right thing
> to do from compatibility point of view.
> 

Right XML (XHTML) isn't a tags soup as HTML is, so it's better. But
"application/xml+xml+xml" is very silly, unless site's content uses
dynamics, DOM, etc. As far as i can see, gitweb is not going to have
javascript and such yet (because of compatibility/usability).

Thus, fixing of http content negotiation is needed, or whatever is used
in Perl for this.
____

```

## Jakub Narebski, 2007-03-04 00:49

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <200703040149.45713.jnareb@gmail.com>
URL: https://gitlist.dev/e/200703040149.45713.jnareb%40gmail.com
In-Reply-To: <alpine.LRH.0.82.0703022328460.29426@xanadu.home>

```
Nicolas Pitre wrote:
> On Sat, 3 Mar 2007, Jakub Narebski wrote:
> 
>> Could you check if "application/xhtml+xml" is in "Accept:"
>> HTTP Request Header sent by _your_ lynx, e.g. as seen via
>>   http://web-sniffer.net/?url=http://www.kernel.org/git
> 
> Accept: text/html, text/plain, application/pdf, application/msword,
>   audio/mod, image/*, application/postscript, text/sgml, */*;q=0.01
>   [CRLF]    
> User-Agent: Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8b 

I'm adding back everybody which participated in this thread...

There are two complications: first, sometimes http://www.kernel.org/git
works with lynx (and links2, and w3m), and sometimes do not. I have
reported lynx working with it, but when I tried to repeat this I got
not understood (by lynx) "application/xhtml+xml" instead of correct
"text/html".

Second, the code responsible for setting correct content type is:

	my $content_type;
	# require explicit support from the UA if we are to send the page as
	# 'application/xhtml+xml', otherwise send it as plain old 'text/html'.
	# we have to do this because MSIE sometimes globs '*/*', pretending to
	# support xhtml+xml but choking when it gets what it asked for.
	if (defined $cgi->http('HTTP_ACCEPT') &&
	    $cgi->http('HTTP_ACCEPT') =~ m/(,|;|\s|^)application\/xhtml\+xml(,|;|\s|$)/ &&
	    $cgi->Accept('application/xhtml+xml') != 0) {
		$content_type = 'application/xhtml+xml';
	} else {
		$content_type = 'text/html';
	}

As you can see lynx _does not_ include 'application/xhtml+xml' among
accepted content types, and gitweb requires to have it set explicitely
(i.e. having */* is not enough).


BUT I have an idea: this might be caused by the gitweb _used by
kernel.org_. http://www.kernel.org/git says that it use "git web interface
version 1.4.5-rc0.GIT" while using "git core binaries version 1.5.0.1"
which is a bit suspicious... and right so, because IIRC kernel.org uses
caching version of gitweb by John 'Warthog9'
  http://www.kernel.org/git/?p=git/warthog9/gitweb.git;a=summary
(I think it should use different identification, perhaps "caching git web
interface", or "git web interface (caching)"). I guess that it caches
too aggresively, caching also HTTP response (including content type).
 
That of course might not be true, but check if for example
http://repo.or.cz (which also does not run vanilla gitweb, by the way)
also gives the same problems to lynx or w3m.


Oleg Verych wrote:
> On Sat, Mar 03, 2007 at 05:29:22AM -0800, Junio C Hamano wrote:
>>
>> I think the real question is if gitweb output need to be XHTML.
>> If everybody's browser is happier with text/html and we do not
>> have to use things only in xhtml, sending text/html out (both as
>> content-type and the actual contents) feels like the right thing
>> to do from compatibility point of view.
>
> Right XML (XHTML) isn't a tags soup as HTML is, so it's better. But
> "application/xml+xml+xml" is very silly, unless site's content uses
> dynamics, DOM, etc. As far as i can see, gitweb is not going to have
> javascript and such yet (because of compatibility/usability).

It would be nice to AJAX-ize blame view in gitweb (if it is enabled).

> Thus, fixing of http content negotiation is needed, or whatever is
> used in Perl for this.

By the way, the change to use 'application/xhtml+xml' is by Alp Toker,
made in commit f6801d669 with the following explanation:

    "The 'text/html' media type [RFC2854] is primarily for HTML, not for
    XHTML. In general, this media type is NOT suitable for XHTML."
    
    This patch makes gitweb use content negotiation to conservatively send
    pages as Content-Type 'application/xhtml+xml' when the user agent
    explicitly claims to support it.

Please discuss it with Alp, if is available.
-- 
Jakub Narebski
Poland

```

## Uwe Kleine-König, 2007-03-04 09:47

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <20070304094747.GA6550@informatik.uni-freiburg.de>
URL: https://gitlist.dev/e/20070304094747.GA6550%40informatik.uni-freiburg.de
In-Reply-To: <200703040149.45713.jnareb@gmail.com>

```
Hello,

Jakub Narebski wrote:
> There are two complications: first, sometimes http://www.kernel.org/git
> works with lynx (and links2, and w3m), and sometimes do not.
www.kernel.org is provided by 2 machines.  Some time ago I could fetch
from the one but not from the other.  Maybe you want to try to address
them explicitly?

Best regards
Uwe

-- 
Uwe Kleine-König

http://www.google.com/search?q=e+%5E+%28i+pi%29

```

## sf, 2007-03-08 15:31

Subject: Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx
Message-ID: <45F02C66.9010909@b-i-t.de>
URL: https://gitlist.dev/e/45F02C66.9010909%40b-i-t.de
In-Reply-To: <200703030357.18822.jnareb@gmail.com>

```
Jakub Narebski wrote:
...
> By "conservatively" it means that it uses 'application/xhtml+xml' only when
> client explicitly claims that it accepts its, and it is not due to for
> example */* accept globbing.

You may need something like the (not tested and line wrapped) patch 
below as well.

Regards

Stephan


diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 27b5970..6cc5c20 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1714,7 +1714,8 @@ sub git_header_html {
                 $content_type = 'text/html';
         }
         print $cgi->header(-type=>$content_type, -charset => 'utf-8',
-                          -status=> $status, -expires => $expires);
+                          -status=> $status, -expires => $expires,
+                          -Vary=> 'Accept');
         my $mod_perl_version = $ENV{'MOD_PERL'} ? " $ENV{'MOD_PERL'}" : '';
         print <<EOF;
  <?xml version="1.0" encoding="utf-8"?>

```
