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

[PATCH] gitweb: check if HTTP_ACCEPT is really set

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Aug 6, 2006, 13:55 UTC
Message-ID
<20060806135502.GA13840@moooo.ath.cx>
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
If the client does not send Accept: HTTP_ACCEPT is undefined and there
is a warning:
Use of uninitialized value in pattern match (m//) at line 862.
---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f85dc7d..1f4b0f5 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -859,7 +859,7 @@ sub git_header_html {
 	# '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) {
+	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';
-- 
1.4.2.rc3.g2f52
Message 1 of 1 in “gitweb: check if HTTP_ACCEPT is really set”
  1. gitweb: check if HTTP_ACCEPT is really setMatthias Lederhofer, Aug 6, 2006

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.