本文整理汇总了C++中http_request::url方法的典型用法代码示例。如果您正苦于以下问题:C++ http_request::url方法的具体用法?C++ http_request::url怎么用?C++ http_request::url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http_request
的用法示例。
在下文中一共展示了http_request::url方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
bool http_async_delegate::execute( HINTERNET session,
const wchar_t* verb,
const http_request& request,
http_content* content,
size_t min_buffer_size )
{
const http_url& url = request.url();
connect_ = ::WinHttpConnect( session, url.host().c_str(), url.port(), 0 );
if( connect_ == NULL )
{
return false;
}
DWORD flag = url.is_secure() ? WINHTTP_FLAG_SECURE : 0;
request_ = ::WinHttpOpenRequest(
connect_,
verb,
url.path().c_str(),
NULL,
request.referer().empty() ? WINHTTP_NO_REFERER : request.referer().c_str(),
WINHTTP_DEFAULT_ACCEPT_TYPES,
flag );
if( request_ == NULL )
{
return false;
}
if( ::WinHttpSetStatusCallback(
request_,
winhttp_system_callback,
WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS,
0 )
== WINHTTP_INVALID_STATUS_CALLBACK )
{
return false;
}
proxy_auth_scheme_ = 0;
selected_auth_scheme_ = 0;
last_status_code_ = 0;
user_ = url.user();
password_ = url.password();
req_header_ = request.get_header();
std::wstring query = request.get_query();
size_t data_size = (query.size() * sizeof( std::wstring::value_type ));
if( data_size < min_buffer_size )
{
data_size = min_buffer_size;
}
buffer_ = new http_buffer( data_size );
buffer_->copy( query.c_str(), (query.size() * sizeof( std::wstring::value_type )) );
content_ = content;
if( send_request() == false )
{
return false;
}
return true;
}