Skip to content

Commit 0beea4f

Browse files
committed
Update curl/funchand
1 parent 0d41b9d commit 0beea4f

File tree

11 files changed

+180
-74
lines changed

11 files changed

+180
-74
lines changed

reference/curl/constants_curl_setopt.xml

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
</term>
143143
<listitem>
144144
<para>
145-
包含一个或多个证书的文件名称的<type>string</type>,用于验证对等方。这仅在与
145+
包含一个或多个证书的文件名称的 <type>string</type>,用于验证对等方。这仅在与
146146
<constant>CURLOPT_SSL_VERIFYPEER</constant> 结合使用时才有意义。可能需要绝对路径。自
147147
cURL 7.4.2 起可用。
148148
</para>
@@ -350,21 +350,12 @@
350350
</term>
351351
<listitem>
352352
<para>
353-
Pass a <type>string</type> naming a file with the concatenation of
354-
CRL (Certificate Revocation List) (in PEM format)
355-
to use in the certificate validation that occurs during the SSL exchange.
356-
When cURL is built to use GnuTLS,
357-
there is no way to influence the use of CRL passed
358-
to help in the verification process.
359-
When cURL is built with OpenSSL support,
360-
<literal>X509_V_FLAG_CRL_CHECK</literal>
361-
and <literal>X509_V_FLAG_CRL_CHECK_ALL</literal> are both set,
362-
requiring CRL check against all the elements of the certificate chain
363-
if a CRL file is passed.
364-
Also note that <constant>CURLOPT_CRLFILE</constant> implies
365-
<constant>CURLSSLOPT_NO_PARTIALCHAIN</constant>
366-
as of cURL 7.71.0 due to an OpenSSL bug.
367-
Available as of cURL 7.19.0.
353+
传递 <type>string</type>,指定包含 CRL(证书吊销列表)(PEM 格式)的文件名,用于在 SSL
354+
交换期间进行证书验证。当 cURL 构建为使用 GnuTLS 时,无法影响传递的 CRL 在验证过程中的使用。当
355+
cURL 构建为支持 OpenSSL 时,会同时设置 <literal>X509_V_FLAG_CRL_CHECK</literal> 和
356+
<literal>X509_V_FLAG_CRL_CHECK_ALL</literal>,要求在传递 CRL 文件时对证书链的所有元素进行
357+
CRL 检查。另请注意,由于 OpenSSL 的 bug,自 cURL 7.71.0 起,<constant>CURLOPT_CRLFILE</constant>
358+
隐含 <constant>CURLSSLOPT_NO_PARTIALCHAIN</constant>。自 cURL 7.19.0 起可用。
368359
</para>
369360
</listitem>
370361
</varlistentry>
@@ -405,16 +396,10 @@
405396
</term>
406397
<listitem>
407398
<para>
408-
Setting this option to <literal>1</literal> will have different effects
409-
based on the protocol it is used with.
410-
FTP and SFTP based URLs will list only the names of files in a directory.
411-
POP3 will list the email message or messages on the POP3 server.
412-
For FILE, this option has no effect
413-
as directories are always listed in this mode.
414-
Using this option with <constant>CURLOPT_WILDCARDMATCH</constant>
415-
will prevent the latter from having any effect.
416-
Defaults to <literal>0</literal>.
417-
Available as of cURL 7.17.0.
399+
将此选项设置为 <literal>1</literal> 时,其效果会因所使用的协议而异。基于 FTP 和 SFTP 的 URL
400+
将仅列出目录中的文件名。POP3 将列出 POP3 服务器上的电子邮件或邮件列表。对于 FILE
401+
协议,此选项无效,因为在此模式下会始终列出目录。将此选项与 <constant>CURLOPT_WILDCARDMATCH</constant>
402+
一起使用时,后者将不会产生任何效果。默认值为 <literal>0</literal>。自 cURL 7.17.0 起可用。
418403
</para>
419404
</listitem>
420405
</varlistentry>
@@ -425,9 +410,7 @@
425410
</term>
426411
<listitem>
427412
<para>
428-
&true; to not allow URLs that include a username.
429-
Usernames are allowed by default.
430-
Available as of PHP 7.3.0 and cURL 7.61.0.
413+
设置为 &true; 时,URL 中不允许包含 username。默认情况下允许 username。自 PHP 7.3.0 和 cURL 7.61.0 起可用。
431414
</para>
432415
</listitem>
433416
</varlistentry>

reference/curl/functions/curl-reset.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd Maintainer: 胡搞 Status: ready -->
3+
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: 胡搞 Status: ready -->
44
<!-- CREDITS: mowangjuanzi -->
55
<refentry xml:id="function.curl-reset" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -71,9 +71,6 @@ curl_reset($ch);
7171
// 发送 HTTP 请求
7272
curl_setopt($ch, CURLOPT_URL, 'http://example.com/');
7373
curl_exec($ch); // 预先设置的 user-agent 不会被发送,它已经被 curl_reset 重置掉了
74-
75-
// 关闭句柄
76-
curl_close($ch);
7774
?>
7875
]]>
7976
</programlisting>

reference/curl/functions/curl-setopt-array.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 184f3f7bd45643cb80f828d0bb001991ec3a5fad Maintainer: daijie Status: ready -->
3+
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: daijie Status: ready -->
44
<!-- CREDITS: mowangjuanzi -->
55
<refentry xml:id="function.curl-setopt-array" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -82,9 +82,6 @@ curl_setopt_array($ch, $options);
8282
8383
// 抓取 URL 并把它传递给浏览器
8484
curl_exec($ch);
85-
86-
// 关闭 cURL 资源,并且释放系统资源
87-
curl_close($ch);
8885
?>
8986
]]>
9087
</programlisting>

reference/curl/functions/curl-setopt.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 0d3cf0dbf9bc908100103917f8485581c50bd36b Maintainer: daijie Status: ready -->
3+
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: daijie Status: ready -->
44
<!-- CREDITS: mowangjuanzi, Luffy -->
55
<refentry xml:id="function.curl-setopt" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -141,9 +141,6 @@ curl_setopt($ch, CURLOPT_HEADER, false);
141141
142142
// 抓取URL并把它传递给浏览器
143143
curl_exec($ch);
144-
145-
//关闭cURL资源,并且释放系统资源
146-
curl_close($ch);
147144
?>
148145
]]>
149146
</programlisting>

reference/curl/functions/curl-share-close.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 52dc204a77076e1404257cf39f179882b90b5780 Maintainer: duanxiaoqiang Status: ready -->
3+
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: duanxiaoqiang Status: ready -->
44
<!-- CREDITS: mowangjuanzi -->
55
<refentry xml:id="function.curl-share-close" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
77
<refname>curl_share_close</refname>
88
<refpurpose>关闭 cURL 共享句柄</refpurpose>
99
</refnamediv>
1010

11+
<refsynopsisdiv>
12+
&warn.deprecated.function-8-5-0;
13+
</refsynopsisdiv>
14+
1115
<refsect1 role="description">
1216
&reftitle.description;
1317
<methodsynopsis>
18+
<modifier role="attribute">#[\Deprecated]</modifier>
1419
<type>void</type><methodname>curl_share_close</methodname>
1520
<methodparam><type>CurlShareHandle</type><parameter>share_handle</parameter></methodparam>
1621
</methodsynopsis>
@@ -84,10 +89,6 @@ curl_exec($ch2);
8489
8590
// Close the cURL share handle
8691
curl_share_close($sh);
87-
88-
// Close the cURL handles
89-
curl_close($ch1);
90-
curl_close($ch2);
9192
?>
9293
]]>
9394
</programlisting>
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- EN-Revision: 9e08f606a38fb7c0de98b42375636692d43d7040 Maintainer: mowangjuanzi Status: ready -->
3+
<refentry xml:id="function.curl-share-init-persistent" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<refnamediv>
5+
<refname>curl_share_init_persistent</refname>
6+
<refpurpose>初始化 <emphasis role="bold">持久</emphasis> cURL 共享句柄</refpurpose>
7+
</refnamediv>
8+
9+
<refsect1 role="description">
10+
&reftitle.description;
11+
<methodsynopsis>
12+
<type>CurlSharePersistentHandle</type><methodname>curl_share_init_persistent</methodname>
13+
<methodparam><type>array</type><parameter>share_options</parameter></methodparam>
14+
</methodsynopsis>
15+
<simpara>
16+
使用指定的共享选项初始化<emphasis role="bold">持久</emphasis> cURL 共享句柄。与 <function>curl_share_init</function>
17+
不同,此函数创建的句柄不会在 PHP 请求结束时销毁。如果找到具有相同 <parameter>share_options</parameter>
18+
的持久共享句柄,则会重用该句柄。
19+
</simpara>
20+
</refsect1>
21+
22+
<refsect1 role="parameters">
23+
&reftitle.parameters;
24+
25+
<variablelist>
26+
<varlistentry>
27+
<term><parameter>share_options</parameter></term>
28+
<listitem>
29+
<simpara>
30+
非空的 <constant>CURL_LOCK_DATA_<replaceable>*</replaceable></constant> 常量数组。
31+
</simpara>
32+
<note>
33+
<simpara>
34+
不允许使用 <constant>CURL_LOCK_DATA_COOKIE</constant>,如果指定,此函数将抛出 <exceptionname>ValueError</exceptionname>。在
35+
PHP 请求之间共享 cookies 可能导致用户之间的敏感 cookies 意外混淆。
36+
</simpara>
37+
</note>
38+
</listitem>
39+
</varlistentry>
40+
</variablelist>
41+
42+
</refsect1>
43+
44+
<refsect1 role="returnvalues">
45+
&reftitle.returnvalues;
46+
<simpara>
47+
返回 <classname>CurlSharePersistentHandle</classname>。
48+
</simpara>
49+
</refsect1>
50+
51+
<refsect1 role="errors">
52+
&reftitle.errors;
53+
<itemizedlist>
54+
<listitem>
55+
<simpara>
56+
如果 <parameter>share_options</parameter> 为空,此函数抛出 <exceptionname>ValueError</exceptionname>。
57+
</simpara>
58+
</listitem>
59+
<listitem>
60+
<simpara>
61+
如果 <parameter>share_options</parameter> 包含与 <constant>CURL_LOCK_DATA_<replaceable>*</replaceable></constant>
62+
不匹配的值,此函数将抛出 <classname>ValueError</classname>。
63+
</simpara>
64+
</listitem>
65+
<listitem>
66+
<simpara>
67+
如果 <parameter>share_options</parameter> 包含 <constant>CURL_LOCK_DATA_COOKIE</constant>,此函数将抛出
68+
<exceptionname>ValueError</exceptionname>。
69+
</simpara>
70+
</listitem>
71+
<listitem>
72+
<simpara>
73+
如果 <parameter>share_options</parameter> 包含非整数值,此函数将抛出 <exceptionname>TypeError</exceptionname>。
74+
</simpara>
75+
</listitem>
76+
</itemizedlist>
77+
</refsect1>
78+
79+
<refsect1 role="examples">
80+
&reftitle.examples;
81+
<example xml:id="function.curl-share-init-persistent.example.basic">
82+
<title><function>curl_share_init_persistent</function> 示例</title>
83+
<simpara>
84+
此示例将创建持久 cURL 共享句柄,并演示它们之间共享连接的功能。如果在长生命周期的 PHP SAPI
85+
中执行,<literal>$sh</literal> 将在 SAPI 请求之间保持存在。
86+
</simpara>
87+
88+
<programlisting role="php">
89+
<![CDATA[
90+
<?php
91+
92+
// 创建或获取持久 cURL 共享句柄,设置为共享 DNS 查找和连接
93+
$sh = curl_share_init_persistent([CURL_LOCK_DATA_DNS, CURL_LOCK_DATA_CONNECT]);
94+
95+
// 初始化第一个 cURL 句柄并为其分配共享句柄
96+
$ch1 = curl_init("http://example.com/");
97+
curl_setopt($ch1, CURLOPT_SHARE, $sh);
98+
99+
// 执行第一个 cURL 句柄。此操作可能会重用来自先前 SAPI 请求的连接
100+
curl_exec($ch1);
101+
102+
// 初始化第二个 cURL 句柄并为其分配共享句柄
103+
$ch2 = curl_init("http://example.com/");
104+
curl_setopt($ch2, CURLOPT_SHARE, $sh);
105+
106+
// 执行第二个 cURL 句柄。此操作将重用来自 $ch1 的连接
107+
curl_exec($ch2);
108+
109+
?>
110+
111+
]]>
112+
</programlisting>
113+
</example>
114+
</refsect1>
115+
116+
<refsect1 role="seealso">
117+
&reftitle.seealso;
118+
<simplelist>
119+
<member><function>curl_setopt</function></member>
120+
<member><function>curl_share_init</function></member>
121+
</simplelist>
122+
</refsect1>
123+
124+
</refentry>
125+
<!-- Keep this comment at the end of the file
126+
Local variables:
127+
mode: sgml
128+
sgml-omittag:t
129+
sgml-shorttag:t
130+
sgml-minimize-attributes:nil
131+
sgml-always-quote-attributes:t
132+
sgml-indent-step:1
133+
sgml-indent-data:t
134+
indent-tabs-mode:nil
135+
sgml-parent-document:nil
136+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
137+
sgml-exposed-tags:nil
138+
sgml-local-catalogs:nil
139+
sgml-local-ecat-files:nil
140+
End:
141+
vim600: syn=xml fen fdm=syntax fdl=2 si
142+
vim: et tw=78 syn=sgml
143+
vi: ts=1 sw=1
144+
-->

reference/curl/functions/curl-share-init.xml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 01d19a544891db839e36de8316e78f81de56c1ca Maintainer: duanxiaoqiang Status: ready -->
3+
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: duanxiaoqiang Status: ready -->
44
<!-- CREDITS: mowangjuanzi, Luffy -->
55
<refentry xml:id="function.curl-share-init" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -83,13 +83,6 @@ curl_setopt($ch2, CURLOPT_SHARE, $sh);
8383
// 执行第二个 cURL 句柄
8484
// all cookies from $ch1 handle are shared with $ch2 handle
8585
curl_exec($ch2);
86-
87-
// 关闭 cURL 共享句柄
88-
curl_share_close($sh);
89-
90-
// 关闭 cURL 共享句柄
91-
curl_close($ch1);
92-
curl_close($ch2);
9386
?>
9487
]]>
9588
</programlisting>
@@ -102,7 +95,6 @@ curl_close($ch2);
10295
<para>
10396
<simplelist>
10497
<member><function>curl_share_setopt</function></member>
105-
<member><function>curl_share_close</function></member>
10698
<member><function>curl_share_init_persistent</function></member>
10799
</simplelist>
108100
</para>

reference/curl/functions/curl-share-setopt.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 56171c30f4f4bb558537d9f5b400f21fdd2ebee8 Maintainer: duanxiaoqiang Status: ready -->
3+
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: duanxiaoqiang Status: ready -->
44
<!-- CREDITS: mowangjuanzi -->
55
<refentry xml:id="function.curl-share-setopt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -98,13 +98,6 @@ curl_setopt($ch2, CURLOPT_SHARE, $sh);
9898
// Execute the second cURL handle
9999
// all cookies from $ch1 handle are shared with $ch2 handle
100100
curl_exec($ch2);
101-
102-
// Close the cURL share handle
103-
curl_share_close($sh);
104-
105-
// Close the cURL handles
106-
curl_close($ch1);
107-
curl_close($ch2);
108101
?>
109102
]]>
110103
</programlisting>

reference/curl/functions/curl-strerror.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd Maintainer: duanxiaoqiang Status: ready -->
3+
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: duanxiaoqiang Status: ready -->
44
<!-- CREDITS: mowangjuanzi -->
55
<refentry xml:id="function.curl-strerror" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -60,9 +60,6 @@ if($errno = curl_errno($ch)) {
6060
$error_message = curl_strerror($errno);
6161
echo "cURL error ({$errno}):\n {$error_message}";
6262
}
63-
64-
// 关闭句柄
65-
curl_close($ch);
6663
?>
6764
]]>
6865
</programlisting>

reference/curl/functions/curl-unescape.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd Maintainer: 胡搞 Status: ready -->
3+
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: 胡搞 Status: ready -->
44
<!-- CREDITS: mowangjuanzi -->
55
<refentry xml:id="function.curl-unescape" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -81,9 +81,6 @@ $effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
8181
// 解码这个 URL
8282
$effective_url_decoded = curl_unescape($ch, $effective_url);
8383
// "http://example.com/show_location.php?loc=München"
84-
85-
// 关闭句柄
86-
curl_close($ch);
8784
?>
8885
]]>
8986
</programlisting>

0 commit comments

Comments
 (0)