simple http client
This commit is contained in:
46
public/http/http.h
Normal file
46
public/http/http.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef HTTP_H
|
||||
#define HTTP_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
struct HTTPHeaderParam_t
|
||||
{
|
||||
const char *m_szParamName;
|
||||
const char *m_szValue;
|
||||
};
|
||||
|
||||
struct HTTPHeader_t
|
||||
{
|
||||
uint32_t m_nParamCount;
|
||||
HTTPHeaderParam_t *m_params;
|
||||
};
|
||||
|
||||
struct HTTPResponse_t
|
||||
{
|
||||
CUtlBuffer<HTTPHeaderParam_t> m_params;
|
||||
CUtlBuffer<char> m_message;
|
||||
uint32_t m_uCode;
|
||||
bool bIsValid;
|
||||
};
|
||||
|
||||
abstract_class IHTTPClient
|
||||
{
|
||||
public:
|
||||
virtual void Post( const char *szResource, HTTPHeader_t *pHeader, uint32_t uDataSize, const char *data ) = 0;
|
||||
virtual void Get( const char *szResource, HTTPHeader_t *pHeader ) = 0;
|
||||
virtual HTTPResponse_t GetResponse() = 0;
|
||||
};
|
||||
|
||||
abstract_class IHTTPClientManager
|
||||
{
|
||||
public:
|
||||
virtual IHTTPClient *Connect( const char *szUrl, bool bSecure ) = 0;
|
||||
virtual void Disconnect( IHTTPClient *pClient ) = 0;
|
||||
};
|
||||
|
||||
#define HTTP_CLIENT_INTERFACE_VERSION "FHTTPClientMgr001"
|
||||
extern IHTTPClientManager *g_pHttpClientMgr;
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user