Skip to content

Non-HTML: direct HTTP retrieval with Chromium escalation #11

Description

@pudo

Pravda should retrieve non-HTML resources without starting a browser unnecessarily, while retaining Chromium as a fallback for blocked or browser-dependent sources.

Add an auto retrieval mode:

  1. Attempt the URL through direct HTTP.
  2. Validate the response.
  3. Escalate to Chromium navigation when direct retrieval fails or returns unusable content.
  4. Return the first usable result and retain metadata for all attempts.

Initial resource support should include JSON, XML, CSV, spreadsheets, PDFs, and arbitrary downloads.

Behavior

  • Store response bodies unchanged in content-addressed storage.
  • Record requested and final URL, status, headers, media type, charset, size, retrieval mode, and capture time.
  • Follow redirects.
  • Enforce a configurable maximum response size.
  • Support expected media-type validation.
  • Escalate on exhausted transport errors, blocked responses, recognized challenge pages, or content-validation failure.
  • Do not escalate genuine 404 or 410 responses.
  • Record direct HTTP and Chromium attempts separately under the resulting snapshot.
  • Apply the same state, failure-cause, retry, and stale-fallback semantics as browser snapshots.

The first version should support GET only. Request bodies, authentication, persistent sessions, and browser-to-HTTP cookie transfer are out of scope.

Questions

  • Should auto, http, and browser be explicit request modes?
  • Which statuses and validation failures trigger Chromium escalation?
  • How are multiple attempts represented without duplicating the logical snapshot?
  • Should direct HTTP retrieval produce the same snapshot response model with browser-specific artifacts set to null?
  • Which response headers are safe and necessary to retain?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions