本文整理汇总了C++中HttpRequest::GetUrl方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpRequest::GetUrl方法的具体用法?C++ HttpRequest::GetUrl怎么用?C++ HttpRequest::GetUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::GetUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateRequest
HttpTransactionHandle CreateRequest( const HttpRequest& request, const HttpTransaction::RequestCompleteCallback& callback, bool autoRelease=true )
{
std::lock_guard<std::mutex> lock(s_mutex);
auto transaction = new HttpTransaction( callback, autoRelease );
CURL* curl = transaction->GetCurl();
curl_easy_setopt(curl, CURLOPT_URL, request.GetUrl() );
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &HttpClient::_OnResponse );
curl_easy_setopt(curl, CURLOPT_WRITEDATA, transaction );
if( 0 < request.GetTimeout() )
{
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, static_cast<long>(request.GetTimeout() * 1000) );
}
switch( request.GetMethodType() )
{
case HttpRequest::POST:
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, request.GetPostField());
break;
case HttpRequest::GET:
default:
break;
}
curl_multi_add_handle(m_MultiHandle, curl);
auto handle = _CreateHandle();
m_Handles[handle] = transaction;
return HttpTransactionHandle( handle );
}