From 33eb688470a65fb5c080b08e380c9225893aad53 Mon Sep 17 00:00:00 2001 From: Myun2 Date: Tue, 29 May 2012 17:16:53 +0900 Subject: [PATCH] roast --- roast/include/roast/net/http.hpp | 78 +------------------------ roast/test/roast_test_3rd/roast_test_3rd.vcproj | 2 +- 2 files changed, 3 insertions(+), 77 deletions(-) diff --git a/roast/include/roast/net/http.hpp b/roast/include/roast/net/http.hpp index 995c6add..ff726007 100644 --- a/roast/include/roast/net/http.hpp +++ b/roast/include/roast/net/http.hpp @@ -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 -#include -#include - -#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 - 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; diff --git a/roast/test/roast_test_3rd/roast_test_3rd.vcproj b/roast/test/roast_test_3rd/roast_test_3rd.vcproj index 0cacad4c..78bef444 100644 --- a/roast/test/roast_test_3rd/roast_test_3rd.vcproj +++ b/roast/test/roast_test_3rd/roast_test_3rd.vcproj @@ -175,7 +175,7 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > -- 2.11.0