Skip to content

Conversation

krakjoe
Copy link
Member

@krakjoe krakjoe commented Sep 1, 2025

A request was made to expose cURL sockets to userland so they may be used in external event loops.

The original request suggested we use curls export of fdsets, this looked pretty restricted though when I came to implement it, and exporting the set for every select also didn't look very performant.

cURL has provided these API's for a long time, a very long time, and we have never implemented them, I'm not certain of the reasons for that.

This has reintroduced resources in cURL, but there's no other reasonable way to do this ...

To opt-in to socket management you must set a timer and socket function.

I'm not certain about this at all, looking for feedback on this approach.

I'm not certain of the consequences of manipulating these streams outside of select(), what happens if you read or write them is unclear.

php_stream *p_stream;

if (stream == NULL && what != CURL_POLL_REMOVE) {
p_stream = (void*) php_stream_fopen_from_fd(socket, "rw", NULL);
Copy link
Member Author

Choose a reason for hiding this comment

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

This should probably be read only.

@krakjoe krakjoe force-pushed the krakjoe/curl-socket-functions branch from 48ebc7b to 5842e34 Compare September 1, 2025 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant