Exemple #1
0
bool TestDebugger::getResponse(const string& path, string& result,
                               int port /* = -1 */,
                               const string& host /* = "" */) {
  String server = "http://";
  if (host.empty()) {
    server += f_php_uname("n");
  } else {
    server += host;
  }
  server += ":" + boost::lexical_cast<string>(port > 0 ? port : m_serverPort);
  server += "/" + path;
  printf("\n  Getting URL '%s'...\n", server.get()->data());
  Variant c = f_curl_init();
  f_curl_setopt(c, k_CURLOPT_URL, server);
  f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true);
  f_curl_setopt(c, CURLOPT_TIMEOUT, 120);
  Variant res = f_curl_exec(c);
  if (same(res, false)) {
    printf("  Request failed\n");
    return false;
  }
  result = (std::string) res.toString();
  printf("  Request succeeded, returning '%s'\n", result.c_str());
  return true;
}
Exemple #2
0
static std::string getSandboxHostFormat() {
  // Assume dev servers host name are in following format:
  // <host>.<cluster>.<domain>.com
  // and we need to change to the following to match sandbox format:
  // www.<sandbox>.<host>.<domain>.com
  String hostName = f_php_uname("n");
  Array fields = f_split("\\.", hostName);
  if (fields.size() != 4) {
    return "";
  }
  String host = fields.rvalAt(0).toString();
  String domain = fields.rvalAt(1).toString() + "." +
    fields.rvalAt(2).toString();
  String suffix = fields.rvalAt(3).toString();
  string sandboxHost = "hphpd.debugger_tests." + host->toCPPString() +
                       "." + domain->toCPPString() +
                       "." + suffix->toCPPString();
  return sandboxHost;
}
bool TestExtOptions::test_php_uname() {
  VERIFY(!f_php_uname().empty());
  return Count(true);
}