Skip to content

Commit 0961926

Browse files
AyeshGirgias
authored andcommitted
[PHP 8.4] Curl: Add CURLOPT_PREREQFUNCTION optiona and constants
Commit: php/php-src#13255 PHP.Watch: [PHP 8.4: Curl: New `CURLOPT_PREREQFUNCTION` option](https://php.watch/versions/8.4/CURLOPT_PREREQFUNCTION)
1 parent f34918d commit 0961926

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

reference/curl/constants.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,6 +2284,28 @@
22842284
</simpara>
22852285
</listitem>
22862286
</varlistentry>
2287+
<varlistentry xml:id="constant.curl-prereqfunc-ok">
2288+
<term>
2289+
<constant>CURL_PREREQFUNC_OK</constant>
2290+
(<type>int</type>)
2291+
</term>
2292+
<listitem>
2293+
<simpara>
2294+
Available as of PHP 8.4.0 and cURL 7.80.0.
2295+
</simpara>
2296+
</listitem>
2297+
</varlistentry>
2298+
<varlistentry xml:id="constant.curl-prereqfunc-abort">
2299+
<term>
2300+
<constant>CURL_PREREQFUNC_ABORT</constant>
2301+
(<type>int</type>)
2302+
</term>
2303+
<listitem>
2304+
<simpara>
2305+
Available as of PHP 8.4.0 and cURL 7.80.0.
2306+
</simpara>
2307+
</listitem>
2308+
</varlistentry>
22872309
</variablelist>
22882310
&reference.curl.constants-curl-setopt;
22892311
&reference.curl.constants-curl-share-setopt;

reference/curl/constants_curl_setopt.xml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4442,4 +4442,78 @@
44424442
</para>
44434443
</listitem>
44444444
</varlistentry>
4445+
<varlistentry xml:id="constant.curlopt-prereqfunction">
4446+
<term>
4447+
<constant>CURLOPT_PREREQFUNCTION</constant>
4448+
(<type>int</type>)
4449+
</term>
4450+
<listitem>
4451+
<para>
4452+
A <type>callable</type> with the following signature that gets called after the
4453+
connection is established, but before the request payload (for example, the
4454+
GET/POST/DELETE request of an HTTP connection) is sent, and can be used to abort
4455+
or allow the connection depending on the source and destination IP address and
4456+
port numbers:
4457+
<methodsynopsis>
4458+
<type>int</type><methodname><replaceable>callback</replaceable></methodname>
4459+
<methodparam><type>CurlHandle</type><parameter>curlHandle</parameter></methodparam>
4460+
<methodparam><type>string</type><parameter>destination_ip</parameter></methodparam>
4461+
<methodparam><type>string</type><parameter>local_ip</parameter></methodparam>
4462+
<methodparam><type>int</type><parameter>destination_port</parameter></methodparam>
4463+
<methodparam><type>int</type><parameter>local_port</parameter></methodparam>
4464+
</methodsynopsis>
4465+
<variablelist role="function_parameters">
4466+
<varlistentry>
4467+
<term><parameter>curlHandle</parameter></term>
4468+
<listitem>
4469+
<simpara>
4470+
The cURL handle.
4471+
</simpara>
4472+
</listitem>
4473+
</varlistentry>
4474+
<varlistentry>
4475+
<term><parameter>destination_ip</parameter></term>
4476+
<listitem>
4477+
<simpara>
4478+
The primary IP of the remote server established with this connection.
4479+
For <acronym>FTP</acronym>, this is the IP for the control connection.
4480+
IPv6 addresses are represented without surrounding brackets.
4481+
</simpara>
4482+
</listitem>
4483+
</varlistentry>
4484+
<varlistentry>
4485+
<term><parameter>local_ip</parameter></term>
4486+
<listitem>
4487+
<simpara>
4488+
The originating IP for this connection.
4489+
IPv6 addresses are represented without surrounding brackets.
4490+
</simpara>
4491+
</listitem>
4492+
</varlistentry>
4493+
<varlistentry>
4494+
<term><parameter>destination_port</parameter></term>
4495+
<listitem>
4496+
<simpara>
4497+
The primary port number on the remote server established with this connection.
4498+
For <acronym>FTP</acronym>, this is the port for the control connection.
4499+
This can be a <acronym>TCP</acronym> or a <acronym>UDP</acronym> port number depending on the protocol.
4500+
</simpara>
4501+
</listitem>
4502+
</varlistentry>
4503+
<varlistentry>
4504+
<term><parameter>local_port</parameter></term>
4505+
<listitem>
4506+
<simpara>
4507+
The originating port number for this connection.
4508+
This can be a <acronym>TCP</acronym> or a <acronym>UDP</acronym> port number depending on the protocol.
4509+
</simpara>
4510+
</listitem>
4511+
</varlistentry>
4512+
</variablelist>
4513+
Return <constant>CURL_PREREQFUNC_OK</constant> to allow the request, or
4514+
<constant>CURL_PREREQFUNC_ABORT</constant> to abort the transfer.
4515+
Available as of PHP 8.4.0 and cURL 7.80.0.
4516+
</para>
4517+
</listitem>
4518+
</varlistentry>
44454519
</variablelist>

0 commit comments

Comments
 (0)