diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-21 15:14:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-21 15:14:24 -0700 |
commit | bc3838b310b32081d48393ba0dcf26e4735c6d19 (patch) | |
tree | 12eff6ed68a46a741b14b7bd68104e5714111d7f | |
parent | Merge branch 'pw/single-key-interactive' (diff) | |
parent | gitweb: remove invalid http-equiv="content-type" (diff) | |
download | tgif-bc3838b310b32081d48393ba0dcf26e4735c6d19.tar.xz |
Merge branch 'jy/gitweb-no-need-for-meta'
Remove unneeded <meta http-equiv=content-type...> from gitweb
output.
* jy/gitweb-no-need-for-meta:
gitweb: remove invalid http-equiv="content-type"
comment: fix typo
-rwxr-xr-x | gitweb/gitweb.perl | 4 | ||||
-rwxr-xr-x | t/t9502-gitweb-standalone-parse-output.sh | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index fbd1c20a23..606b50104c 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -4213,8 +4213,7 @@ sub git_header_html { my %opts = @_; my $title = get_page_title(); - my $content_type = get_content_type_html(); - print $cgi->header(-type=>$content_type, -charset => 'utf-8', + print $cgi->header(-type=>get_content_type_html(), -charset => 'utf-8', -status=> $status, -expires => $expires) unless ($opts{'-no_http_header'}); my $mod_perl_version = $ENV{'MOD_PERL'} ? " $ENV{'MOD_PERL'}" : ''; @@ -4225,7 +4224,6 @@ sub git_header_html { <!-- git web interface version $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="$content_type; charset=utf-8"/> <meta name="generator" content="gitweb/$version git/$git_version$mod_perl_version"/> <meta name="robots" content="index, nofollow"/> <title>$title</title> diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh index 3167473b30..8cb582f0e6 100755 --- a/t/t9502-gitweb-standalone-parse-output.sh +++ b/t/t9502-gitweb-standalone-parse-output.sh @@ -34,7 +34,7 @@ EOF # # This will check that gitweb HTTP header contains proposed filename # as <basename> with '.tar' suffix added, and that generated tarfile -# (gitweb message body) has <prefix> as prefix for al files in tarfile +# (gitweb message body) has <prefix> as prefix for all files in tarfile # # <prefix> default to <basename> check_snapshot () { @@ -207,4 +207,17 @@ test_expect_success 'xss checks' ' xss "" "$TAG+" ' +no_http_equiv_content_type() { + gitweb_run "$@" && + ! grep -E "http-equiv=['\"]?content-type" gitweb.body +} + +# See: <https://html.spec.whatwg.org/dev/semantics.html#attr-meta-http-equiv-content-type> +test_expect_success 'no http-equiv="content-type" in XHTML' ' + no_http_equiv_content_type && + no_http_equiv_content_type "p=.git" && + no_http_equiv_content_type "p=.git;a=log" && + no_http_equiv_content_type "p=.git;a=tree" +' + test_done |