cloudflare / cloudflare/lol-html

Control over buffering of comments

Open
#272 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.1k
Forks
111
PR merge metrics
No merged PRs in 30d

Description

Currently comments are buffered entirely for the comment handler.

Documents with pathologically long comments can hit the memory limit, and the user has no way of preventing that, other than not using comment handlers.

It's wasteful and unnecessary if the handler intends to remove comments.

I think we could add some control for it, e.g. add a configurable maximum length of comment to buffer. If the comment is longer than this, then discard the entire comment (with 0 buffer len acting as automatic comment removal). Another option could be to split the comment and handle it in fragments, but that would be as complicated as text chunks (#256).

Contributor guide

Open the contributing guide

Research direction

Read the comment-handler buffering path and compare the text-chunks work referenced in #256. Decide whether the feature should discard comments beyond a configurable maximum, treat zero as automatic removal, or split comments into fragments; done means the chosen behavior prevents unbounded comment buffering while preserving handler control.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.