Skip to content

feat: add HTTP client foundation and configuration - #14546

Open
algebraic-dev wants to merge 5 commits into
masterfrom
sofia/async-http-client-config
Open

feat: add HTTP client foundation and configuration#14546
algebraic-dev wants to merge 5 commits into
masterfrom
sofia/async-http-client-config

Conversation

@algebraic-dev

@algebraic-dev algebraic-dev commented Jul 25, 2026

Copy link
Copy Markdown
Member

This PR adds the basic structure for the HTTP client, including client configuration, possible errors, and small changes to other modules.

@algebraic-dev algebraic-dev self-assigned this Jul 25, 2026
@algebraic-dev
algebraic-dev requested a review from TwoFX as a code owner July 25, 2026 12:17
@algebraic-dev algebraic-dev changed the title feat: add HTTP client config and base changes to the client feat: add HTTP client foundation and configuration Jul 25, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jul 25, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Jul 25, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 366c0a8ba4f6d6445c8f9383c4fab0a4be1cbc9d --onto 3259610687883ec1ea48c481aba2469f2f83facf. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-25 13:46:50)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 6832de296014011d0f126e3fa32a8366b5299b35 --onto 0bfc3acaef4ed0576307a77fbaa0c6e1a5dca402. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-27 14:40:24)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 6832de296014011d0f126e3fa32a8366b5299b35 --onto 110db9cb751afaee8b2ac344887d6c7e632f77b4. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-03 23:01:11)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 6832de296014011d0f126e3fa32a8366b5299b35 --onto f2bcf2e8660ab2d16cf3cb50c8e127de0439a337. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-05 16:22:18)

@leanprover-bot

leanprover-bot commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 366c0a8ba4f6d6445c8f9383c4fab0a4be1cbc9d --onto fed67d987430595cddf0ee209f0b12dc69f182b5. You can force reference manual CI using the force-manual-ci label. (2026-07-25 13:46:52)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 6832de296014011d0f126e3fa32a8366b5299b35 --onto 0bfc3acaef4ed0576307a77fbaa0c6e1a5dca402. You can force reference manual CI using the force-manual-ci label. (2026-07-27 14:40:25)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 6832de296014011d0f126e3fa32a8366b5299b35 --onto 23393b959b33e3a8d15796b2397f8a04c315b9f4. You can force reference manual CI using the force-manual-ci label. (2026-08-03 23:01:12)

Comment thread src/Std/Http/Data/Body/Stream.lean Outdated
Comment thread src/Std/Http/Client/Config.lean Outdated
Comment thread src/Std/Http/Client/Config.lean Outdated
Comment on lines +205 to +214
/--
When `true`, automatic redirect following is restricted to requests whose
original method is safe (RFC 9110 §9.2.1: GET, HEAD, OPTIONS, TRACE).
Redirects for unsafe methods (POST, PUT, DELETE, PATCH, …) are not followed
automatically — the response is returned as-is for the caller to handle.

Defaults to `false` so that the standard 301/302 POST→GET downgrade and
307/308 method-preserving redirects work out of the box.
-/
onlySafeRedirects : Bool := false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific motivation for this feature? Is it inspired by an HTTP client in a different language?

Either way, the semantics seem debatable here. It seems that if we're downgrading anyway, then following the redirect should be fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's good for avoiding repeating the redirect when something has a non-idempotent method, like payments or things like that, where we can't allow the operation to happen twice. Maybe I should change it to a validation function that runs on every redirect and decides whether it should change like in golang.

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

Labels

changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants