Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix default FastCGI interface
Reviewed By: alexeyt

Differential Revision: D15567393

fbshipit-source-id: ffab228f689d4ddca9ea4835c70aecf16da2aa9f
  • Loading branch information
fredemmott authored and hhvm-bot committed Jun 11, 2019
1 parent 149c1e1 commit 97ef580
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
3 changes: 2 additions & 1 deletion hphp/runtime/server/fastcgi/fastcgi-server.cpp
Expand Up @@ -80,7 +80,8 @@ FastCGIServer::FastCGIServer(const std::string &address,
if (useFileSocket) {
sock_addr.setFromPath(address);
} else if (address.empty()) {
sock_addr.setFromLocalPort(port);
sock_addr.setFromHostPort("localhost", port);
assert(sock_addr.isLoopbackAddress());
} else {
sock_addr.setFromHostPort(address, port);
}
Expand Down
3 changes: 1 addition & 2 deletions hphp/test/server/debugger/tests/runTest1.php
Expand Up @@ -5,9 +5,8 @@
function test1Controller($hphpdOutput, $hphpdProcessId, $serverPort) {
// Request a page so that the client can debug it.
waitForClientToOutput($hphpdOutput, "Waiting for server response");
$url = "http://".php_uname('n').':'.$serverPort.'/test1.php';
echo "Requesting test1.php\n";
request(php_uname('n'), $serverPort, 'test1.php', 10); // ignore response
request('localhost', $serverPort, 'test1.php', 10); // ignore response

// Let client run until script quits
waitForClientToOutput($hphpdOutput, "quit");
Expand Down
4 changes: 2 additions & 2 deletions hphp/test/server/fastcgi/tests/authDigestTest.php
Expand Up @@ -8,7 +8,7 @@ function BadAuthDigestTestController($serverPort) {
'uri="/test_auth_digest.php", cnonce="MjIyMTg2", nc=00000001, ' .
'qop="auth", response="6dfbea52fbf13016476c1879e6436004", ' .
'opaque="cdce8a5c95a1427d74df7acbf41c9ce0"');
var_dump(request(php_uname('n'), $serverPort, "test_auth_digest.php",
var_dump(request('localhost', $serverPort, "test_auth_digest.php",
[], [], $args));
}

Expand All @@ -18,7 +18,7 @@ function GoodAuthDigestTestController($serverPort) {
'uri="/test_auth_digest.php", cnonce="MjIyMTg1", nc=00000001, ' .
'qop="auth", response="e544aaed06917adea3e5c74dd49f0e32", ' .
'opaque="cdce8a5c95a1427d74df7acbf41c9ce0"');
var_dump(request(php_uname('n'), $serverPort, "test_auth_digest.php",
var_dump(request('localhost', $serverPort, "test_auth_digest.php",
[], [], $args));
}

Expand Down
2 changes: 1 addition & 1 deletion hphp/test/server/fastcgi/tests/disable_ini_zend_compat.php
Expand Up @@ -6,7 +6,7 @@
require_once('test_base.inc');

function disableIniZendCompatController($port) {
echo request(php_uname('n'), $port, 'test_disable_ini_zend_compat.php');
echo request('localhost', $port, 'test_disable_ini_zend_compat.php');
}

echo "---Enable Ini Zend Compat ON---\n";
Expand Down
2 changes: 1 addition & 1 deletion hphp/test/server/fastcgi/tests/global_variables_server.php
Expand Up @@ -23,6 +23,6 @@
$path = 'global_variables.php?var=GET&get=1';
$post = array('var' => 'POST', 'post' => 2);
$headers = array('Cookie' => 'var=COOKIE;cookie=3;');
echo request(php_uname('n'), $port, $path, $post, $headers, $extra) . "\n";
echo request('localhost', $port, $path, $post, $headers, $extra) . "\n";
}, $request[0]);
}
2 changes: 1 addition & 1 deletion hphp/test/server/fastcgi/tests/headerTest.php
Expand Up @@ -4,7 +4,7 @@

function headerTestController($serverPort) {
$args = array('Authorization' => 'foo');
var_dump(request(php_uname('n'), $serverPort, "test_headers.php",
var_dump(request('localhost', $serverPort, "test_headers.php",
[], ['PROXY' => 'foobar'], $args));
}

Expand Down
2 changes: 1 addition & 1 deletion hphp/test/server/fastcgi/tests/httpsTest.php
Expand Up @@ -4,7 +4,7 @@

function httpsTestController($serverPort) {
$args = array('HTTPS' => '');
var_dump(request(php_uname('n'), $serverPort, "test_https.php",
var_dump(request('localhost', $serverPort, "test_https.php",
[], [], $args));
}

Expand Down
2 changes: 1 addition & 1 deletion hphp/test/server/fastcgi/tests/invalid.php
Expand Up @@ -3,7 +3,7 @@
require_once('test_base.inc');

function invalidTestController($port) {
$host = php_uname('n');
$host = 'localhost';

$filename = __DIR__.'/request-doesnotexist.dat';
$file = fopen($filename, 'rb');
Expand Down
8 changes: 4 additions & 4 deletions hphp/test/server/util/server_tests.inc
Expand Up @@ -179,7 +179,7 @@ function startServer(&$serverPort, &$adminPort, &$debugPort, $home, $root,

// Check if the server id is in the expected list of ids.
function checkServerId($serverPort, $expectedIds) {
$host = php_uname('n');
$host = 'localhost';
$r = request($host, $serverPort, "hello.php");
if (preg_match('/Hello, World!(.*+)/', $r ?? '', &$matches)) {
foreach ((array)$expectedIds as $id) {
Expand Down Expand Up @@ -217,7 +217,7 @@ function stopServer($adminPort, $serverProc) {

$r = "";
for ($i = 1; $i <= 10; $i++) {
$r = request(php_uname('n'), $adminPort, 'stop?instance-id='.$test_run_id);
$r = request('localhost', $adminPort, 'stop?instance-id='.$test_run_id);
if ($r === "OK") break;
usleep(100000);
}
Expand Down Expand Up @@ -286,7 +286,7 @@ function http_request($host, $port, $path, $timeout = 1200, $curl_opts = '') {
$headers = implode(" ", $s);
}
$url = "http://$host:$port/$path";
$host_name = "hphpd.debugger.".php_uname('n');
$host_name = "hphpd.debugger.".\php_uname('n');

$LOG_ROOT = ServerUtilServerTests::$LOG_ROOT;
$test_run_id = ServerUtilServerTests::$test_run_id;
Expand All @@ -304,7 +304,7 @@ function requestAll(array $requests, $customArgs = '', $repoArgs = '') {
foreach ($requests as $request) {
$r = is_array($request) ? $request[0] : $request;
echo "Requesting '$r'\n";
var_dump(request(php_uname('n'), $serverPort, $request));
var_dump(request('localhost', $serverPort, $request));
}
},
$customArgs,
Expand Down

0 comments on commit 97ef580

Please sign in to comment.