コード例 #1
0
const CStdString CHTSPConnection::GetWebURL (const char *fmt, ...) const
{
  CStdString url;
  CStdString auth;

  /* Authentication */
  if (!g_strUsername.empty()) {
    auth = g_strUsername;
    if (!g_strPassword.empty())
      auth.AppendFormat(":%s", g_strPassword.c_str());
    auth += "@";
  } else {
    auth = "";
  }

  /* URL root */
  url.Format("http://%s%s:%i%s", auth.c_str(), g_strHostname.c_str(), g_iPortHTTP, m_strWebroot.c_str());

  va_list args;
  va_start(args, fmt);
  url.AppendFormatV(fmt, args);
  va_end(args);

  return url;
}