threads / discuss / 7038

RE: gitweb not friendly to firefox?

Subject: RE: gitweb not friendly to firefox?

## tl;dr

24 messages between Mar 1, 2007 and Mar 8, 2007.

replies: 23people: 10as markdown or json

Eygene Ryabinkin· Mar 1, 2007, 14:00 UTC · lore

Re: gitweb not friendly to firefox?

Show 7 quoted lines
> > 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· Mar 1, 2007, 14:26 UTC · re: Eygene Ryabinkin · lore
Show 7 quoted lines
> 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· Mar 2, 2007, 02:28 UTC · re: Eygene Ryabinkin · lore
Show 9 quoted lines
> -----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
Show 9 quoted lines
> > 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· Mar 2, 2007, 04:40 UTC · re: Li Yang-r58472 · lore

Re: gitweb not friendly to firefox?

"Li Yang-r58472" <LeoLi@freescale.com> writes:
Show 5 quoted lines
>> 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· Mar 2, 2007, 06:47 UTC · re: Junio C Hamano · lore
Show 12 quoted lines
> -----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· Mar 2, 2007, 06:51 UTC · re: Li Yang-r58472 · lore

Re: gitweb not friendly to firefox?

"Li Yang-r58472" <LeoLi@freescale.com> writes:
Show 10 quoted lines
>> > 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· Mar 2, 2007, 09:36 UTC · re: Junio C Hamano · lore
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· Mar 2, 2007, 10:17 UTC · re: Li Yang-r58472 · lore

Re: gitweb not friendly to firefox?

"Li Yang-r58472" <LeoLi@freescale.com> writes:
Show 22 quoted lines
> 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· Mar 2, 2007, 10:27 UTC · re: Junio C Hamano · lore
Show 5 quoted lines
> -----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
Show 7 quoted lines
> 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
Show 35 quoted lines
> > 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· Mar 2, 2007, 16:19 UTC · re: Junio C Hamano · lore

(Re: gitweb not friendly to firefox?) and unusable in the lynx

> 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· Mar 3, 2007, 02:57 UTC · re: Oleg Verych · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

Oleg Verych wrote:
Show 12 quoted lines
>> 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· Mar 3, 2007, 03:25 UTC · re: Jakub Narebski · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

On Sat, 3 Mar 2007, Jakub Narebski wrote:
Show 5 quoted lines
> 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· Mar 3, 2007, 03:41 UTC · re: Nicolas Pitre · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

Nicolas Pitre wrote:
Show 12 quoted lines
> 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· Mar 3, 2007, 03:49 UTC · re: Jakub Narebski · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

On Sat, 3 Mar 2007, Jakub Narebski wrote:
Show 22 quoted lines
> 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· Mar 3, 2007, 03:58 UTC · re: Nicolas Pitre · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

[some Cc dropped]
Nicolas Pitre wrote:
Show 29 quoted lines
> 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· Mar 3, 2007, 04:34 UTC · re: Jakub Narebski · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

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
Jakub Narebski· Mar 4, 2007, 00:49 UTC · re: Nicolas Pitre · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

Nicolas Pitre wrote:
Show 10 quoted lines
> 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:
Show 12 quoted lines
> 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· Mar 4, 2007, 09:47 UTC · re: Jakub Narebski · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

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
Nicolas Pitre· Mar 3, 2007, 05:09 UTC · re: Nicolas Pitre · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

On Fri, 2 Mar 2007, Nicolas Pitre wrote:
Show 5 quoted lines
> 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· Mar 3, 2007, 13:04 UTC · re: Nicolas Pitre · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

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· Mar 3, 2007, 13:25 UTC · re: Nicolas Pitre · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

Hi,
On Sat, 3 Mar 2007, Nicolas Pitre wrote:
Show 22 quoted lines
> 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· Mar 3, 2007, 13:29 UTC · re: Nicolas Pitre · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

Nicolas Pitre <nico@cam.org> writes:
Show 12 quoted lines
> 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· Mar 3, 2007, 14:19 UTC · re: Junio C Hamano · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

On Sat, Mar 03, 2007 at 05:29:22AM -0800, Junio C Hamano wrote:
Show 21 quoted lines
> 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. ____

sf· Mar 8, 2007, 15:31 UTC · re: Jakub Narebski · lore

Re: (Re: gitweb not friendly to firefox?) and unusable in the lynx

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"?>

← back to recent threads