增加获取全部请求头
This commit is contained in:
@@ -29,6 +29,7 @@ namespace ylib
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
bool header(const std::string& name, std::string& value);
|
||||
std::vector<ylib::KeyValue<std::string, std::string>> headers();
|
||||
/// <summary>
|
||||
/// 请求动作
|
||||
/// </summary>
|
||||
|
||||
@@ -46,7 +46,26 @@ bool ylib::network::http::request::header(const std::string &name, std::string &
|
||||
value = strutils::F(lpszValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<ylib::KeyValue<std::string, std::string>> ylib::network::http::request::headers()
|
||||
{
|
||||
std::vector<ylib::KeyValue<std::string, std::string>> hs;
|
||||
DWORD dwHeaderCount = 0;
|
||||
HPSERVER->GetAllHeaders((CONNID)m_reqpack->connid(), nullptr, dwHeaderCount);
|
||||
if (dwHeaderCount > 0)
|
||||
{
|
||||
THeader* headers = new THeader[dwHeaderCount];
|
||||
HPSERVER->GetAllHeaders((CONNID)m_reqpack->connid(), headers, dwHeaderCount);
|
||||
for (DWORD i = 0; i < dwHeaderCount; i++)
|
||||
{
|
||||
ylib::KeyValue<std::string,std::string > kv;
|
||||
kv.name = strutils::F(headers[i].name);
|
||||
kv.value = strutils::F(headers[i].value);
|
||||
hs.push_back(kv);
|
||||
}
|
||||
delete[] headers;
|
||||
}
|
||||
return hs;
|
||||
}
|
||||
std::string ylib::network::http::request::method()
|
||||
{
|
||||
if (m_method.empty())
|
||||
|
||||
Reference in New Issue
Block a user