Skip to content

Releases: cloudflare/lol-html

v3.0.0

02 Jun 09:14

Choose a tag to compare

  • Added MemorySettings::with_graceful_bail_out_on_memory_limit_exceeded(): when set, the
    rewriter flushes every input byte it has received but not yet emitted to the sink (as-is)
    before returning MemoryLimitExceededError, so callers can continue the response by
    writing subsequent bytes directly to their downstream sink instead of breaking it.
  • Added Settings::with_graceful_bail_out_on_content_handler_error(): symmetric to the
    memory setting above, but for RewritingError::ContentHandlerError. When set, the
    rewriter flushes remaining input bytes before propagating a handler error, preserving
    the response. Currently exposed via the Rust API only; the C API still uses the original
    behavior.
  • Added Settings::append_bail_out_handler() and the matching bail_out! macro,
    BailOut rewritable unit, and BailOutHandler / BailOutHandlerSend type aliases.
    Bail-out handlers fire immediately before the raw flush of remaining unparsed input on a
    graceful bail-out (memory or content-handler error). Handlers receive the
    RewritingError and a BailOut through which they can append final bytes to the sink
    via BailOut::append(content, content_type). Intended for handlers that buffer state
    across the document (e.g. text-buffering handlers that defer emission) and need to
    flush that state on bail-out.
  • Marked RewritingError #[non_exhaustive] so future error variants can be added without
    a major version bump. External callers can still match on it, but must include a
    catch-all _ => arm.
  • Reworked Settings, MemorySettings and RewriteStrSettings to use a consuming-builder
    API. Fields are now private; construction is via ::new() plus chained with_* setters
    and append_* methods for the content-handler vectors. This makes future field additions
    non-breaking. Migration:
    // before
    Settings {
        element_content_handlers: vec![element!("div", |el| { /* ... */ Ok(()) })],
        strict: false,
        ..Settings::new()
    }
    // after
    Settings::new()
        .with_strict(false)
        .append_element_content_handler(element!("div", |el| { /* ... */ Ok(()) }))
  • Renamed the internal-use feature integration_test to _integration_test. The leading
    underscore signals to cargo-semver-checks and similar tools that the feature is not
    part of the public API.
  • Comment::set_text now also rejects --!>, a leading >, and a leading ->, which
    WHATWG-conformant browsers treat as comment terminators. Previously only --> was
    rejected, so a caller passing attacker-influenced data could let an attacker break out
    of the comment and inject HTML (security fix).

v2.9.0

06 May 15:46

Choose a tag to compare

What's Changed

  • Added OutputSink::set_encoding #315
  • Made rewrite_str ignore conflicting encodings #316
  • Added name_source_location() and value_source_location() to Attribute by @gmalette in #313

New Contributors

Full Changelog: v2.8.1...v2.9.0

v2.8.1

27 Apr 13:02

Choose a tag to compare

What's Changed

  • Added support for nested :not() with simple selectors. #304
  • Added on_end_tag convenience method #308
  • Reduced allocations in #306 #307 #309

v2.7.2

22 Feb 12:01

Choose a tag to compare

  • Replaced several panicking assertions with gracefully reported errors, especially in the C API.

v2.7.1

08 Jan 14:31

Choose a tag to compare

  • Performance improvements.
  • Updated dependencies.

v2.7.0

08 Jan 14:31

Choose a tag to compare

  • Improve type generation in js-api.
  • Updated dependencies.

v2.6.0

18 Jul 12:18

Choose a tag to compare

  • Added source code locations to the C and JS APIs.
  • Significant performance improvements and code size reductions.

v2.5.0

23 Jun 13:29

Choose a tag to compare

  • Source code locations for tags and other tokens.
  • Document text chunks and escaping of attributes.
  • Selector validation improvements.

v2.4.0

22 May 14:58
3baadd2

Choose a tag to compare

  • Upgraded selectors and cssparser.

v2.3.0

22 Apr 11:39
27e7556

Choose a tag to compare

  • Added element.onEndTag to JS bindings.
  • Refactored TextDecoder and token construction to avoid heap allocations.
  • Added fast paths for UTF-8 rewrites.