Skip to content

API: readonly calls and callbacks - #23096

Closed
icing wants to merge 1 commit into
curl:masterfrom
icing:api-readonly-checks
Closed

icing wants to merge 1 commit into
curl:masterfrom
icing:api-readonly-checks

Conversation

@icing

@icing icing commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Replace the "in event callback" concept with a flag that makes callback enforce "read only" mode. All easy calls that do not modify the easy handle are marked as "read only".

With a "readonly" callback active, only "readonly" easy calls can be made.

This extends the restrictions from the "event" callbacks to the "debug" callback as well. Any modifications to an easy handle during event/debug callbacks is now denied.

Formerly, we only restricted curl_easy_pause(), but now the list of blocked calls is much larger. There is a risk to that, but we call "debug" from possibly all cases and are not able to handle modifications in that call safely.

@icing icing added the feature-window A merge of this requires an open feature window label Sep 25, 2026
Replace the "in event callback" concept with a flag that makes
callback enforce "read only" mode. All easy calls that do not
modify the easy handle are marked as "reasd only".

With a "readonly" callback active, only "readonly" easy calls
can be made.

This extends the restrictions from the "event" callbacks to
the "debug" callback as well. Any modifications to an easy handle
during event/debug callbacks is now denied.

Formerly, we only restricted curl_easy_pause(), but now the
list of blocked calls is much larger. THere is a risk to that,
but we call "debug" from possibly all cases and are not able
to handle modifications in that call safely.
@icing icing added libcurl API and removed feature-window A merge of this requires an open feature window labels Oct 19, 2026
@icing
icing force-pushed the api-readonly-checks branch from 2c359d6 to add214f Compare October 19, 2026 10:24
@icing
icing requested review from bagder and vszakats October 19, 2026 10:38
@bagder
bagder requested a balanced review from Copilot October 19, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Debug callbacks on easy handles without a multi association still bypass read-only enforcement.

1 open issue
What changed in this PR

Replaces event-specific API restrictions with read-only callback enforcement for libcurl easy handles.

Changes:

  • Marks non-mutating easy APIs as read-only.
  • Extends callback restrictions to debug callbacks and blocks additional mutating calls.
File Description
lib/​api.c Defines read-only API properties and enforces callback restrictions.

Review effort: Balanced

Comment thread lib/api.c Resolved
@icing
icing requested a review from bagder October 20, 2026 07:04
@bagder bagder closed this in 09ef0f3 Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants