#include "Header.h"
#include "Log.h"

namespace core {
   
   Header::Header(std::string data) : data(data) {
      //   Log(LOG_DEBUG_4) << data;
   }
   
   Header::~Header() {}
   
   std::string Header::requestMethod() {
      return data.substr(0, data.find(" "));
   }
   
   std::string Header::requestURL() {
      std::string temp = data.substr(data.find(" ") + 1);
      return temp.substr(0, temp.find(" "));
   }
   
   std::string Header::requestProtocol() {
      std::string line1 = data.substr(0, data.find("\r\n"));
      return line1.substr(line1.rfind(" ") + 1);
   }
   
}



