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) :
365 const char *
Hdr(
const char *h)
const;
374 virtual void _OnRecv(
void *buf,
unsigned int size);
406 std::map<std::string, std::string>
_hdrs;
423#ifdef MINIHTTP_SUPPORT_SOCKET_SET
453 typedef std::map<TcpSocket*, SocketSetData>
Store;
#define NULL
Definition Defs.h:81
This class is used for Posting data to a HTTP(s) server.
Definition HttpClient.h:236
bool empty() const
Definition HttpClient.h:251
void reserve(size_t res)
Definition HttpClient.h:238
const std::string & str() const
Definition HttpClient.h:247
POST & add(const char *key, const char *value)
const char * c_str() const
Definition HttpClient.h:243
size_t length() const
Definition HttpClient.h:255
bool HasSSL()
Indicates if we support HTTPS requests.
Definition HttpClient.cpp:165
void StopNetwork()
Stop the Network for HTTP requests.
Definition HttpClient.cpp:219
void URLEncode(const std::string &s, std::string &enc)
Encode a String suitable for sending as a URL request (eg Get)
Definition HttpClient.cpp:308
SSLResult
Result Codes for SSL operations.
Definition HttpClient.h:117
bool InitNetwork()
Initialize the Network for HTTP requests.
Definition HttpClient.cpp:206
@ SSLR_NO_SSL
Definition HttpClient.h:119
@ SSLR_FAIL
Definition HttpClient.h:120
@ SSLR_CERT_MISSING
Definition HttpClient.h:125
@ SSLR_CERT_CN_MISMATCH
Definition HttpClient.h:123
@ _SSLR_FORCE32BIT
Definition HttpClient.h:129
@ SSLR_CERT_EXPIRED
Definition HttpClient.h:121
@ SSLR_OK
Definition HttpClient.h:118
@ SSLR_CERT_REVOKED
Definition HttpClient.h:122
@ SSLR_CERT_FUTURE
Definition HttpClient.h:127
@ SSLR_CERT_SKIP_VERIFY
Definition HttpClient.h:126
@ SSLR_CERT_NOT_TRUSTED
Definition HttpClient.h:124
Definition Bitfield.cpp:31