HRESULT CTCPropBagOnRegKey::_CreateObject(const _bstr_t& strName,
  IUnknown** ppunkObj, IErrorLog* pErrorLog, IUnknown* punkOuter)
{
  // Get the Server of the object saved on the specified subkey
  _bstr_t strServer(GetServer(strName));
  if (!strServer.length())
    return CreateLocalObject(strName, ppunkObj, pErrorLog, punkOuter);
  return CreateRemoteObject(strServer, strName, ppunkObj, pErrorLog);
}
Beispiel #2
0
STDMETHODIMP CBHttpRequest::setProxy(short ProxySetting, BSTR strProxyServer, BSTR strBypassList)
{
    CBStringA strServer(strProxyServer), strBypass(strBypassList);
    INTERNET_PROXY_INFO ipi = {ProxySetting, strServer, strBypass};

    if(!InternetSetOption(NULL, INTERNET_OPTION_PROXY, &ipi, sizeof(ipi)))
        return GetErrorResult();

    return S_OK;
}
extern "C" JNIEXPORT void JNICALL
Java_io_lowla_lowladb_LDBClient_sync(JNIEnv *env, jobject jClass, jstring server, jobject notify)
{
    const char *szUtf = env->GetStringUTFChars(server, nullptr);
    utf16string strServer(szUtf);
    env->ReleaseStringUTFChars(server, szUtf);

    if (push(env, strServer, notify)) {
        pull(env, strServer, notify);
    }
}
void CSendGetUrlReqSocket::OnConnect(int nErrorCode)
{
	if (0 != nErrorCode)
	{
		if (thePrefs.GetVerbose())
		{
			CString		strUrlPath(GetUrlPath());
			CString		strServer(GetServer());

			strUrlPath.Replace(_T("%"), _T("%%"));
			AddDebugLogLine(false, _T("将要取%s,但连接%s返回失败。"), strUrlPath, strServer);
		}

		return;
	}

	CStringA strHttpRequest;
	strHttpRequest.AppendFormat("%s %s HTTP/1.0\r\n", m_bIsPost ? "POST" : "GET", GetUrlPath());
	strHttpRequest.AppendFormat("Host: %s\r\n", GetServer());
	strHttpRequest.AppendFormat("Accept: */*\r\n");
	if(m_bIsPost)
	{
		strHttpRequest.AppendFormat("Accept-Encoding: none\r\n");
		strHttpRequest.AppendFormat("Content-Type: application/x-www-form-urlencoded\r\n");
		strHttpRequest.AppendFormat("Content-Length: %d\r\n", m_strPost.GetLength());
	}
	//strHttpRequest.AppendFormat("Connection: Keep-Alive\r\n");
	strHttpRequest.Append("\r\n");
	if(m_bIsPost)
	{
		strHttpRequest.Append(m_strPost);
	}

	if (thePrefs.GetVerbose())
	{
		CString		strRequest(strHttpRequest);
		strRequest.Replace(_T("%"), _T("%%"));

		AddDebugLogLine(false, _T("与服务器 %s 连接成功,准备发送:"), CString(GetServer()));
		AddDebugLogLine(false, strRequest);
	}


	CRawPacket* pHttpPacket = new CRawPacket(strHttpRequest);
	SendPacket(pHttpPacket);
	SetHttpState(HttpStateRecvExpected);
}
void CSendGetUrlReqSocket::OnConnect(int nErrorCode)
{
	if (0 != nErrorCode)
	{
		if (thePrefs.GetVerbose())
		{
			CString		strUrlPath(GetUrlPath());
			CString		strServer(GetServer());

			strUrlPath.Replace(_T("%"), _T("%%"));
			AddDebugLogLine(false, _T("将要取%s,但连接%s返回失败。"), strUrlPath, strServer);
		}

		return;
	}

	CStringA strHttpRequest;
	strHttpRequest.AppendFormat("GET %s HTTP/1.0\r\n", GetUrlPath());
	strHttpRequest.AppendFormat("Host: %s\r\n", GetServer());
	strHttpRequest.AppendFormat("Accept: */*\r\n");
	//strHttpRequest.AppendFormat("Connection: Keep-Alive\r\n");
	strHttpRequest.AppendFormat("\r\n");

	if (thePrefs.GetVerbose())
	{
		CString		strRequest(strHttpRequest);
		strRequest.Replace(_T("%"), _T("%%"));

		AddDebugLogLine(false, _T("与服务器 %s 连接成功,准备发送:"), CString(GetServer()));
		AddDebugLogLine(false, strRequest);
	}


	CRawPacket* pHttpPacket = new CRawPacket(strHttpRequest);
	SendPacket(pHttpPacket);
	SetHttpState(HttpStateRecvExpected);
}