#define ROAST_HTTP_VER_0_9 "0.9"
#define ROAST_HTTP_VER_1_0 "1.0"
#define ROAST_HTTP_VER_1_1 "1.1"
-#define ROAST_HTTP_DEFAULT_VERSION ROAST_HTTP_VER_1_0
#define _ROAST_HTTP_CRLF "\r\n"
namespace roast
{
- class http_request_header : public ::std::map<::std::string, ::std::string>
- {
- public:
- };
-
- ///////////////////
-
+ typedef ::std::map<::std::string, ::std::string> http_request_header;
typedef ::std::map<::std::string, ::std::string> http_response_header;
///////////////////
typedef ::roast::http_request_header request_header;
typedef ::roast::http_response_header response_header;
+ enum httpver
+ {
+ v09=9,
+ v10,
+ v11
+ };
+#define _ROAST_HTTP_DEFAULT_HTTP_VERSION v11
+#define _ROAST_HTTP_DEFAULT_HTTP_VERSION_STR ROAST_HTTP_VER_1_1
+
class response
{
private:
const ::std::string m_host;
const int m_port;
- const ::std::string m_httpver;
+ const char* m_httpver_str;
+ httpver m_httpver;
stream::tie_ostream _req_ost(){
return rstie(*this,stream::cout); }
}
public:
- http_core_(const char* host, int port_no=80, const char* http_version=ROAST_HTTP_VER_1_0) :
+ http_core_(const char* host, int port_no=80, httpver http_version=_ROAST_HTTP_DEFAULT_HTTP_VERSION) :
m_host(host), m_port(port_no), m_httpver(http_version)
{
- connect(m_host.c_str(), port_no);
+ m_httpver_str = _ROAST_HTTP_DEFAULT_HTTP_VERSION_STR;
+
+ switch(m_httpver)
+ {
+ case v09:
+ m_httpver_str = ROAST_HTTP_VER_0_9;
+ break;
+ case v10:
+ m_httpver_str = ROAST_HTTP_VER_1_0;
+ break;
+ case v11:
+ m_httpver_str = ROAST_HTTP_VER_1_1;
+ break;
+ }
+
+ //connect(m_host.c_str(), port_no);
}
/////////////////////////////////////////////////
hints.ai_socktype = socktype;
hints.ai_family = family;
+#pragma warning(disable: 4996)
char port_str[12];
sprintf(port_str, "%d", port);
+#pragma warning(default: 4996)
//if ( !m_impl.getaddrinfo(host, port_str, &hints, &addr) )
if ( !m_pimpl->getaddrinfo(host, port_str, &hints, &addr) )