mirror of
https://github.com/php/php-src.git
synced 2026-03-26 09:12:14 +01:00
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: improve CURL tests to allow testing without separate server
This commit is contained in:
@@ -4,18 +4,15 @@ Bug #27023 (CURLOPT_POSTFIELDS does not parse content types for files)
|
||||
error_reporting = E_ALL & ~E_DEPRECATED
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
include 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, 0);
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=file");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
|
||||
44
ext/curl/tests/bug27023_2.phpt
Normal file
44
ext/curl/tests/bug27023_2.phpt
Normal file
@@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
Bug #27023 (CURLOPT_POSTFIELDS does not parse content types for files)
|
||||
--INI--
|
||||
error_reporting = E_ALL & ~E_DEPRECATED
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=file");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$file = curl_file_create(__DIR__ . '/curl_testdata1.txt');
|
||||
$params = array('file' => $file);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
$file = curl_file_create(__DIR__ . '/curl_testdata1.txt', "text/plain");
|
||||
$params = array('file' => $file);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
$file = curl_file_create(__DIR__ . '/curl_testdata1.txt', null, "foo.txt");
|
||||
$params = array('file' => $file);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
$file = curl_file_create(__DIR__ . '/curl_testdata1.txt', "text/plain", "foo.txt");
|
||||
$params = array('file' => $file);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
|
||||
curl_close($ch);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "curl_testdata1.txt|application/octet-stream"
|
||||
string(%d) "curl_testdata1.txt|text/plain"
|
||||
string(%d) "foo.txt|application/octet-stream"
|
||||
string(%d) "foo.txt|text/plain"
|
||||
@@ -8,9 +8,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
$curl_version = curl_version();
|
||||
if ($curl_version['version_number'] < 0x071100) {
|
||||
exit("skip: test works only with curl >= 7.17.0");
|
||||
|
||||
@@ -5,9 +5,6 @@ Bug #46711 (lost memory when foreach is used for values passed to curl_setopt())
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
--TEST--
|
||||
Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'server.inc';
|
||||
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_STDERR, $fp);
|
||||
curl_setopt($ch, CURLOPT_URL, getenv('PHP_CURL_HTTP_REMOTE_SERVER'));
|
||||
curl_setopt($ch, CURLOPT_URL, curl_cli_server_start());
|
||||
|
||||
fclose($fp); // <-- premature close of $fp caused a crash!
|
||||
|
||||
|
||||
@@ -2,16 +2,11 @@
|
||||
Variation of bug #48203 with curl_multi_exec (Crash when file pointers passed to curl are closed before calling curl_multi_exec)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
include 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'server.inc';
|
||||
function checkForClosedFilePointer($curl_option, $description) {
|
||||
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
|
||||
|
||||
@@ -21,7 +16,7 @@ function checkForClosedFilePointer($curl_option, $description) {
|
||||
$options = array(
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
$curl_option => $fp,
|
||||
CURLOPT_URL => getenv("PHP_CURL_HTTP_REMOTE_SERVER")
|
||||
CURLOPT_URL => curl_cli_server_start()
|
||||
);
|
||||
|
||||
// we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly
|
||||
|
||||
@@ -4,7 +4,7 @@ Test curl_setopt() CURLOPT_FILE readonly file handle
|
||||
Mark van der Velden
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) print "skip"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
@@ -14,7 +14,8 @@ Mark van der Velden
|
||||
*/
|
||||
|
||||
// Figure out what handler to use
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
if(!empty($host)) {
|
||||
|
||||
// Use the set Environment variable
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
include 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -47,7 +42,8 @@ $options_to_check = array(
|
||||
"CURLOPT_INFILE"
|
||||
);
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
foreach($options_to_check as $option) {
|
||||
checkForClosedFilePointer($host, constant($option), $option);
|
||||
}
|
||||
|
||||
@@ -2,20 +2,16 @@
|
||||
Bug #54995 (Missing CURLINFO_RESPONSE_CODE support)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
include 'skipif.inc';
|
||||
|
||||
if ($curl_version['version_number'] > 0x070a08) {
|
||||
exit("skip: tests works a versions of curl >= 7.10.8");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Test curl_opt() function with POST params from array with a numeric key
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
include 'skipinf.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -13,7 +12,8 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_R
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl sending through GET an POST ***' . "\n";
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
--TEST--
|
||||
Bug #66109 (Option CURLOPT_CUSTOMREQUEST can't be reset to default.)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=method");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
@@ -4,12 +4,14 @@ Test CURLOPT_READDATA without a callback function
|
||||
Mattijs Hoitink mattijshoitink@gmail.com
|
||||
#Testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
// The URL to POST to
|
||||
$url = getenv('PHP_CURL_HTTP_REMOTE_SERVER') . '/get.php?test=post';
|
||||
$url = $host . '/get.php?test=post';
|
||||
|
||||
// Create a temporary file to read the data from
|
||||
$tempname = tempnam(sys_get_temp_dir(), 'CURL_DATA');
|
||||
|
||||
@@ -4,10 +4,7 @@ Test curl_exec() function with basic functionality
|
||||
Sebastian Deutsch <sebastian.deutsch@9elements.com>
|
||||
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_exec(resource ch)
|
||||
@@ -15,8 +12,8 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_R
|
||||
* Source code: ext/curl/interface.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo "*** Testing curl_exec() : basic functionality ***\n";
|
||||
|
||||
@@ -4,10 +4,7 @@ Test curl_opt() function with CURLOPT_RETURNTRANSFER parameter set to 1
|
||||
Sebastian Deutsch <sebastian.deutsch@9elements.com>
|
||||
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -16,7 +13,8 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_R
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ***' . "\n";
|
||||
|
||||
@@ -4,10 +4,7 @@ Test curl_opt() function with POST parameters
|
||||
Sebastian Deutsch <sebastian.deutsch@9elements.com>
|
||||
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -16,7 +13,8 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_R
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl sending through GET an POST ***' . "\n";
|
||||
|
||||
@@ -4,10 +4,7 @@ Test curl_opt() function with setting referer
|
||||
Sebastian Deutsch <sebastian.deutsch@9elements.com>
|
||||
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -16,7 +13,8 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_R
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl setting referer ***' . "\n";
|
||||
|
||||
@@ -4,10 +4,7 @@ Test curl_opt() function with user agent
|
||||
Sebastian Deutsch <sebastian.deutsch@9elements.com>
|
||||
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -16,7 +13,8 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_R
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl with user agent ***' . "\n";
|
||||
|
||||
@@ -4,10 +4,7 @@ Test curl_opt() function with CURLOPT_WRITEFUNCTION parameter set to a closure
|
||||
?
|
||||
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -16,7 +13,8 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_R
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl_setopt($ch, CURLOPT_WRITEFUNCTION, <closure>); ***' . "\n";
|
||||
|
||||
@@ -3,7 +3,7 @@ Test curl_opt() function with COOKIE
|
||||
--CREDITS--
|
||||
TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -12,7 +12,8 @@ TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl with cookie ***' . "\n";
|
||||
|
||||
@@ -3,7 +3,7 @@ Test curl_opt() function with CURLOPT_HTTP_VERSION/CURL_HTTP_VERSION_1_0
|
||||
--CREDITS--
|
||||
TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -12,7 +12,8 @@ TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl with HTTP/1.0 ***' . "\n";
|
||||
|
||||
@@ -3,7 +3,7 @@ Test curl_opt() function with CURLOPT_HTTP_VERSION/CURL_HTTP_VERSION_1_1
|
||||
--CREDITS--
|
||||
TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -12,7 +12,8 @@ TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo '*** Testing curl with HTTP/1.1 ***' . "\n";
|
||||
|
||||
@@ -3,7 +3,7 @@ Test curl_multi_exec() function with basic functionality
|
||||
--CREDITS--
|
||||
TestFest 2009 - AFUP - Thomas Rabaix <thomas.rabaix@gmail.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_multi_exec(resource ch)
|
||||
@@ -12,7 +12,8 @@ TestFest 2009 - AFUP - Thomas Rabaix <thomas.rabaix@gmail.com>
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo "*** Testing curl_exec() : basic functionality ***\n";
|
||||
|
||||
@@ -3,7 +3,7 @@ Test curl_setopt() with curl_multi function with basic functionality
|
||||
--CREDITS--
|
||||
TestFest 2009 - AFUP - Thomas Rabaix <thomas.rabaix@gmail.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
|
||||
@@ -12,7 +12,8 @@ TestFest 2009 - AFUP - Thomas Rabaix <thomas.rabaix@gmail.com>
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo "*** Testing curl_exec() : basic functionality ***\n";
|
||||
|
||||
@@ -3,22 +3,19 @@ Test curl_getinfo() function with CURLINFO_EFFECTIVE_URL parameter
|
||||
--CREDITS--
|
||||
Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
$url = "{$host}/get.php?test=";
|
||||
$url = "http://{$host}/get.php?test=";
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_exec($ch);
|
||||
$info = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
||||
var_dump($url == $info);
|
||||
|
||||
curl_close($ch);
|
||||
?>
|
||||
===DONE===
|
||||
|
||||
@@ -3,13 +3,11 @@ Test curl_getinfo() function with CURLINFO_HTTP_CODE parameter
|
||||
--CREDITS--
|
||||
Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
$url = "{$host}/get.php?test=";
|
||||
$ch = curl_init();
|
||||
|
||||
@@ -3,13 +3,11 @@ Test curl_getinfo() function with CURLINFO_CONTENT_TYPE parameter
|
||||
--CREDITS--
|
||||
Jean-Marc Fontaine <jmf@durcommefaire.net>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$url = "{$host}/get.php?test=contenttype";
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
@@ -4,11 +4,12 @@ Test curl_copy_handle() with simple get
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
echo '*** Testing curl copy handle with simple GET ***' . "\n";
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ Test curl_copy_handle() with simple POST
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
echo '*** Testing curl copy handle with simple POST ***' . "\n";
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ Test curl_copy_handle() after exec()
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
echo '*** Test curl_copy_handle() after exec() ***' . "\n";
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ Test curl_copy_handle() after exec() with POST
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
echo '*** Test curl_copy_handle() after exec() with POST ***' . "\n";
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ Test curl_copy_handle() with User Agent
|
||||
Rick Buitenman <rick@meritos.nl>
|
||||
#testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
echo '*** Testing curl copy handle with User Agent ***' . "\n";
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
--TEST--
|
||||
Test curl_copy_handle() with simple POST
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
echo '*** Testing curl copy handle with simple POST using array as arguments ***' . "\n";
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
--TEST--
|
||||
Test curl_copy_handle() with CURLOPT_PROGRESSFUNCTION
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
$url = "{$host}/get.php";
|
||||
$ch = curl_init($url);
|
||||
|
||||
@@ -3,11 +3,13 @@ Memory corruption error if fp of just created file is closed before curl_close.
|
||||
--CREDITS--
|
||||
Alexey Shein <confik@gmail.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$ch = curl_init(getenv('PHP_CURL_HTTP_REMOTE_SERVER'));
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init($host);
|
||||
|
||||
$temp_file = dirname(__FILE__) . '/curl_file_deleted_before_curl_close.tmp';
|
||||
if (file_exists($temp_file)) {
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
--TEST--
|
||||
CURL file uploading
|
||||
--INI--
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -25,7 +19,8 @@ function testcurl($ch, $name, $mime = '', $postname = '')
|
||||
var_dump(curl_exec($ch));
|
||||
}
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=file");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
@@ -48,6 +43,7 @@ var_dump($file->getPostFilename());
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => $file));
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, 0);
|
||||
$params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
var_dump(curl_exec($ch));
|
||||
|
||||
@@ -4,12 +4,7 @@ Curl_multi_getcontent() basic test with different sources (local file/http)
|
||||
Rein Velt (rein@velt.org)
|
||||
#TestFest Utrecht 20090509
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('curl')) print 'skip need ext/curl';
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
//CURL_MULTI_GETCONTENT TEST
|
||||
@@ -19,7 +14,8 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
$ch2=curl_init();
|
||||
|
||||
//SET URL AND OTHER OPTIONS
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=getpost&get_param=Hello%20World");
|
||||
curl_setopt($ch2, CURLOPT_URL, "file://".dirname(__FILE__). DIRECTORY_SEPARATOR . "curl_testdata2.txt");
|
||||
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
@@ -4,7 +4,7 @@ curl_setopt_array() function - tests setting multiple cURL options with curl_set
|
||||
Mattijs Hoitink mattijshoitink@gmail.com
|
||||
#Testfest Utrecht 2009
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) print "skip"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
@@ -15,7 +15,8 @@ Mattijs Hoitink mattijshoitink@gmail.com
|
||||
*/
|
||||
|
||||
// Figure out what handler to use
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
if (!empty($host)) {
|
||||
// Use the set Environment variable
|
||||
$url = "{$host}/get.php?test=get";
|
||||
|
||||
@@ -4,11 +4,12 @@ curl_setopt basic tests with CURLOPT_STDERR.
|
||||
Paul Sohier
|
||||
#phptestfest utrecht
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo "*** Testing curl_setopt with CURLOPT_STDERR\n";
|
||||
|
||||
@@ -4,11 +4,12 @@ curl_setopt() call with CURLOPT_HTTPHEADER
|
||||
Paul Sohier
|
||||
#phptestfest utrecht
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo "*** curl_setopt() call with CURLOPT_HTTPHEADER\n";
|
||||
|
||||
@@ -4,11 +4,12 @@ curl_setopt() call with CURLOPT_RETURNTRANSFER
|
||||
Paul Sohier
|
||||
#phptestfest utrecht
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// start testing
|
||||
echo "*** curl_setopt() call with CURLOPT_RETURNTRANSFER set to 1\n";
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
--TEST--
|
||||
Test curl_version() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
die('skip - curl extension not available in this build');
|
||||
}
|
||||
if (!getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
echo "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable";
|
||||
}
|
||||
?>
|
||||
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
--TEST--
|
||||
Test curl_version() function : usage variations - test values for $ascii argument
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
echo "skip - curl extension not available in this build";
|
||||
}
|
||||
if (!getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
echo "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable";
|
||||
}
|
||||
?>
|
||||
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -4,16 +4,9 @@ Test curl option CURLOPT_HEADERFUNCTION
|
||||
Mathieu Kooiman <mathieuk@gmail.com>
|
||||
Dutch UG, TestFest 2009, Utrecht
|
||||
--DESCRIPTION--
|
||||
Hit the host identified by PHP_CURL_HTTP_REMOTE_SERVER and determine that the headers are sent to the callback specified for CURLOPT_HEADERFUNCTION. Different test servers specified for PHP_CURL_HTTP_REMOTE_SERVER might return different sets of headers. Just test for HTTP/1.1 200 OK.
|
||||
Hit the host and determine that the headers are sent to the callback specified for CURLOPT_HEADERFUNCTION. Different test servers might return different sets of headers. Just test for HTTP/1.1 200 OK.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
echo "skip - curl extension not available in this build";
|
||||
}
|
||||
if (!getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
echo "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable";
|
||||
}
|
||||
?>
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -23,7 +16,8 @@ function curl_header_callback($curl_handle, $data)
|
||||
echo $data;
|
||||
}
|
||||
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
56
ext/curl/tests/server.inc
Normal file
56
ext/curl/tests/server.inc
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
define ("PHP_CURL_SERVER_HOSTNAME", "localhost");
|
||||
define ("PHP_CURL_SERVER_PORT", 8964);
|
||||
define ("PHP_CURL_SERVER_ADDRESS", PHP_CURL_SERVER_HOSTNAME.":".PHP_CURL_SERVER_PORT);
|
||||
|
||||
function curl_cli_server_start() {
|
||||
if(getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
return getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
}
|
||||
|
||||
$php_executable = getenv('TEST_PHP_EXECUTABLE');
|
||||
$doc_root = __DIR__;
|
||||
$router = "responder/get.php";
|
||||
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => STDERR,
|
||||
);
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS;
|
||||
$cmd .= " {$router}";
|
||||
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
|
||||
} else {
|
||||
$cmd = "exec {$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS;
|
||||
$cmd .= " {$router}";
|
||||
$cmd .= " 2>/dev/null";
|
||||
|
||||
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
|
||||
}
|
||||
|
||||
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
|
||||
// it might not be listening yet...need to wait until fsockopen() call returns
|
||||
$i = 0;
|
||||
while (($i++ < 30) && !($fp = @fsockopen(PHP_CURL_SERVER_HOSTNAME, PHP_CURL_SERVER_PORT))) {
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
if ($fp) {
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
register_shutdown_function(
|
||||
function($handle) use($router) {
|
||||
proc_terminate($handle);
|
||||
},
|
||||
$handle
|
||||
);
|
||||
// don't bother sleeping, server is already up
|
||||
// server can take a variable amount of time to be up, so just sleeping a guessed amount of time
|
||||
// does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass
|
||||
// sleeping doesn't work.
|
||||
return PHP_CURL_SERVER_ADDRESS;
|
||||
}
|
||||
7
ext/curl/tests/skipif.inc
Normal file
7
ext/curl/tests/skipif.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if(false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
if (php_sapi_name() != "cli") {
|
||||
die("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user