• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetProxy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetProxy函数的典型用法代码示例。如果您正苦于以下问题:C++ GetProxy函数的具体用法?C++ GetProxy怎么用?C++ GetProxy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetProxy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ConnectSocket

bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout)
{
    proxyType proxy;

    // no proxy needed
    if (!GetProxy(addrDest.GetNetwork(), proxy))
        return ConnectSocketDirectly(addrDest, hSocketRet, nTimeout);

    SOCKET hSocket = INVALID_SOCKET;

    // first connect to proxy server
    if (!ConnectSocketDirectly(proxy.first, hSocket, nTimeout))
        return false;

    // do socks negotiation
    switch (proxy.second) {
    case 4:
        if (!Socks4(addrDest, hSocket))
            return false;
        break;
    case 5:
        if (!Socks5(addrDest.ToStringIP(), addrDest.GetPort(), hSocket))
            return false;
        break;
    default:
        closesocket(hSocket);
        return false;
    }

    hSocketRet = hSocket;
    return true;
}
开发者ID:aurarad,项目名称:Auroracoin,代码行数:32,代码来源:netbase.cpp


示例2: getProxySettings

bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const
{
    // Directly query current base proxy, because
    // GUI settings can be overridden with -proxy.
    proxyType curProxy;
    if (GetProxy(NET_IPV4, curProxy)) {
        if (curProxy.second == 5) {
            proxy.setType(QNetworkProxy::Socks5Proxy);
            proxy.setHostName(QString::fromStdString(curProxy.first.ToStringIP()));
            proxy.setPort(curProxy.first.GetPort());

            return true;
        }
        else
            return false;
    }
    else
        proxy.setType(QNetworkProxy::NoProxy);






    return true;
}
开发者ID:oxidcoin,项目名称:oxid,代码行数:26,代码来源:optionsmodel.cpp


示例3: ASSERT

void Debugger::Interrupt(int type, const char *program,
                         InterruptSite *site /* = NULL */,
                         const char *error /* = NULL */) {
  ASSERT(RuntimeOption::EnableDebugger);

  RequestInjectionData &rjdata = ThreadInfo::s_threadInfo->m_reqInjectionData;
  if (rjdata.debuggerIdle > 0 && type == BreakPointReached) {
    --rjdata.debuggerIdle;
    return;
  }

  DebuggerProxyPtr proxy = GetProxy();
  if (proxy) {
    if (proxy->needInterrupt() || type != BreakPointReached) {
      // Interrupts may execute some PHP code, causing another interruption.
      std::stack<void *> &interrupts = rjdata.interrupts;

      CmdInterrupt cmd((InterruptType)type, program, site, error);
      interrupts.push(&cmd);
      proxy->interrupt(cmd);
      interrupts.pop();
    }
    rjdata.debuggerIdle = proxy->needInterrupt() ? 0 : 1000;
  } else {
    // debugger clients are disconnected abnormally
    if (type == SessionStarted || type == SessionEnded) {
      // for command line programs, we need this exception to exit from
      // the infinite execution loop
      throw DebuggerClientExitException();
    }
  }
}
开发者ID:Jostein,项目名称:hiphop-php,代码行数:32,代码来源:debugger.cpp


示例4: VALIDATE_NOT_NULL

ECode Proxy::GetPreferredHttpHost(
    /* [in] */ IContext* context,
    /* [in] */ const String& url,
    /* [out] */ IHttpHost** httpHost)
{
    VALIDATE_NOT_NULL(httpHost);

    AutoPtr<Elastos::Net::IProxyHelper> helper;
    Elastos::Net::CProxyHelper::AcquireSingleton((Elastos::Net::IProxyHelper**)&helper);
    AutoPtr<Elastos::Net::IProxy> noproxy;
    helper->GetNO_PROXY((Elastos::Net::IProxy**)&noproxy);
    AutoPtr<Elastos::Net::IProxy> prefProxy;
    GetProxy(context, url, (Elastos::Net::IProxy**)&prefProxy);
    if (prefProxy == noproxy) {
        *httpHost = NULL;
        return NOERROR;
    } else {
        AutoPtr<ISocketAddress> socketaddress;
        prefProxy->GetAddress((ISocketAddress**)&socketaddress);
        AutoPtr<IInetSocketAddress> sa = IInetSocketAddress::Probe(socketaddress);
        String hostName;
        sa->GetHostName(&hostName);
        Int32 portNum;
        sa->GetPort(&portNum);
        return CHttpHost::New(hostName, portNum, String("http"), httpHost);
    }
    return NOERROR;
}
开发者ID:elastos,项目名称:Elastos5,代码行数:28,代码来源:Proxy.cpp


示例5: GetProcessPath

void CIceClientBase::InitIce(void)
{
    string strBasePath = "";
    strBasePath = GetProcessPath();
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties();

        //
        // Set a default value for "Hello.Proxy" so that the demo will
        // run without a configuration file.
        //
        //initData.properties->setProperty("SHMIAlarm.Proxy", "SHMIAlarm:tcp -p 11888");

        //
        // Now, load the configuration file if present. Under WinCE we
        // use "config.txt" since it can be edited with pocket word.
        //
        std::string strConfigfile = "";
        try
        {
            strConfigfile =strBasePath + "../config/";
            strConfigfile += m_strConfigFileName;
            initData.properties->load(strConfigfile);
        }
        catch(const Ice::FileException& ex)
        {
            std::cout<< ex.what() << endl;
            std::cout<< "Maybe cannot find the config file: " << strConfigfile << endl;
            Sleep(1000);
            return;
        }

        int argc = 0;
        m_communicator = Ice::initialize(argc, 0, initData);

        string strProxy = m_strProxy;
        strProxy += ".Proxy";
        m_objPrx = m_communicator->stringToProxy(initData.properties->getProperty(strProxy));

        //IceInternal::ProxyHandle<T>
        //AlarmViewer =
        //IceInternal::ProxyHandle::checkedCast(m_objPrx);

        GetProxy();
    }
    catch(const Ice::Exception& ex)
    {
        //MessageBox(NULL, CString(ex.ice_name().c_str()), L"Exception", MB_ICONEXCLAMATION | MB_OK);
        string strMsg;
        strMsg = ex.ice_name();
        //printf("%s \n", strMsg.c_str());
        LOG_ERROR("%s", strMsg.c_str());
        return;
    }
}
开发者ID:JiangJunGG,项目名称:SyAutoH,代码行数:57,代码来源:IceClientBase.cpp


示例6: parser

    int HttpConnectProxyHttpSocket::ConnectImpl(const char *address)
    {
        ProxyHttpSocket::ConnectImpl(GetProxy());
        Util::AddressParser parser(address);
        Util::AddressParser proxyParser(GetProxy());

        std::ostringstream request;
        request << "CONNECT " << parser.GetHost() << ":" << parser.GetPort() << " HTTP/1.0\r\n";
        request << "Host: " << proxyParser.GetHost() << ":" << proxyParser.GetPort() << "\r\n";
        request << "User-Agent: " << GetAgent() << "\r\n";

        const char *user = proxyParser.GetUser();
        const char *password = proxyParser.GetPassword();

        if (*user || *password) {
		    // Encode user:password
            std::string auth = user;
            auth += ':';
            auth += password;
            auth = Util::BinToBase64(auth.c_str(), auth.length());

            request << "Proxy-Authorization: Basic " << auth << "\r\n";
	    }
    	
        request << "\r\n";

        Send(request.str().c_str());

        std::string response = Receive();

	    if (response.length() < 12) 
            throw ProxyError("Invalid response");
        
        if (response[9] != '2' || response[10] != '0' || response[11] != '0') {
		    // Proxy responded with error
            std::ostringstream msg;
            int err = (response[9] - '0') * 100 + (response[10] - '0') * 10 + (response[11] - '0');
            msg << "Responded with error " << err;
		    throw ProxyError(msg.str().c_str());
	    }

        return 0;
    }
开发者ID:death,项目名称:webwatch,代码行数:43,代码来源:HttpConnectProxyHttpSocket.cpp


示例7: GetProxy

void OptionsDialog::updateDefaultProxyNets()
{
    proxyType proxy;
    std::string strProxy;
    QString strDefaultProxyGUI;

    GetProxy(NET_IPV4, proxy);
    strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
    strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
    (strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachIPv4->setChecked(true) : ui->proxyReachIPv4->setChecked(false);

    GetProxy(NET_IPV6, proxy);
    strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
    strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
    (strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachIPv6->setChecked(true) : ui->proxyReachIPv6->setChecked(false);

    GetProxy(NET_TOR, proxy);
    strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
    strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
    (strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachTor->setChecked(true) : ui->proxyReachTor->setChecked(false);
}
开发者ID:MasterX1582,项目名称:bitcoin-becoin,代码行数:21,代码来源:optionsdialog.cpp


示例8: Start

void KX_PythonComponent::Update()
{
	if (!m_init) {
		Start();
		m_init = true;
	}

	PyObject *pycomp = GetProxy();
	if (!PyObject_CallMethod(pycomp, "update", "")) {
		PyErr_Print();
	}
}
开发者ID:UPBGE,项目名称:blender,代码行数:12,代码来源:KX_PythonComponent.cpp


示例9: PyObject_CallMethod

void KX_PythonComponent::Start()
{
	PyObject *arg_dict = (PyObject *)BKE_python_component_argument_dict_new(m_pc);

	PyObject *ret = PyObject_CallMethod(GetProxy(), "start", "O", arg_dict);

	if (PyErr_Occurred()) {
		PyErr_Print();
	}

	Py_XDECREF(arg_dict);
	Py_XDECREF(ret);
}
开发者ID:UPBGE,项目名称:blender,代码行数:13,代码来源:KX_PythonComponent.cpp


示例10: Py_BuildValue

void KX_LibLoadStatus::RunFinishCallback()
{
#ifdef WITH_PYTHON
	if (m_finish_cb) {
		PyObject* args = Py_BuildValue("(O)", GetProxy());

		if (!PyObject_Call(m_finish_cb, args, NULL)) {
			PyErr_Print();
			PyErr_Clear();
		}

		Py_DECREF(args);
	}
#endif
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:15,代码来源:KX_LibLoadStatus.cpp


示例11: KX_PythonComponent

CValue *KX_PythonComponent::GetReplica()
{
	KX_PythonComponent *replica = new KX_PythonComponent(*this);
	replica->ProcessReplica();

	// Subclass the python component.
	PyTypeObject *type = Py_TYPE(GetProxy());
	if (!py_base_new(type, PyTuple_Pack(1, replica->GetProxy()), NULL)) {
		CM_Error("failed replicate component: \"" << m_name << "\"");
		delete replica;
		return NULL;
	}

	return replica;
}
开发者ID:UPBGE,项目名称:blender,代码行数:15,代码来源:KX_PythonComponent.cpp


示例12: VALIDATE_NOT_NULL

/**
* Return the proxy host set by the user.
* @param ctx A Context used to get the settings for the proxy host.
* @return String containing the host name. If the user did not set a host
*         name it returns the default host. A null value means that no
*         host is to be used.
* @deprecated Use standard java vm proxy values to find the host, port
*         and exclusion list.  This call ignores the exclusion list.
*/
ECode CProxy::GetHost(
    /* [in] */ IContext* ctx,
    /* [out] */ String* host)
{
    VALIDATE_NOT_NULL(host);
    AutoPtr<Elastos::Net::IProxy> proxy;
    AutoPtr<Elastos::Net::IProxy> noproxy;
    proxyhelper->GetNO_PROXY((Elastos::Net::IProxy**)&noproxy);
    String str;
    GetProxy(ctx, str, (Elastos::Net::IProxy**)&proxy);
    if (proxy == noproxy) {
        *host = NULL;
        return NOERROR;
    }
    AutoPtr<ISocketAddress> socketAddress;
    proxy->GetAddress((ISocketAddress**)&socketAddress);
    AutoPtr<IInetSocketAddress> address = IInetSocketAddress::Probe(socketAddress);
    return address->GetHostName(host);
}
开发者ID:imace,项目名称:ElastosRDK5_0,代码行数:28,代码来源:CProxy.cpp


示例13: GetNetworksInfo

static UniValue GetNetworksInfo()
{
    UniValue networks(UniValue::VARR);
    for(int n=0; n<NET_MAX; ++n)
    {
        enum Network network = static_cast<enum Network>(n);
        if(network == NET_UNROUTABLE || network == NET_INTERNAL)
            continue;
        proxyType proxy;
        UniValue obj(UniValue::VOBJ);
        GetProxy(network, proxy);
        obj.pushKV("name", GetNetworkName(network));
        obj.pushKV("limited", IsLimited(network));
        obj.pushKV("reachable", IsReachable(network));
        obj.pushKV("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string());
        obj.pushKV("proxy_randomize_credentials", proxy.randomize_credentials);
        networks.push_back(obj);
    }
    return networks;
}
开发者ID:GlobalBoost,项目名称:GlobalBoost-Y,代码行数:20,代码来源:net.cpp


示例14: proxy

HRESULT
AccessibleHandler::ResolveIA2()
{
  if (mIA2PassThru) {
    return S_OK;
  }

  RefPtr<IUnknown> proxy(GetProxy());
  if (!proxy) {
    return E_UNEXPECTED;
  }

  HRESULT hr = proxy->QueryInterface(NEWEST_IA2_IID,
                                     reinterpret_cast<void**>(&mIA2PassThru));
  if (SUCCEEDED(hr)) {
    // mIA2PassThru is a weak reference (see comments in AccesssibleHandler.h)
    mIA2PassThru->Release();
  }

  return hr;
}
开发者ID:MrAlex94,项目名称:Waterfox,代码行数:21,代码来源:AccessibleHandler.cpp


示例15: static_assert

HRESULT
AccessibleHandler::QueryService(REFGUID aServiceId, REFIID aIid,
                                void** aOutInterface)
{
  static_assert(&NEWEST_IA2_IID == &IID_IAccessible2_3,
                "You have modified NEWEST_IA2_IID. This code needs updating.");
  /* We're taking advantage of the fact that we are implementing IA2 as part
     of our own object to implement this just like a QI. */
  if (aIid == IID_IAccessible2_3 || aIid == IID_IAccessible2_2 ||
      aIid == IID_IAccessible2) {
    RefPtr<NEWEST_IA2_INTERFACE> ia2(this);
    ia2.forget(aOutInterface);
    return S_OK;
  }

  for (uint32_t i = 0; i < ArrayLength(kUnsupportedServices); ++i) {
    if (aServiceId == kUnsupportedServices[i]) {
      return E_NOINTERFACE;
    }
  }

  if (!mServProvPassThru) {
    RefPtr<IUnknown> proxy(GetProxy());
    if (!proxy) {
      return E_UNEXPECTED;
    }

    HRESULT hr = proxy->QueryInterface(IID_IServiceProvider,
                                       reinterpret_cast<void**>(&mServProvPassThru));
    if (FAILED(hr)) {
      return hr;
    }

    // mServProvPassThru is a weak reference (see comments in
    // AccessibleHandler.h)
    mServProvPassThru->Release();
  }

  return mServProvPassThru->QueryService(aServiceId, aIid, aOutInterface);
}
开发者ID:MrAlex94,项目名称:Waterfox,代码行数:40,代码来源:AccessibleHandler.cpp


示例16: assert

// Primary entrypoint for the debugger from the VM. Called in response to a host
// of VM events that the debugger is interested in. The debugger will execute
// any logic needed to handle the event, and will block below this to wait for
// and process more commands from the debugger client. This function will only
// return when the debugger is letting the thread continue execution, e.g., for
// flow control command like continue, next, etc.
void Debugger::Interrupt(int type, const char *program,
                         InterruptSite *site /* = NULL */,
                         const char *error /* = NULL */) {
  assert(RuntimeOption::EnableDebugger);
  TRACE_RB(2, "Debugger::Interrupt type %d\n", type);

  DebuggerProxyPtr proxy = GetProxy();
  if (proxy) {
    TRACE(3, "proxy != null\n");
    RequestInjectionData &rjdata = ThreadInfo::s_threadInfo->m_reqInjectionData;
    // The proxy will only service an interrupt if we've previously setup some
    // form of flow control command (steps, breakpoints, etc.) or if it's
    // an interrupt related to something like the session or request.
    if (proxy->needInterrupt() || type != BreakPointReached) {
      // Interrupts may execute some PHP code, causing another interruption.
      std::stack<void *> &interrupts = rjdata.interrupts;

      CmdInterrupt cmd((InterruptType)type, program, site, error);
      interrupts.push(&cmd);
      proxy->interrupt(cmd);
      interrupts.pop();
    }
    // Some cmds require us to interpret all instructions until the cmd
    // completes. Setting this will ensure we stay out of JIT code and in the
    // interpreter so phpDebuggerOpcodeHook has a chance to work.
    rjdata.setDebuggerIntr(proxy->needVMInterrupts());
  } else {
    TRACE(3, "proxy == null\n");
    // Debugger clients are disconnected abnormally, or this sandbox is not
    // being debugged.
    if (type == SessionStarted || type == SessionEnded) {
      // For command line programs, we need this exception to exit from
      // the infinite execution loop.
      throw DebuggerClientExitException();
    }
  }
}
开发者ID:floreal,项目名称:hiphop-php,代码行数:43,代码来源:debugger.cpp


示例17: ASSERT

void Debugger::Interrupt(int type, const char *program,
                         InterruptSite *site /* = NULL */,
                         const char *error /* = NULL */) {
  ASSERT(RuntimeOption::EnableDebugger);

  DebuggerProxyPtr proxy = GetProxy();
  if (proxy) {
    // Interrupts may execute some PHP code, causing another interruption.
    void *&tint = ThreadInfo::s_threadInfo->m_reqInjectionData.interrupt;
    if (!tint) {
      CmdInterrupt cmd((InterruptType)type, program, site, error);
      tint = &cmd;
      proxy->interrupt(cmd);
      tint = NULL;
    }
  } else {
    // debugger clients are disconnected abnormally
    if (type == SessionStarted || type == SessionEnded) {
      // for command line programs, we need this exception to exit from
      // the infinite execution loop
      throw DebuggerClientExitException();
    }
  }
}
开发者ID:ckwalsh,项目名称:hiphop-php,代码行数:24,代码来源:debugger.cpp


示例18: switch

bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role)
{
    bool successful = true; /* set to false on parse error */
    if(role == Qt::EditRole)
    {
        QSettings settings;
        switch(index.row())
        {
        case StartAtStartup:
            successful = GUIUtil::SetStartOnSystemStartup(value.toBool());
            break;
        case MinimizeToTray:
            fMinimizeToTray = value.toBool();
            settings.setValue("fMinimizeToTray", fMinimizeToTray);
            break;
        case MapPortUPnP:
            fUseUPnP = value.toBool();
            settings.setValue("fUseUPnP", value.toBool());
            MapPort(value.toBool());
            break;
        case MinimizeOnClose:
            fMinimizeOnClose = value.toBool();
            settings.setValue("fMinimizeOnClose", fMinimizeOnClose);
            break;
        case ProxyUse:
            settings.setValue("fUseProxy", value.toBool());
            ApplyProxySettings();
            break;
        case ProxyIP: {
            proxyType proxy;
            proxy = CService("127.0.0.1", 9050);
            GetProxy(NET_IPV4, proxy);

            CNetAddr addr(value.toString().toStdString());
            proxy.SetIP(addr);
            settings.setValue("addrProxy", proxy.ToStringIPPort().c_str());
            successful = ApplyProxySettings();
        }
        break;
        case ProxyPort: {
            proxyType proxy;
            proxy = CService("127.0.0.1", 9050);
            GetProxy(NET_IPV4, proxy);

            proxy.SetPort(value.toInt());
            settings.setValue("addrProxy", proxy.ToStringIPPort().c_str());
            successful = ApplyProxySettings();
        }
        break;
        case Fee:
            nTransactionFee = value.toLongLong();
            settings.setValue("nTransactionFee", (qint64) nTransactionFee);
            emit transactionFeeChanged(nTransactionFee);
            break;
        case ReserveBalance:
            nReserveBalance = value.toLongLong();
            settings.setValue("nReserveBalance", (qint64) nReserveBalance);
            emit reserveBalanceChanged(nReserveBalance);
            break;
        case DisplayUnit:
            nDisplayUnit = value.toInt();
            settings.setValue("nDisplayUnit", nDisplayUnit);
            emit displayUnitChanged(nDisplayUnit);
            break;
        case DisplayAddresses:
            bDisplayAddresses = value.toBool();
            settings.setValue("bDisplayAddresses", bDisplayAddresses);
            emit displayUnitChanged(settings.value("nDisplayUnit", BitcoinUnits::LEO).toInt());
            break;
        case DetachDatabases: {
            bool fDetachDB = value.toBool();
            bitdb.SetDetach(fDetachDB);
            settings.setValue("detachDB", fDetachDB);
            }
            break;
        case Language:
            settings.setValue("language", value);
            break;
        case RowsPerPage: {
            nRowsPerPage = value.toInt();
            settings.setValue("nRowsPerPage", nRowsPerPage);
            emit rowsPerPageChanged(nRowsPerPage);
            }
            break;
        case Notifications: {
            notifications = value.toStringList();
            settings.setValue("notifications", notifications);
            }
            break;
        case VisibleTransactions: {
            visibleTransactions = value.toStringList();
            settings.setValue("visibleTransactions", visibleTransactions);
            emit visibleTransactionsChanged(visibleTransactions);
            }
            break;
        case AutoRingSize: {
            fAutoRingSize = value.toBool();
            settings.setValue("fAutoRingSize", fAutoRingSize);
            }
            break;
//.........这里部分代码省略.........
开发者ID:Leocoin-project,项目名称:LEOcoin,代码行数:101,代码来源:optionsmodel.cpp


示例19: InternetOpen

bool
CHttp::AllocHandles ( bool isbase64, int *status, bool checkauth)
{

	DWORD		flags	=	INTERNET_FLAG_RELOAD | 
							INTERNET_FLAG_NO_CACHE_WRITE | 
							INTERNET_FLAG_KEEP_CONNECTION;
    unsigned long errnum;
	DWORD rec_timeout = RECIEVE_TIMEOUT;					// override the 30 second timeout fixed in 12.11
	wyString contenttype,contenttypestr;
	//wyInt32     ret;
	
		

	/* 
		If a user has selected to use proxy server for Internet connection then we
		create a separate handle, send a dummy request and set the username, password 

		The real data connection and transfer is done in another handle */
	
	if (IsProxy () )
		m_InternetSession = InternetOpen (TEXT(USER_AGENT), INTERNET_OPEN_TYPE_PROXY, GetProxy(), NULL, 0 );
	else
		m_InternetSession = InternetOpen (TEXT(USER_AGENT), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0 );
	
	if (!m_InternetSession )
		return false;
	InternetSetOption(m_InternetSession, INTERNET_OPTION_RECEIVE_TIMEOUT, &rec_timeout, sizeof(rec_timeout));
	m_InternetConnect = InternetConnect (m_InternetSession, m_HostName, m_Port, m_UserName, m_Password, INTERNET_SERVICE_HTTP, 0L, 0L );
	if (!m_InternetConnect )
		return false;

	/* set the flags for internet connection  and check if SSL required */
	if (wcsicmp (m_Protocol, L"https" ) == 0 )
		flags |= INTERNET_FLAG_SECURE;

	/* check for proxy or password protected authentication 
	checkauth flag tells whether its required to be authenticated 
	*/
	if (checkauth && !Authorize (&errnum) )
    {
        *status = errnum;
		return false;
    }

	m_HttpOpenRequest = HttpOpenRequest(m_InternetConnect, L"POST", m_FileName, NULL, NULL, NULL, flags, 0L );
	if (!m_HttpOpenRequest )
		return false;

	//Content-Type 
	contenttype.SetAs(m_contenttype);
	contenttypestr.Sprintf("Content-Type: %s\r\n", contenttype.GetString());
	if (!HttpAddRequestHeaders(m_HttpOpenRequest, contenttypestr.GetAsWideChar () , (DWORD)-1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE ) )
		return false;
				
	/*if (!HttpAddRequestHeaders(m_HttpOpenRequest, L"HTTP_USER_AGENT: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0\r\n", (DWORD)-1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE ) )
		return false;*/
	//changing user string for avoid update your browser bug
	if (!HttpAddRequestHeaders(m_HttpOpenRequest, L"HTTP_USER_AGENT: Mozilla/5.0 (Windows; U;Windows NT 6.3; en-US; rv:36.0) Gecko/20100101 Firefox/36.0\r\n", (DWORD)-1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE ) )
		return false;

	if (isbase64 ) {
		if (!HttpAddRequestHeaders(m_HttpOpenRequest, L"Base64: yes\r\n", (DWORD)-1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE ) ) {
			assert (0 );
			return false;
		}
	}

	return true;
}
开发者ID:ArsalanYaqoob,项目名称:sqlyog-community,代码行数:70,代码来源:Http.cpp


示例20: getinfo

/**
 * @note Do not add or change anything in the information returned by this
 * method. `getinfo` exists for backwards-compatibility only. It combines
 * information from wildly different sources in the program, which is a mess,
 * and is thus planned to be deprecated eventually.
 *
 * Based on the source of the information, new information should be added to:
 * - `getblockchaininfo`,
 * - `getnetworkinfo` or
 * - `getwalletinfo`
 *
 * Or alternatively, create a specific query method for the information.
 **/
UniValue getinfo(const JSONRPCRequest& request)
{
    if (request.fHelp || request.params.size() != 0)
        throw std::runtime_error(
            "getinfo\n"
            "\nDEPRECATED. Returns an object containing various state info.\n"
            "\nResult:\n"
            "{\n"
            "  \"deprecation-warning\": \"...\" (string) warning that the getinfo command is deprecated and will be removed in 0.16\n"
            "  \"version\": xxxxx,           (numeric) the server version\n"
            "  \"protocolversion\": xxxxx,   (numeric) the protocol version\n"
            "  \"walletversion\": xxxxx,     (numeric) the wallet version\n"
            "  \"balance\": xxxxxxx,         (numeric) the total bitcoin balance of the wallet\n"
            "  \"blocks\": xxxxxx,           (numeric) the current number of blocks processed in the server\n"
            "  \"timeoffset\": xxxxx,        (numeric) the time offset\n"
            "  \"connections\": xxxxx,       (numeric) the number of connections\n"
            "  \"proxy\": \"host:port\",       (string, optional) the proxy used by the server\n"
            "  \"difficulty\": xxxxxx,       (numeric) the current difficulty\n"
            "  \"testnet\": true|false,      (boolean) if the server is using testnet or not\n"
            "  \"keypoololdest\": xxxxxx,    (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool\n"
            "  \"keypoolsize\": xxxx,        (numeric) how many new keys are pre-generated\n"
            "  \"unlocked_until\": ttt,      (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
            "  \"paytxfee\": x.xxxx,         (numeric) the transaction fee set in " + CURRENCY_UNIT + "/kB\n"
            "  \"relayfee\": x.xxxx,         (numeric) minimum relay fee for transactions in " + CURRENCY_UNIT + "/kB\n"
            "  \"errors\": \"...\"             (string) any error messages\n"
            "}\n"
            "\nExamples:\n"
            + HelpExampleCli("getinfo", "")
            + HelpExampleRpc("getinfo", "")
        );

#ifdef ENABLE_WALLET
    CWallet * const pwallet = GetWalletForJSONRPCRequest(request);

    LOCK2(cs_main, pwallet ? &pwallet->cs_wallet : NULL);
#else
    LOCK(cs_main);
#endif

    proxyType proxy;
    GetProxy(NET_IPV4, proxy);

    UniValue obj(UniValue::VOBJ);
    obj.push_back(Pair("deprecation-warning", "WARNING: getinfo is deprecated and will be fully removed in 0.16."
        " Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16"));
    obj.push_back(Pair("version", CLIENT_VERSION));
    obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
#ifdef ENABLE_WALLET
    if (pwallet) {
        obj.push_back(Pair("walletversion", pwallet->GetVersion()));
        obj.push_back(Pair("balance",       ValueFromAmount(pwallet->GetBalance())));
    }
#endif
    obj.push_back(Pair("blocks",        (int)chainActive.Height()));
    obj.push_back(Pair("timeoffset",    GetTimeOffset()));
    if(g_connman)
        obj.push_back(Pair("connections",   (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL)));
    obj.push_back(Pair("proxy",         (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string())));
    obj.push_back(Pair("difficulty",    (double)GetDifficulty()));
    obj.push_back(Pair("testnet",       Params().NetworkIDString() == CBaseChainParams::TESTNET));
#ifdef ENABLE_WALLET
    if (pwallet) {
        obj.push_back(Pair("keypoololdest", pwallet->GetOldestKeyPoolTime()));
        obj.push_back(Pair("keypoolsize",   (int)pwallet->GetKeyPoolSize()));
    }
    if (pwallet && pwallet->IsCrypted()) {
        obj.push_back(Pair("unlocked_until", pwallet->nRelockTime));
    }
    obj.push_back(Pair("paytxfee",      ValueFromAmount(payTxFee.GetFeePerK())));
#endif
    obj.push_back(Pair("relayfee",      ValueFromAmount(::minRelayTxFee.GetFeePerK())));
    obj.push_back(Pair("errors",        GetWarnings("statusbar")));
    return obj;
}
开发者ID:fametrano,项目名称:bitcoin,代码行数:87,代码来源:misc.cpp



注:本文中的GetProxy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetPtr函数代码示例发布时间:2022-05-30
下一篇:
C++ GetProtocol函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap