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

Re: [PATCH 2/2] gitweb: remove invalid http-equiv="content-type"

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 7, 2022, 23:24 UTC
Message-ID
<YiaUP3b3PJWZx+AY@camp.crustytoothpaste.net>
In-Reply-To
<20220307033723.175553-3-jason@jasonyundt.email>
On 2022-03-07 at 03:37:23, Jason Yundt wrote:
Show 15 quoted lines
> Before this change, gitweb would generate pages which included:
> 
> 	<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
> 
> A meta element with http-equiv="content-type" 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.

This change seems fine. We do specify this in the HTTP header, including the character set, which is what matters, so this should work in every browser, and the http-equiv is unneeded.

I also don't think we need a meta header here, since we have an XML declaration, and that's controlling in this situation. This isn't regular HTML and we don't declare it as such, so using a meta header to control this isn't correct: the XML declaration should be used instead in the event a user downloads this to a local disk and processes it outside the context of an HTTP request.

Since we control the HTTP headers, I'd actually argue that your test might well reject all http-equiv headers since they could be done much better with actual HTTP headers (and would therefore work with non-browser clients), but I don't think that's worth a reroll, nor do I think a test is even needed here (but bonus points for adding one).

So I think this looks good as is.  Thanks for the patch.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Previous: Jason YundtNext: Jason Yundt
Message 6 of 17 in “gitweb: remove invalid http-equiv="content-type"”
  1. 0/2 gitweb: remove invalid http-equiv="content-type"Jason Yundt, Mar 7, 2022
  2. 1/2 comment: fix typoJason Yundt, Mar 7, 2022
  3. 2/2 gitweb: remove invalid http-equiv="content-type"Jason Yundt, Mar 7, 2022
  4. Ævar Arnfjörð BjarmasonMar 7, 2022
  5. Jason YundtMar 7, 2022
  6. brian m. carlsonMar 7, 2022
  7. 0/2 gitweb: remove invalid http-equiv="content-type"Jason Yundt, Mar 8, 2022
  8. Junio C HamanoMar 8, 2022
  9. Jason YundtMar 8, 2022
  10. 0/2 gitweb: remove invalid http-equiv="content-type"Jason Yundt, Mar 8, 2022
  11. 2/2 gitweb: remove invalid http-equiv="content-type"Jason Yundt, Mar 8, 2022
  12. 1/2 comment: fix typoJason Yundt, Mar 8, 2022
  13. 2/2 gitweb: remove invalid http-equiv="content-type"Jason Yundt, Mar 8, 2022
  14. brian m. carlsonMar 8, 2022
  15. Ævar Arnfjörð BjarmasonMar 8, 2022
  16. Jason YundtMar 8, 2022
  17. 1/2 comment: fix typoJason Yundt, Mar 8, 2022

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.