able to send several HttpRequests in parallel.<br />
<br />
Example:</p><pre><blockquote><code><span style="color: #000000"><br />
-<span style="color: #0000BB"><?php<br /> $urls </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'www.php.net'</span><span style="color: #007700">, </span><span style="color: #DD0000">'pecl.php.net'</span><span style="color: #007700">, </span><span style="color: #DD0000">'pear.php.net'</span><span style="color: #007700">)<br /> </span><span style="color: #0000BB">$pool </span><span style="color: #007700">= new </span><span style="color: #0000BB">HttpRequestPool</span><span style="color: #007700">;<br /> foreach (</span><span style="color: #0000BB">$urls </span><span style="color: #007700">as </span><span style="color: #0000BB">$url</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">$req</span><span style="color: #007700">[</span><span style="color: #0000BB">$url</span><span style="color: #007700">] = new </span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://$url"</span><span style="color: #007700">, </span><span style="color: #0000BB">HTTP_HEAD</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$pool</span><span style="color: #007700">-></span><span style="color: #0000BB">attach</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">[</span><span style="color: #0000BB">$url</span><span style="color: #007700">]);<br /> }<br /> </span><span style="color: #0000BB">$pool</span><span style="color: #007700">-></span><span style="color: #0000BB">send</span><span style="color: #007700">();<br /> foreach (</span><span style="color: #0000BB">$urls </span><span style="color: #007700">as </span><span style="color: #0000BB">$url</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%s (%s) is %s\n"</span><span style="color: #007700">,<br /> </span><span style="color: #0000BB">$url</span><span style="color: #007700">, </span><span style="color: #0000BB">$req</span><span style="color: #007700">[</span><span style="color: #0000BB">$url</span><span style="color: #007700">]-></span><span style="color: #0000BB">getResponseInfo</span><span style="color: #007700">(</span><span style="color: #DD0000">'effective_url'</span><span style="color: #007700">),<br /> </span><span style="color: #0000BB">$r</span><span style="color: #007700">-></span><span style="color: #0000BB">getResponseCode</span><span style="color: #007700">() == </span><span style="color: #0000BB">200 </span><span style="color: #007700">? </span><span style="color: #DD0000">'alive' </span><span style="color: #007700">: </span><span style="color: #DD0000">'not alive'<br /> </span><span style="color: #007700">);<br /> }<br /></span><span style="color: #0000BB">?></span><br />
+<span style="color: #0000BB"><?php<br /></span><span style="color: #007700">try {<br /> </span><span style="color: #0000BB">$pool </span><span style="color: #007700">= new </span><span style="color: #0000BB">HttpRequestPool</span><span style="color: #007700">(<br /> new </span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.google.com/'</span><span style="color: #007700">, </span><span style="color: #0000BB">HTTP_HEAD</span><span style="color: #007700">),<br /> new </span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.php.net/'</span><span style="color: #007700">, </span><span style="color: #0000BB">HTTP_HEAD</span><span style="color: #007700">)<br /> );<br /> </span><span style="color: #0000BB">$pool</span><span style="color: #007700">-></span><span style="color: #0000BB">send</span><span style="color: #007700">();<br /> foreach(</span><span style="color: #0000BB">$pool </span><span style="color: #007700">as </span><span style="color: #0000BB">$request</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%s is %s (%d)\n"</span><span style="color: #007700">,<br /> </span><span style="color: #0000BB">$request</span><span style="color: #007700">-></span><span style="color: #0000BB">getUrl</span><span style="color: #007700">(),<br /> </span><span style="color: #0000BB">$request</span><span style="color: #007700">-></span><span style="color: #0000BB">getResponseCode</span><span style="color: #007700">() ? </span><span style="color: #DD0000">'alive' </span><span style="color: #007700">: </span><span style="color: #DD0000">'not alive'</span><span style="color: #007700">,<br /> </span><span style="color: #0000BB">$request</span><span style="color: #007700">-></span><span style="color: #0000BB">getResponseCode</span><span style="color: #007700">()<br /> );<br /> }<br />} catch (</span><span style="color: #0000BB">HttpException $e</span><span style="color: #007700">) {<br /> echo </span><span style="color: #0000BB">$e</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span><br />
</span><br />
</code></blockquote><br />
<br />
<p>See HttpRequestPool::socketSend().</p>
<h3 id="HttpRequestPool_socketRead">protected void HttpRequestPool::socketRead()</h3>
<p>See HttpRequestPool::socketSend().</p>
+<h3 id="HttpRequestPool_valid">bool HttpRequestPool::valid()</h3>
+<p>Implements Iterator::valid().</p>
+<h3 id="HttpRequestPool_current">HttpRequest HttpRequestPool::current()</h3>
+<p>Implements Iterator::current().</p>
+<h3 id="HttpRequestPool_key">long HttpRequestPool::key()</h3>
+<p>Implements Iterator::key().</p>
+<h3 id="HttpRequestPool_next">void HttpRequestPool::next()</h3>
+<p>Implements Iterator::next().</p>
+<h3 id="HttpRequestPool_rewind">void HttpRequestPool::rewind()</h3>
+<p>Implements Iterator::rewind().</p>
<hr noshade>
<h1>http_response_object.c</h1>
<h3 id="HttpResponse_setCache">static bool HttpResponse::setCache(bool cache)</h3>
<br />
</pre></p>
<hr noshade>
- <p><b>Generated at: Fri, 22 Jul 2005 17:44:59 +0200</b></p>
+ <p><b>Generated at: Mon, 25 Jul 2005 14:47:50 +0200</b></p>
</body>
</html>
* $pool->send();
* foreach($pool as $request) {
* printf("%s is %s (%d)\n",
- * $request->getResponseInfo('effective_url'),
+ * $request->getUrl(),
* $request->getResponseCode() ? 'alive' : 'not alive',
* $request->getResponseCode()
* );
/* implements Iterator */
/* {{{ proto bool HttpRequestPool::valid()
+ *
+ * Implements Iterator::valid().
*/
PHP_METHOD(HttpRequestPool, valid)
{
/* }}} */
/* {{{ proto HttpRequest HttpRequestPool::current()
+ *
+ * Implements Iterator::current().
*/
PHP_METHOD(HttpRequestPool, current)
{
getObject(http_requestpool_object, obj);
if (obj->iterator.pos < zend_llist_count(&obj->pool.handles)) {
- for ( current = zend_llist_get_first_ex(&obj->pool.handles, &lpos);
- current && obj->iterator.pos != pos++;
+ for ( current = zend_llist_get_first_ex(&obj->pool.handles, &lpos);
+ current && obj->iterator.pos != pos++;
current = zend_llist_get_next_ex(&obj->pool.handles, &lpos));
if (current) {
RETURN_OBJECT(*current);
/* }}} */
/* {{{ proto long HttpRequestPool::key()
+ *
+ * Implements Iterator::key().
*/
PHP_METHOD(HttpRequestPool, key)
{
/* }}} */
/* {{{ proto void HttpRequestPool::next()
+ *
+ * Implements Iterator::next().
*/
PHP_METHOD(HttpRequestPool, next)
{
/* }}} */
/* {{{ proto void HttpRequestPool::rewind()
+ *
+ * Implements Iterator::rewind().
*/
PHP_METHOD(HttpRequestPool, rewind)
{
</maintainers>
<release>
- <version>0.10.0dev</version>
- <date>2005-07-00</date>
+ <version>0.10.0</version>
+ <date>2005-07-25</date>
<state>beta</state>
<notes><![CDATA[
* changed HttpResponse to a completely static class, please see docs/functions.html for reference
* added http_get_request_body()
* several bug fixes
+* added test files
]]>
</notes>
</release>
<file role="doc">CREDITS</file>
<file role="doc">EXPERIMENTAL</file>
<file role="doc">docs/functions.html</file>
+ <file role="doc">KnownIssues.txt</file>
<file role="src" platform="windows">http.dsp</file>
<file role="src" platform="windows">config.w32</file>
<file role="src">http_response_object.c</file>
<file role="src">http_exception_object.c</file>
+ <dir name="tests" role="test">
+ <file>README.txt</file>
+ <file>run-tests.diff</file>
+ <file>data.txt</file>
+ <file>skip.inc</file>
+ <file>abs_uri_001.phpt</file>
+ <file>abs_uri_002.phpt</file>
+ <file>allowed_methods_001.phpt</file>
+ <file>chunked_decode_001.phpt</file>
+ <file>date_001.phpt</file>
+ <file>date_002.phpt</file>
+ <file>get_request_data_001.phpt</file>
+ <file>HttpMessage_001.phpt</file>
+ <file>HttpRequestPool_001.phpt</file>
+ <file>HttpRequest_001.phpt</file>
+ <file>HttpRequest_002.phpt</file>
+ <file>HttpRequest_003.phpt</file>
+ <file>HttpResponse_001.phpt</file>
+ <file>HttpResponse_002.phpt</file>
+ <file>INI_001.phpt</file>
+ <file>parse_headers_001.phpt</file>
+ <file>redirect_001.phpt</file>
+ <file>redirect_002.phpt</file>
+ <file>redirect_003.phpt</file>
+ <file>send_data_001.phpt</file>
+ <file>send_data_002.phpt</file>
+ <file>send_data_003.phpt</file>
+ <file>send_data_004.phpt</file>
+ <file>send_data_005.phpt</file>
+ <file>send_data_006.phpt</file>
+ <file>send_data_007.phpt</file>
+ <file>send_data_008.phpt</file>
+ <file>send_data_009.phpt</file>
+ <file>send_file_001.phpt</file>
+ <file>send_file_002.phpt</file>
+ <file>send_file_003.phpt</file>
+ <file>send_file_004.phpt</file>
+ <file>send_file_005.phpt</file>
+ <file>send_file_006.phpt</file>
+ <file>send_file_007.phpt</file>
+ <file>split_response_001.phpt</file>
+ <file>split_response_002.phpt</file>
+ </dir>
</dir>
</filelist>
+ <deps>
+ <dep type="php" rel="ge" version="4.3.1" optional="no" />
+ <dep type="php" rel="ge" version="5.0.4" optional="yes" />
+ <dep type="ext" rel="has" optional="yes">session</dep>
+ <dep type="ext" rel="has" optional="yes">zlib</dep>
+ </deps>
</package>
Index: run-tests.php
===================================================================
RCS file: /repository/php-src/run-tests.php,v
-retrieving revision 1.209
-diff -u -r1.209 run-tests.php
---- run-tests.php 20 Mar 2005 19:47:13 -0000 1.209
-+++ run-tests.php 3 May 2005 06:13:20 -0000
-@@ -836,6 +836,12 @@
+retrieving revision 1.223
+diff -u -r1.223 run-tests.php
+--- run-tests.php 18 Jul 2005 00:19:28 -0000 1.223
++++ run-tests.php 25 Jul 2005 12:28:31 -0000
+@@ -926,6 +926,12 @@
$query_string = '';
}
-+ if (!empty($section_text['ENV'])) {
-+ foreach (explode("\n", $section_text['ENV']) as $env) {
-+ ($env = trim($env)) and putenv($env);
-+ }
-+ }
++ if (!empty($section_text['ENV'])) {
++ foreach (explode("\n", $section_text['ENV']) as $env) {
++ ($env = trim($env)) and putenv($env);
++ }
++ }
+
putenv("REDIRECT_STATUS=1");
putenv("QUERY_STRING=$query_string");
putenv("PATH_TRANSLATED=$tmp_file");
-@@ -861,7 +867,7 @@
+@@ -951,7 +957,7 @@
putenv("CONTENT_TYPE=");
putenv("CONTENT_LENGTH=");
}
if ($DETAILED) echo "
-@@ -878,6 +884,12 @@
+@@ -968,6 +974,13 @@
// $out = `$cmd`;
$out = system_with_timeout($cmd);
-+ if (!empty($section_text['ENV'])) {
-+ foreach (explode("\n", $section_text['ENV']) as $env) {
-+ ($env = trim($env)) and putenv(array_shift(explode('=', $env)).'=');
-+ }
-+ }
++ if (!empty($section_text['ENV'])) {
++ foreach (explode("\n", $section_text['ENV']) as $env) {
++ $env = explode('=', $env);
++ ($env = trim($env)) and putenv($env[0] .'=');
++ }
++ }
+
@unlink($tmp_post);