#include "HTTPPageList.h"

namespace http {
         
   bool HTTPPageList::processRequest(HTTPRequest *httpRequest, core::TCPSession *session, HTTPSession *httpSession, std::stringstream &data) {      
      httpRequest->response.setProtocol(httpRequest->request->getProtocol());
      for(auto *page : pages) {
         if(page->check(httpRequest->request->getURI())) {
            return page->processCommand(httpRequest->request->getURI(), session, httpSession, httpRequest, data);
         }
      }  
      return false;
   }

   void HTTPPageList::add(HTTPPage &page, std::string name) {
      page.name = name;
      pages.push_back(&page);
   }
   
   void HTTPPageList::remove(HTTPPage &page) {}
         
}


