Skip to content

Commit a8d1a89

Browse files
authored
Merge pull request #8653 from kenjis/fix-curlrequest.rst
docs: fix incorrect CURLRequest allow_redirects description
2 parents b2d0197 + fc02e49 commit a8d1a89

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

user_guide_src/source/libraries/curlrequest.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,19 @@ or any of the shortcut methods.
157157
allow_redirects
158158
===============
159159

160-
By default, cURL will follow all "Location:" headers the remote servers send back. The ``allow_redirects`` option
161-
allows you to modify how that works.
160+
By default, cURL will not follow any "Location:" headers the remote servers send
161+
back. The ``allow_redirects`` option allows you to modify how that works.
162162

163-
If you set the value to ``false``, then it will not follow any redirects at all:
163+
If you set the value to ``true``, then it will follow redirects:
164164

165-
.. literalinclude:: curlrequest/013.php
165+
.. literalinclude:: curlrequest/014.php
166166

167-
Setting it to ``true`` will apply the default settings to the request:
167+
.. warning:: Please note that enabling redirects may redirect to a URL that you
168+
do not expect and may enable SSRF attacks.
168169

169-
.. literalinclude:: curlrequest/014.php
170+
Setting it to ``false`` will apply the default settings to the request:
171+
172+
.. literalinclude:: curlrequest/013.php
170173

171174
You can pass in array as the value of the ``allow_redirects`` option to specify new settings in place of the defaults:
172175

user_guide_src/source/libraries/curlrequest/014.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
$client->request('GET', 'http://example.com', ['allow_redirects' => true]);
44
/*
55
* Sets the following defaults:
6-
* 'max' => 5, // Maximum number of redirects to follow before stopping
7-
* 'strict' => true, // Ensure POST requests stay POST requests through redirects
8-
* 'protocols' => ['http', 'https'] // Restrict redirects to one or more protocols
6+
* 'max' => 5, // Maximum number of redirects to follow before stopping
7+
* 'strict' => true, // Ensure POST requests stay POST requests through redirects
8+
* 'protocols' => ['http', 'https'] // Restrict redirects to one or more protocols
99
*/

0 commit comments

Comments
 (0)