All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Typo fix
@ 2006-07-11 10:19 Alp Toker
  2006-07-11 10:19 ` [PATCH] gitweb: Send XHTML as 'application/xhtml+xml' where possible Alp Toker
  2006-07-11 22:37 ` [PATCH] Typo fix Pavel Roskin
  0 siblings, 2 replies; 21+ messages in thread
From: Alp Toker @ 2006-07-11 10:19 UTC (permalink / raw)
  To: git

Signed-off-by: Alp Toker <alp@atoker.com>
---
 Documentation/git-name-rev.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt
index 43f8c25..37fbf66 100644
--- a/Documentation/git-name-rev.txt
+++ b/Documentation/git-name-rev.txt
@@ -33,7 +33,7 @@ EXAMPLE
 -------
 
 Given a commit, find out where it is relative to the local refs. Say somebody
-wrote you about that phantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a.
+wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a.
 Of course, you look into the commit, but that only tells you what happened, but
 not the context.
 
-- 
1.4.1.g97c7-dirty

^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] gitweb: Send XHTML as 'application/xhtml+xml' where possible
@ 2006-07-09 14:55 Alp Toker
  0 siblings, 0 replies; 21+ messages in thread
From: Alp Toker @ 2006-07-09 14:55 UTC (permalink / raw)
  To: git

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

It falls back to 'text/html' even if the user agent appears to
implicitly support 'application/xhtml+xml' due to a '*/*' glob, working
around an insidious bug in Internet Explorer where sending the correct
media type prevents the page from being displayed.

Signed-off-by: Alp Toker <alp@atoker.com>
---
 gitweb/gitweb.cgi |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 3e2790c..beb8061 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -290,7 +290,17 @@ sub git_header_html {
 			}
 		}
 	}
-	print $cgi->header(-type=>'text/html',  -charset => 'utf-8', -status=> $status, -expires => $expires);
+	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 ($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';
+	}
+	print $cgi->header(-type=>$content_type,  -charset => 'utf-8', -status=> $status, -expires => $expires);
 	print <<EOF;
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -298,7 +308,7 @@ sub git_header_html {
 <!-- git web interface v$version, (C) 2005-2006, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke -->
 <!-- git core binaries version $git_version -->
 <head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+<meta http-equiv="content-type" content="$content_type; charset=utf-8"/>
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
 <link rel="stylesheet" type="text/css" href="$stylesheet"/>
-- 
1.4.1.gbe4c7

^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] gitweb: Send XHTML as 'application/xhtml+xml' where possible
@ 2006-07-09  9:41 Alp Toker
  2006-07-09 10:36 ` Junio C Hamano
  0 siblings, 1 reply; 21+ messages in thread
From: Alp Toker @ 2006-07-09  9:41 UTC (permalink / raw)
  To: git

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

It falls back to 'text/html' even if the user agent claims to support
'application/xhtml+xml' by means of a glob in order to work around an
insidious Internet Explorer bug.

Signed-off-by: Alp Toker <alp@atoker.com>
---
 gitweb/gitweb.cgi |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 3e2790c..3206435 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -290,7 +290,8 @@ sub git_header_html {
 			}
 		}
 	}
-	print $cgi->header(-type=>'text/html',  -charset => 'utf-8', -status=> $status, -expires => $expires);
+	my $content_type = ($cgi->http('HTTP_ACCEPT') =~ m/(,|;|\s|^)application\/xhtml\+xml(,|;|\s|$)/ && $cgi->Accept('application/xhtml+xml') ne 0) ? 'application/xhtml+xml' : 'text/html';
+	print $cgi->header(-type=>$content_type,  -charset => 'utf-8', -status=> $status, -expires => $expires);
 	print <<EOF;
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -298,7 +299,7 @@ sub git_header_html {
 <!-- git web interface v$version, (C) 2005-2006, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke -->
 <!-- git core binaries version $git_version -->
 <head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+<meta http-equiv="content-type" content="$content_type; charset=utf-8"/>
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
 <link rel="stylesheet" type="text/css" href="$stylesheet"/>
-- 
1.4.1.gbe4c7

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2006-07-12  0:01 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-11 10:19 [PATCH] Typo fix Alp Toker
2006-07-11 10:19 ` [PATCH] gitweb: Send XHTML as 'application/xhtml+xml' where possible Alp Toker
2006-07-11 10:19   ` [PATCH] gitweb: Include a site name in page titles Alp Toker
2006-07-11 10:19     ` [PATCH] gitweb: Use the git binary in the search path by default Alp Toker
2006-07-11 10:19       ` [PATCH] git-send-email: Remove redundant Reply-To header Alp Toker
2006-07-11 10:19         ` [PATCH] Install built-ins as symlinks Alp Toker
2006-07-11 11:15           ` Andreas Ericsson
2006-07-11 14:16           ` Johannes Schindelin
2006-07-11 14:58             ` Alp Toker
2006-07-11 18:02               ` Johannes Schindelin
2006-07-11 18:48                 ` Petr Baudis
2006-07-12  0:01                   ` Alex Riesen
2006-07-11 18:36           ` Petr Baudis
2006-07-11 19:56       ` [PATCH] gitweb: Use the git binary in the search path by default Junio C Hamano
2006-07-11 11:48     ` [PATCH] gitweb: Include a site name in page titles Martin Langhoff
2006-07-11 19:48       ` Junio C Hamano
2006-07-11 22:37 ` [PATCH] Typo fix Pavel Roskin
  -- strict thread matches above, loose matches on Subject: below --
2006-07-09 14:55 [PATCH] gitweb: Send XHTML as 'application/xhtml+xml' where possible Alp Toker
2006-07-09  9:41 Alp Toker
2006-07-09 10:36 ` Junio C Hamano
2006-07-09 11:18   ` Alp Toker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.