svn: /pear/peardoc/trunk/en/package/http/ http-request2/adapters.xml http-request2/config.xml http-request2/request.xml http-request2.xml

[email protected] (Alexey Borzov) Tue, 22 Dec 2009 20:05:48 +0000
Newsgroups php.pear.doc
Message-ID <[email protected]>
avb                                      Tue, 22 Dec 2009 20:05:48 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=292496

Log:
Documented redirect support and other changes in HTTP_Request2 release 0.5.0

Changed paths:
    U   pear/peardoc/trunk/en/package/http/http-request2/adapters.xml
    U   pear/peardoc/trunk/en/package/http/http-request2/config.xml
    U   pear/peardoc/trunk/en/package/http/http-request2/request.xml
    U   pear/peardoc/trunk/en/package/http/http-request2.xml

Modified: pear/peardoc/trunk/en/package/http/http-request2/adapters.xml
===================================================================
--- pear/peardoc/trunk/en/package/http/http-request2/adapters.xml	2009-12-22 19:30:09 UTC (rev 292495)
+++ pear/peardoc/trunk/en/package/http/http-request2/adapters.xml	2009-12-22 20:05:48 UTC (rev 292496)
@@ -99,9 +99,20 @@
    <constant>CURLOPT_IOCTLFUNCTION</constant> (see <link xmlns:xlink="http://www.w3.org/1999/xlink"
     xlink:href="&url.php.bugs;47204">PHP bug #47204</link>) so the request body can not be
    &quot;rewound&quot; when another request should be performed. Thus a request with a non-empty
-   body to a resource protected by Digest authentication will always fail, since Digest scheme
-   requires two requests to be performed.
+   body to a resource protected by Digest authentication or to a page that does a redirect when
+   <literal>follow_redirects</literal> is enabled will fail.
   </para>
+  <para>
+   Since release 0.5.0 <classname>HTTP_Request2</classname> works around this problem by reading
+   the whole request body into memory. Of course this may be an issue when the request body is huge,
+   so consider using Socket Adapter.
+  </para>
+  <para>
+   Setting <literal>strict_redirects</literal> configuration parameter to &true; will only have
+   effect on Curl Adapter if <constant>CURLOPT_POSTREDIR</constant> (see <link xmlns:xlink="http://www.w3.org/1999/xlink"
+    xlink:href="&url.php.bugs;49571">PHP bug #49571</link>) is available in cURL extension.
+   It is not yet available in PHP 5.3.1.
+  </para>
  </refsection>

  <refsection xml:id="package.http.http-request2.adapters.mock">

Modified: pear/peardoc/trunk/en/package/http/http-request2/config.xml
===================================================================
--- pear/peardoc/trunk/en/package/http/http-request2/config.xml	2009-12-22 19:30:09 UTC (rev 292495)
+++ pear/peardoc/trunk/en/package/http/http-request2/config.xml	2009-12-22 20:05:48 UTC (rev 292496)
@@ -91,6 +91,44 @@
    </table>

    <table>
+    <title>Redirect parameters</title>
+    <tgroup cols="4">
+     <thead>
+      <row>
+       <entry>Parameter name</entry>
+       <entry>Description</entry>
+       <entry>Expected type</entry>
+       <entry>Default value</entry>
+      </row>
+     </thead>
+     <tbody>
+      <row valign="top">
+       <entry><literal>follow_redirects</literal></entry>
+       <entry>Whether to automatically follow HTTP redirects in server response</entry>
+       <entry>&type.bool;</entry>
+       <entry>&false;</entry>
+      </row>
+      <row valign="top">
+       <entry><literal>max_redirects</literal></entry>
+       <entry>Maximum number of redirects to follow</entry>
+       <entry>&type.integer;</entry>
+       <entry><literal>5</literal></entry>
+      </row>
+      <row valign="top">
+       <entry><literal>strict_redirects</literal></entry>
+       <entry>Whether to keep request method on redirects via status 301 and
+        302 (&true;, needed for compatibility with <link xmlns:xlink="http://www.w3.org/1999/xlink"
+         xlink:href="&url.rfc;2616">RFC 2616</link>) or switch to <literal>GET</literal>
+        (&false;, needed for compatibility with most browsers). <link
+         linkend="package.http.http-request2.adapters.curl">Issues with Curl Adapter</link></entry>
+       <entry>&type.bool;</entry>
+       <entry>&false;</entry>
+      </row>
+     </tbody>
+    </tgroup>
+   </table>
+
+   <table>
     <title>Proxy parameters</title>
     <tgroup cols="4">
      <thead>

Modified: pear/peardoc/trunk/en/package/http/http-request2/request.xml
===================================================================
--- pear/peardoc/trunk/en/package/http/http-request2/request.xml	2009-12-22 19:30:09 UTC (rev 292495)
+++ pear/peardoc/trunk/en/package/http/http-request2/request.xml	2009-12-22 20:05:48 UTC (rev 292496)
@@ -155,4 +155,23 @@
    </example>
   </para>
  </refsection>
+
+
+ <refsection xml:id="package.http.http-request2.request.redirects">
+  <info><title>HTTP Redirects</title></info>
+  <para>
+   Since release 0.5.0 <classname>HTTP_Request2</classname> can automatically follow HTTP redirects
+   if <literal>follow_redirects</literal> parameter is set to &true;.
+  </para>
+  <note><para>
+   <classname>HTTP_Request2</classname> will only follow redirects to HTTP(S) URLs, redirects to
+   other protocols will result in an Exception.
+  </para></note>
+  <note><para>
+   <function><phd:pearapi phd:package="HTTP_Request2"
+    phd:linkend="HTTP_Request2::send">HTTP_Request2::send</phd:pearapi></function> will return only
+   the final response, if you are interested in the intermediate ones you should use <link
+    linkend="package.http.http-request2.observers">Observers</link>.
+  </para></note>
+ </refsection>
 </refentry>

Modified: pear/peardoc/trunk/en/package/http/http-request2.xml
===================================================================
--- pear/peardoc/trunk/en/package/http/http-request2.xml	2009-12-22 19:30:09 UTC (rev 292495)
+++ pear/peardoc/trunk/en/package/http/http-request2.xml	2009-12-22 20:05:48 UTC (rev 292496)
@@ -20,8 +20,8 @@
    </para>
    <simpara>
     Supports POST requests with data and file uploads, basic and digest
-    authentication, cookies, proxies, gzip and deflate encodings, monitoring
-    the request progress with Observers...
+    authentication, redirects, cookies, proxies, gzip and deflate encodings,
+    monitoring the request progress with Observers...
    </simpara>
   </abstract>
  </info>