com doc/ja: Fix `CURLOPT_MAXREDIRS`/`FOLLOWLOCATION` descriptions: reference/curl/functions/curl-setopt.xml
[email protected] (Yoshinari Takaoka) Fri, 22 Jan 2021 13:09:03 +0000
| Newsgroups | php.doc.ja |
|---|---|
| Message-ID | <[email protected]> |
Commit: 5ea9e862530d3201693abc75c90e03620eeb7787 Author: Yoshinari Takaoka <[email protected]> Fri, 22 Jan 2021 22:09:03 +0900 Parents: dde35ec18286e8dd76c30f5b0e8208f9c49f1a24 Branches: master Link: http://git.php.net/?p=doc/ja.git;a=commitdiff;h=5ea9e862530d3201693abc75c90e03620eeb7787 Log: Fix `CURLOPT_MAXREDIRS`/`FOLLOWLOCATION` descriptions Currently, the description for `CURLOPT_FOLLOWLOCATION` and `CURLOPT_MAXREDIRS` indicates that unless a `CURLOPT_MAXREDIRS` value is set, Curl will do an infinite loop. However, this is not the case, because PHP internally sets a default value of 20. Please see: - [`ext/curl/interface.c`](https://github.com/php/php-src/blob/d0e3fb495ff77ec0aa8bc052c15a3899e9da7899/ext/curl/interface.c#L1806) - [PHP Curl Security Hardening: Infinite loops](https://php.watch/articles/php-curl-security-hardening#infinite-redirects) - [Libcurl: CURLOPT_MAXREDIRS.html](https://curl.se/libcurl/c/CURLOPT_MAXREDIRS.html) The default libcurl behavior is indeed to not limit the number of redirects, which enables infinite loops, but I think we probably should keep the PHP's sane default of 20, and update the documentation instead. Closes GH-371. Changed paths: M reference/curl/functions/curl-setopt.xml Diff: diff --git a/reference/curl/functions/curl-setopt.xml b/reference/curl/functions/curl-setopt.xml index f90d84341b..2911c6876f 100644 --- a/reference/curl/functions/curl-setopt.xml +++ b/reference/curl/functions/curl-setopt.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd Maintainer: takagi Status: ready --> +<!-- EN-Revision: 61f5c7a1f513709b01295cdef5444be4d6bf4ba6 Maintainer: takagi Status: ready --> <!-- CREDITS: hirokawa,mumumu --> <refentry xml:id="function.curl-setopt" xmlns="http://docbook.org/ns/docbook"> <refnamediv> @@ -211,10 +211,8 @@ <entry valign="top"><constant>CURLOPT_FOLLOWLOCATION</constant></entry> <entry valign="top"> &true; を設定すると、サーバーが HTTP ヘッダの一部として送ってくる - <literal>"Location: "</literal> ヘッダの内容をたどります - (これは再帰的に行われます。<constant>CURLOPT_MAXREDIRS</constant> - が指定されていない限り、送ってくる <literal>"Location: "</literal> - ヘッダの内容をずっとたどり続けることに注意しましょう)。 + <literal>"Location: "</literal> ヘッダの内容をたどります。 + <constant>CURLOPT_MAXREDIRS</constant> も参照して下さい。 </entry> <entry valign="top"> </entry> @@ -840,6 +838,10 @@ <entry valign="top"> HTTP のリダイレクト先を追いかける最大値。 <constant>CURLOPT_FOLLOWLOCATION</constant> とあわせて使用します。 + リダイレクトループを避けるため、 + デフォルト値として <literal>20</literal> が設定されています。 + <literal>-1</literal> を設定すると、リダイレクトループを許可します。 + <literal>0</literal> を指定すると、全てのリダイレクトを拒否します。 </entry> <entry valign="top"> </entry>