From 28d2b5b07815a9f7ce54576d09d516b6b14b2fa3 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 23 Feb 2016 17:31:08 +0100 Subject: [PATCH 1/2] Limit the encoding detection to 3 bytes for now. This is intended to avoid issues when there's a parser-blocking script in the first 1024 bytes. See also #198. --- src/driver.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/driver.rs b/src/driver.rs index d70d92de..4e9b5b6a 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -264,8 +264,8 @@ impl TendrilSink for BytesParser { } /// How many bytes does detect_encoding() need -// NOTE: 3 would be enough for a BOM, but 1024 is specified for elements. -const PRESCAN_BYTES: u32 = 1024; +// FIXME(#18): should be 1024 for elements. +const PRESCAN_BYTES: u32 = 3; /// https://html.spec.whatwg.org/multipage/syntax.html#determining-the-character-encoding fn detect_encoding(bytes: &ByteTendril, opts: &BytesOpts) -> EncodingRef { @@ -281,7 +281,7 @@ fn detect_encoding(bytes: &ByteTendril, opts: &BytesOpts) -> EncodingRef { if let Some(encoding) = opts.transport_layer_encoding { return encoding } - // FIXME: etc. + // FIXME(#18): etc. return encoding::all::UTF_8 } From 199a84a4592fd2970a164ae5e63b6bc701b27097 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 23 Feb 2016 17:39:54 +0100 Subject: [PATCH 2/2] Bump to 0.5.3. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5b651714..453f01fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "html5ever" -version = "0.5.2" +version = "0.5.3" authors = [ "The html5ever Project Developers" ] license = "MIT / Apache-2.0" repository = "https://github.com/servo/html5ever"