Hi internals,

PR #22159 adds three libcurl callback options to ext/curl for 8.6:

  - CURLOPT_SOCKOPTFUNCTION
  - CURLOPT_OPENSOCKETFUNCTION
  - CURLOPT_CLOSESOCKETFUNCTION

https://github.com/php/php-src/pull/22159

Motivation: give PHP users a native way to do SSRF filtering (validate the
resolved peer IP before connect) and low-level socket tuning
(SO_BINDTODEVICE, SO_MARK, keepalive, TCP_NODELAY...) without dropping to
ext/ffi.

Because the C signatures use a raw curl_socket_t fd, the callbacks bridge
to ext/sockets and exchange real Socket objects, fully usable with
socket_set_option(), socket_close(), etc.

Thanks to @devnexen who helped me to improve the dependencies management
and the low level integration.
CI is fully green (Linux, macOS, FreeBSD, Windows, ASAN).

Feedback welcome on any matter.

Thanks,
Xavier Leune

Reply via email to