gitweb: remove invalid http-equiv="content-type"

Before this change, gitweb would generate pages which included:

	<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>

When a meta's http-equiv equals "content-type", the http-equiv is said
to be in the "Encoding declaration state". According to the HTML
Standard,

	The Encoding declaration state may be used in HTML documents,
	but elements with an http-equiv attribute in that state must not
	be used in XML documents.

	Source: <https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-content-type>

This change removes that meta element since gitweb always generates XML
documents.

Signed-off-by: Jason Yundt <jason@jasonyundt.email>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jason Yundt
2022-03-08 10:56:12 -05:00
committed by Junio C Hamano
parent 943fd02769
commit a262585d81
2 changed files with 14 additions and 3 deletions

View File

@ -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