36 #ifndef MINIHTTPSOCKET_H 37 #define MINIHTTPSOCKET_H 40 #define MINIHTTP_SUPPORT_HTTP 41 #define MINIHTTP_SUPPORT_SOCKET_SET 99 bool SplitURI(
const std::string& uri, std::string& host, std::string& file,
int& port);
110 void URLEncode(
const std::string& s, std::string& enc);
149 bool open(
const char *addr =
NULL,
unsigned int port = 0);
163 return _host.c_str();
165 bool SendBytes(
const void *buf,
unsigned int len);
168 bool initSSL(
const char *certs);
180 virtual void _OnRecv(
void *buf,
unsigned int size) = 0;
216 int _writeBytes(
const unsigned char *buf,
size_t len);
217 int _readBytes(
unsigned char *buf,
size_t maxlen);
221 #ifdef MINIHTTP_SUPPORT_HTTP 242 POST&
add(
const char *key,
const char *value);
247 const std::string&
str()
const 257 return data.length();
275 Request(
const std::string& h,
const std::string& res,
int p = 80,
void *u =
NULL) :
336 bool SendRequest(
const std::string what,
const char *extraRequest =
NULL,
void *user =
NULL);
365 const char *
Hdr(
const char *h)
const;
374 virtual void _OnRecv(
void *buf,
unsigned int size);
383 bool _Redirect(std::string loc,
bool forceGET);
406 std::map<std::string, std::string>
_hdrs;
423 #ifdef MINIHTTP_SUPPORT_SOCKET_SET 453 typedef std::map<TcpSocket*, SocketSetData>
Store;
size_t length() const
Definition: HttpClient.h:255
Definition: Bitfield.cpp:30
bool empty() const
Definition: HttpClient.h:251
Definition: HttpClient.h:126
Definition: HttpClient.h:122
bool InitNetwork()
Initialize the Network for HTTP requestsInitializes the Network for HTTP requests.
Definition: HttpClient.cpp:206
Definition: HttpClient.h:129
Definition: HttpClient.h:125
#define NULL
Definition: Defs.h:81
Definition: HttpClient.h:123
const char * c_str() const
Definition: HttpClient.h:243
Definition: HttpClient.h:121
Definition: HttpClient.h:119
void reserve(size_t res)
Definition: HttpClient.h:238
Definition: HttpClient.h:124
SSLResult
Result Codes for SSL operations.
Definition: HttpClient.h:116
const std::string & str() const
Definition: HttpClient.h:247
void URLEncode(const std::string &s, std::string &enc)
Encode a String suitable for sending as a URL request (eg Get)Encode a String so it can be sent as pa...
Definition: HttpClient.cpp:308
POST & add(const char *key, const char *value)
This class is used for Posting data to a HTTP(s) serverPost some data to a HTTP(s) server.
Definition: HttpClient.h:235
Definition: HttpClient.h:120
Definition: HttpClient.h:127
Definition: HttpClient.h:118
bool HasSSL()
Indicates if we support HTTPS requestsIndicates if we support HTTPS requests.
Definition: HttpClient.cpp:165
void StopNetwork()
Stop the Network for HTTP requestsStops the Network for HTTP requests and releases resources associat...
Definition: HttpClient.cpp:219