CMNetwork/inc/hgl/network/HTTPTools.h

36 lines
1.4 KiB
C
Raw Normal View History

2022-05-25 19:03:06 +08:00
#ifndef HGL_NETWORK_HTTP_TOOLS_INCLUDE
#define HGL_NETWORK_HTTP_TOOLS_INCLUDE
#include<hgl/type/BaseString.h>
#include<hgl/io/OutputStream.h>
namespace hgl
{
namespace network
{
/**
* HTTP/HTTPS所使用的功能实现
*/
namespace http
{
/**
* HTTP/HTTPS链接GET操作得到返回信息<br>
* HTTP信息头
*/
int get(io::OutputStream *,const char *,const char *user_agent=nullptr); ///<http/https get
int post(io::OutputStream *,const char *,const void *,const int,const char *user_agent=nullptr); ///<http/htpps post
inline int post(io::OutputStream *os,const char *url,const UTF8String &post_data,const char *user_agent=nullptr)
{
return post(os,url,post_data.c_str(),post_data.Length(),user_agent);
}
inline int post(io::OutputStream *os,const UTF8String &url,const UTF8String &post_data,const char *user_agent=nullptr)
{
return post(os,url.c_str(),post_data.c_str(),post_data.Length(),user_agent);
}
}//namespace http
}//namespace network
}//namespace hgl
#endif//HGL_NETWORK_HTTP_TOOLS_INCLUDE