Skip to content

audit: the --max-duration parse cap compares the encoded size, so a small gzip body that inflates past 5 MiB is parsed #1497

Closed

Description

@nc9

Summary

--max-duration does not parse a page whose HTML is over 5 MiB, because a parse cannot be interrupted. The check compares the page's recorded sizeBytes, which is the Content-Length header, the ENCODED size. A response with Content-Encoding: gzip and a Content-Length of a few KB that inflates to megabytes is therefore parsed in full under --max-duration, which is the cost the cap exists to avoid. The same wire size is used in three places: the crawler's parse gate, the audit pass's site context, and the streaming pass that counts and lists the pages left out.

Found in a review of the released code; confirmed by a local-server probe (a gzip body of about 1 KB on the wire that inflates past the cap was parsed and its links followed).

Acceptance Criteria

  • A gzip response with a small Content-Length that inflates past the cap is not parsed by the crawler under --max-duration: its links are not followed and it is stored without parsed data (a crawler test through crawler.start() against a local server, failing on the current code).
  • The same page is judged too large by the audit passes: buildSiteContext leaves it unparsed, and the streaming pass counts it in pagesTooLarge and lists it in tooLargePages (tests failing on the current code).
  • A multi-byte page whose character count is under the cap and whose UTF-8 bytes are over it is not parsed either.
  • A page under the cap, gzip or plain, is still parsed and its links followed; a run without --max-duration is unchanged.
  • The docs say the 5 MiB is the decoded size; CHANGELOG entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrulessize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions