OSDN Git Service

roast
authorMyun2 <myun2@nwhite.info>
Tue, 29 May 2012 08:16:53 +0000 (17:16 +0900)
committerMyun2 <myun2@nwhite.info>
Tue, 29 May 2012 08:16:53 +0000 (17:16 +0900)
roast/include/roast/net/http.hpp
roast/test/roast_test_3rd/roast_test_3rd.vcproj

index 995c6ad..ff72600 100644 (file)
@@ -5,23 +5,12 @@
 #ifndef __SFJP_ROAST__net__http_HPP__
 #define __SFJP_ROAST__net__http_HPP__
 
-#include "roast/net/telnet.hpp"
-#include "roast/net/base64.hpp"
-#include "roast/stream/stream.hpp"     //      for Debug Print
-#include <string>
-#include <map>
-#include <vector>
-
-#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_REQUEST_DEFAULT_VERSION            ROAST_HTTP_VER_1_0
+#include "roast/net/http_core.hpp"
 
 namespace roast
 {
        template <typename _TelnetT = ::roast::telnet >
-       class http_ : public _TelnetT
+       class http_ : public http_core_<_TelnetT>
        {
        public:
                class url
@@ -93,69 +82,6 @@ namespace roast
                
                //////////////////////////////////////////////////////////////////////////////////////////////////////
                
-               typedef ::std::map< ::std::string, ::std::string > _response_header_t, _response_header, response_header;
-       
-               class response
-               {
-               private:
-                       int m_now_flg;
-               public:
-                       const char* version;
-                       int status_code;
-                       _response_header headers;
-                       ::std::string body;
-
-               public:
-                       response(){
-                               m_now_flg = 0;
-                       }
-
-                       bool operator << (_TelnetT &tn)
-                       {
-                               ::std::string s;
-                               tn _ROAST_STREAM_OROP s;
-
-                               //      0: Status Line
-                               if ( m_now_flg == 0 )
-                               {
-                                       const char* p_s = s.c_str();
-                                       version = p_s + 5;
-                                       status_code = atoi(p_s + 8);
-
-                                       m_now_flg = 1;
-                               }
-
-                               //      1: Header Lines
-                               else if ( m_now_flg == 1 )
-                               {
-                                       /*if ( s.size() <= 2 )
-                                               m_now_flg = 2;
-                                       else
-                                       {*/
-                                       size_t n_colon = s.find(':');
-                                       if ( n_colon == ::std::string::npos )
-                                               m_now_flg = 2;
-                                       else
-                                       {
-                                               ::std::string s_header_name = s.substr(0, n_colon);
-                                               headers[ s_header_name ] = s.c_str() + n_colon + 1;
-                                       }
-                                       //}
-                               }
-                               //      2: Body
-                               else
-                               {
-                                       body += s;
-                               }
-
-                               //      Debug Print
-                               //fputs(s.c_str(), stdout);
-
-                               //m_n_line++;
-                               return !tn.is_eos();
-                       }
-               };
-               
        private:
                typedef _TelnetT _Base;
 
index 0cacad4..78bef44 100644 (file)
                        UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
                        >
                        <File
-                               RelativePath=".\http_test.cpp"
+                               RelativePath=".\tuple_test.cpp"
                                >
                        </File>
                </Filter>