25 #include <cppmyth_config.h> 26 #include "wscontent.h" 27 #include "uriparser.h" 33 #define REQUEST_PROTOCOL "HTTP/1.1" 34 #define REQUEST_USER_AGENT "libcppmyth/2.0" 35 #define REQUEST_CONNECTION "close" // "keep-alive" 36 #define REQUEST_STD_CHARSET "utf-8" 54 WSRequest(
const std::string& server,
unsigned port);
55 WSRequest(
const std::string& server,
unsigned port,
bool secureURI);
59 void RequestService(
const std::string& url, HRM_t method = HRM_GET);
60 void RequestAccept(CT_t contentType);
61 void RequestAcceptEncoding(
bool yesno);
62 void SetUserAgent(
const std::string& value);
63 void SetContentParam(
const std::string& param,
const std::string& value);
64 void SetContentCustom(CT_t contentType,
const char *content);
65 void SetHeader(
const std::string& field,
const std::string& value);
66 const std::string& GetContent()
const {
return m_contentData; }
69 void MakeMessage(std::string& msg)
const;
71 const std::string& GetServer()
const {
return m_server; }
72 unsigned GetPort()
const {
return m_port; }
73 bool IsSecureURI()
const {
return m_secure_uri; }
79 std::string m_service_url;
80 HRM_t m_service_method;
81 std::string m_charset;
84 std::string m_contentData;
85 std::map<std::string, std::string> m_headers;
86 std::string m_userAgent;
88 void MakeMessageGET(std::string& msg,
const char* method =
"GET")
const;
89 void MakeMessagePOST(std::string& msg,
const char* method =
"POST")
const;
90 void MakeMessageHEAD(std::string& msg,
const char* method =
"HEAD")
const;