Skip to content

Commit bc3838b

Browse files
committed
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
2 parents 214919b + a262585 commit bc3838b

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

gitweb/gitweb.perl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4213,8 +4213,7 @@ sub git_header_html {
42134213
my %opts = @_;
42144214

42154215
my $title = get_page_title();
4216-
my $content_type = get_content_type_html();
4217-
print $cgi->header(-type=>$content_type, -charset => 'utf-8',
4216+
print $cgi->header(-type=>get_content_type_html(), -charset => 'utf-8',
42184217
-status=> $status, -expires => $expires)
42194218
unless ($opts{'-no_http_header'});
42204219
my $mod_perl_version = $ENV{'MOD_PERL'} ? " $ENV{'MOD_PERL'}" : '';
@@ -4225,7 +4224,6 @@ sub git_header_html {
42254224
<!-- git web interface version $version, (C) 2005-2006, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke -->
42264225
<!-- git core binaries version $git_version -->
42274226
<head>
4228-
<meta http-equiv="content-type" content="$content_type; charset=utf-8"/>
42294227
<meta name="generator" content="gitweb/$version git/$git_version$mod_perl_version"/>
42304228
<meta name="robots" content="index, nofollow"/>
42314229
<title>$title</title>

t/t9502-gitweb-standalone-parse-output.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ EOF
3434
#
3535
# This will check that gitweb HTTP header contains proposed filename
3636
# as <basename> with '.tar' suffix added, and that generated tarfile
37-
# (gitweb message body) has <prefix> as prefix for al files in tarfile
37+
# (gitweb message body) has <prefix> as prefix for all files in tarfile
3838
#
3939
# <prefix> default to <basename>
4040
check_snapshot () {
@@ -207,4 +207,17 @@ test_expect_success 'xss checks' '
207207
xss "" "$TAG+"
208208
'
209209

210+
no_http_equiv_content_type() {
211+
gitweb_run "$@" &&
212+
! grep -E "http-equiv=['\"]?content-type" gitweb.body
213+
}
214+
215+
# See: <https://html.spec.whatwg.org/dev/semantics.html#attr-meta-http-equiv-content-type>
216+
test_expect_success 'no http-equiv="content-type" in XHTML' '
217+
no_http_equiv_content_type &&
218+
no_http_equiv_content_type "p=.git" &&
219+
no_http_equiv_content_type "p=.git;a=log" &&
220+
no_http_equiv_content_type "p=.git;a=tree"
221+
'
222+
210223
test_done

0 commit comments

Comments
 (0)