namespace roast
{
+ class http_request_header : public ::std::map<::std::string, ::std::string>
+ {
+ public:
+ };
+
+ ///////////////////
+
+ typedef ::std::map<::std::string, ::std::string> http_response_header;
+
+ ///////////////////
+
template <typename _TelnetT = ::roast::telnet >
class http_core_ : public _TelnetT
{
public:
-
- //////////////////////////////////////////////////////////////////////////////////////////////////////
+ typedef ::roast::http_request_header request_header;
+ typedef ::roast::http_response_header response_header;
- //typedef ::std::map< ::std::string, ::std::string > _request_header_t, _request_header, request_header;
- typedef class request_header : public ::std::map< ::std::string, ::std::string >
- {
- public:
- }
- _request_header_t, _request_header;
-
- //////////////////////////////////////////////////////////////////////////////////////////////////////
-
- typedef ::std::map< ::std::string, ::std::string > _response_header_t, _response_header, response_header;
-
class response
{
private:
public:
const char* version;
int status_code;
- _response_header headers;
+ response_header headers;
::std::string body;
public:
s += _CRLF;
return s;
}
- void request(const char* method, const char* path=NULL, _request_header *p_req_header=NULL)
+ void request(const char* method, const char* path=NULL, request_header *p_req_header=NULL)
{
*this << make_request_line(method, path);
if ( p_req_header )
{
- _request_header::iterator it = p_req_header->begin();
+ request_header::iterator it = p_req_header->begin();
for(; it != p_req_header->end(); it++){
*this << it->first << ": " << it->second << _CRLF;
while( rs << *this );
return rs;
}
- response get(const char* path=NULL, _request_header *p_req_header=NULL)
+ response get(const char* path=NULL, request_header *p_req_header=NULL)
{
//////////////////////////////////////////////////////////////////////
// Path is considered to be URL if called by the default constructor.
request("GET", path, p_req_header);
return get_response();
}
- response post(const char* path=NULL, _request_header *p_req_header=NULL)
+ response post(const char* path=NULL, request_header *p_req_header=NULL)
{
//////////////////////////////////////////////////////////////////////
// Path is considered to be URL if called by the default constructor.