namespace roast
{
- template <typename _TelnetT = ::roast::telnet >
- class http_ : public _TelnetT
+ class http_
{
public:
- class url
- {
- private:
- int port_no;
- ::std::string host_s;
- ::std::string path_s;
- public:
- url(const char* url)
- {
- port_no = 80;
- //if ( strncmp(url, "http://") == 0 )
- const char* p_host = strstr(url,"://");
- if ( p_host == NULL )
- p_host = url;
- else
- p_host += 3;
-
- //const char* p_port_specify = strchr(
- const char* phost_slash = strchr(p_host,'/');
- if ( phost_slash == NULL )
- {
- host_s = p_host;
- path_s = "/";
- }
- else
- {
- host_s = ::std::string(p_host, phost_slash-p_host);
- //path = phost_slash+1;
- path_s = phost_slash;
- }
-
- const char* host_cstr = host_s.c_str();
- size_t n_port_colon = host_s.find(':');
- if ( n_port_colon != ::std::string::npos )
- {
- const char* p_port_colon = host_cstr + n_port_colon;
- port_no = atoi(p_port_colon+1);
- host_s.erase(p_port_colon - host_cstr);
- }
- }
-
- int get_portno(){ return port_no; }
- const char* get_host(){ return host_s.c_str(); }
- const char* get_path(){ return path_s.c_str(); }
- };
-
- //////////////////////////////////////////////////////////////////////////////////////////////////////
-
//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 >
{
};
private:
- typedef _TelnetT _Base;
-
const char* m_httpver;
const char* _CRLF;