Adjustments to ServerCore changes.
This commit is contained in:
		
							parent
							
								
									ed39ea0b7b
								
							
						
					
					
						commit
						e7b4ae818f
					
				
							
								
								
									
										
											BIN
										
									
								
								Debug/main.cpp.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Debug/main.cpp.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -2,24 +2,23 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \ | |||||||
|  ../CoreUtils/Log.h ../CoreUtils/includes ../CoreUtils/File.h \ |  ../CoreUtils/Log.h ../CoreUtils/includes ../CoreUtils/File.h \ | ||||||
|  ../ServerCore/Object.h ../ServerCore/includes ../CoreUtils/LogListener.h \ |  ../ServerCore/Object.h ../ServerCore/includes ../CoreUtils/LogListener.h \ | ||||||
|  ../ServerCore/Socket.h ../ServerCore/Object.h ../ServerCore/Thread.h \ |  ../ServerCore/Socket.h ../ServerCore/Object.h ../ServerCore/Thread.h \ | ||||||
|  ../ServerCore/Session.h ../ServerCore/TCPSocket.h \ |  ../ServerCore/TCPSession.h ../ServerCore/TCPSocket.h \ | ||||||
|  ../ServerCore/IPAddress.h ../ServerCore/SessionFilter.h \ |  ../ServerCore/IPAddress.h ../ServerCore/SessionFilter.h \ | ||||||
|  ../ServerCore/Command.h ../ServerCore/ConsoleService.h \ |  ../ServerCore/Command.h ../ServerCore/ConsoleServer.h \ | ||||||
|  ../ServerCore/Service.h ../ServerCore/CommandList.h \ |  ../ServerCore/TCPServer.h ../ServerCore/IPAddressList.h \ | ||||||
|  ../ServerCore/ConsoleSession.h ../ServerCore/TerminalSession.h \ |  ../ServerCore/CommandList.h ../ServerCore/EPoll.h \ | ||||||
|  ../ServerCore/TCPServerSocket.h ../ServerCore/IPAddressList.h \ |  | ||||||
|  ../CoreUtils/Exception.h ../CoreUtils/File.h ../ServerCore/IPAddress.h \ |  ../CoreUtils/Exception.h ../CoreUtils/File.h ../ServerCore/IPAddress.h \ | ||||||
|  HTTPService.h ../ServerCore/Service.h HTTPSessions.h HTTPRequest.h \ |  HTTPServer.h HTTPService.h HTTPSessions.h HTTPRequest.h \ | ||||||
|  ../CoreUtils/PString.h ../CoreUtils/IMFMessage.h ../CoreUtils/PString.h \ |  ../CoreUtils/PString.h ../CoreUtils/IMFMessage.h ../CoreUtils/PString.h \ | ||||||
|  ../CoreUtils/IMFHeader.h ../CoreUtils/IMFRequest.h \ |  ../CoreUtils/IMFHeader.h ../CoreUtils/IMFRequest.h \ | ||||||
|  ../CoreUtils/IMFBody.h ../CoreUtils/IMFRequest.h \ |  ../CoreUtils/IMFBody.h ../CoreUtils/IMFRequest.h \ | ||||||
|  ../CoreUtils/IMFResponse.h ../CoreUtils/IMFMessage.h \ |  ../CoreUtils/IMFResponse.h ../CoreUtils/IMFMessage.h \ | ||||||
|  ../ServerCore/Command.h ../ServerCore/Session.h HTTPPageList.h __index.h \ |  ../ServerCore/Command.h ../ServerCore/TCPSession.h HTTPPageList.h \ | ||||||
|  HTTPPage.h HTTPSession.h ../JET/Variables.h __script.h __editview.h \ |  __index.h HTTPPage.h HTTPSession.h ../JET/Variables.h __script.h \ | ||||||
|  __style.h __setupadmin.h __favicon_ico.h __welcome.h \ |  __editview.h __style.h __setupadmin.h __favicon_ico.h __welcome.h \ | ||||||
|  ../BMAMySQL/BMAMySQL.h __mainmenu.h __newview.h __configure.h \ |  ../BMAMySQL/BMAMySQL.h __mainmenu.h __newview.h __configure.h \ | ||||||
|  __viewlist.h ../CoreUtils/Directory.h ../CoreUtils/DirectoryEntry.h \ |  __viewlist.h ../CoreUtils/Directory.h ../CoreUtils/DirectoryEntry.h \ | ||||||
|  HTTPHandler.h |  HTTPHandler.h ../ServerCore/TCPServer.h | ||||||
| 
 | 
 | ||||||
| ../ServerCore/includes: | ../ServerCore/includes: | ||||||
| 
 | 
 | ||||||
| @ -43,7 +42,7 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \ | |||||||
| 
 | 
 | ||||||
| ../ServerCore/Thread.h: | ../ServerCore/Thread.h: | ||||||
| 
 | 
 | ||||||
| ../ServerCore/Session.h: | ../ServerCore/TCPSession.h: | ||||||
| 
 | 
 | ||||||
| ../ServerCore/TCPSocket.h: | ../ServerCore/TCPSocket.h: | ||||||
| 
 | 
 | ||||||
| @ -53,19 +52,15 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \ | |||||||
| 
 | 
 | ||||||
| ../ServerCore/Command.h: | ../ServerCore/Command.h: | ||||||
| 
 | 
 | ||||||
| ../ServerCore/ConsoleService.h: | ../ServerCore/ConsoleServer.h: | ||||||
| 
 | 
 | ||||||
| ../ServerCore/Service.h: | ../ServerCore/TCPServer.h: | ||||||
|  | 
 | ||||||
|  | ../ServerCore/IPAddressList.h: | ||||||
| 
 | 
 | ||||||
| ../ServerCore/CommandList.h: | ../ServerCore/CommandList.h: | ||||||
| 
 | 
 | ||||||
| ../ServerCore/ConsoleSession.h: | ../ServerCore/EPoll.h: | ||||||
| 
 |  | ||||||
| ../ServerCore/TerminalSession.h: |  | ||||||
| 
 |  | ||||||
| ../ServerCore/TCPServerSocket.h: |  | ||||||
| 
 |  | ||||||
| ../ServerCore/IPAddressList.h: |  | ||||||
| 
 | 
 | ||||||
| ../CoreUtils/Exception.h: | ../CoreUtils/Exception.h: | ||||||
| 
 | 
 | ||||||
| @ -73,9 +68,9 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \ | |||||||
| 
 | 
 | ||||||
| ../ServerCore/IPAddress.h: | ../ServerCore/IPAddress.h: | ||||||
| 
 | 
 | ||||||
| HTTPService.h: | HTTPServer.h: | ||||||
| 
 | 
 | ||||||
| ../ServerCore/Service.h: | HTTPService.h: | ||||||
| 
 | 
 | ||||||
| HTTPSessions.h: | HTTPSessions.h: | ||||||
| 
 | 
 | ||||||
| @ -101,7 +96,7 @@ HTTPRequest.h: | |||||||
| 
 | 
 | ||||||
| ../ServerCore/Command.h: | ../ServerCore/Command.h: | ||||||
| 
 | 
 | ||||||
| ../ServerCore/Session.h: | ../ServerCore/TCPSession.h: | ||||||
| 
 | 
 | ||||||
| HTTPPageList.h: | HTTPPageList.h: | ||||||
| 
 | 
 | ||||||
| @ -140,3 +135,5 @@ __viewlist.h: | |||||||
| ../CoreUtils/DirectoryEntry.h: | ../CoreUtils/DirectoryEntry.h: | ||||||
| 
 | 
 | ||||||
| HTTPHandler.h: | HTTPHandler.h: | ||||||
|  | 
 | ||||||
|  | ../ServerCore/TCPServer.h: | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| #include "HTTPHandler.h" | #include "HTTPHandler.h" | ||||||
| #include "HTTPSession.h" | #include "HTTPSession.h" | ||||||
| #include "HTTPService.h" | #include "HTTPServer.h" | ||||||
| #include "HTTPRequest.h" | #include "HTTPRequest.h" | ||||||
| #include "PString.h" | #include "PString.h" | ||||||
| #include "IMFFormData.h" | #include "IMFFormData.h" | ||||||
| @ -8,16 +8,16 @@ | |||||||
| 
 | 
 | ||||||
| namespace http { | namespace http { | ||||||
| 
 | 
 | ||||||
|    int HTTPHandler::processCommand(std::string request, core::Session *session, std::stringstream &data) { |    int HTTPHandler::processCommand(std::string request, core::TCPSession *session, std::stringstream &data) { | ||||||
|     |     | ||||||
|       coreutils::PString request1(request); |       coreutils::PString request1(request); | ||||||
|       HTTPRequest httpRequest(request1); |       HTTPRequest httpRequest(request1); | ||||||
| 		 | 		 | ||||||
|       HTTPSession *httpSession = ((HTTPService &)session->service).httpSessions.findSessionByHeader(httpRequest); |       HTTPSession *httpSession = static_cast<HTTPServer &>(session->server).httpSessions.findSessionByHeader(httpRequest); | ||||||
| 
 | 
 | ||||||
|       std::stringstream content; |       std::stringstream content; | ||||||
|        |        | ||||||
|       if(((HTTPService &)session->service).pageList.processRequest(httpRequest, session, httpSession, content)) { |       if(static_cast<HTTPServer &>(session->server).pageList.processRequest(httpRequest, session, httpSession, content)) { | ||||||
| 			std::string contentType = httpRequest.getHeader("Content-Type"); | 			std::string contentType = httpRequest.getHeader("Content-Type"); | ||||||
| 			if(contentType == "multipart/form-data") { | 			if(contentType == "multipart/form-data") { | ||||||
| 				coreutils::IMFFormData *formdata = (coreutils::IMFFormData *)httpRequest.getBody(); | 				coreutils::IMFFormData *formdata = (coreutils::IMFFormData *)httpRequest.getBody(); | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ | |||||||
| #define __HTTPHandler_h__ | #define __HTTPHandler_h__ | ||||||
| 
 | 
 | ||||||
| #include "Command.h" | #include "Command.h" | ||||||
| #include "Session.h" | #include "TCPSession.h" | ||||||
| #include "Log.h" | #include "Log.h" | ||||||
| 
 | 
 | ||||||
| namespace http { | namespace http { | ||||||
| @ -10,7 +10,7 @@ namespace http { | |||||||
|    class HTTPHandler : public core::Command { |    class HTTPHandler : public core::Command { | ||||||
|     |     | ||||||
|     public: |     public: | ||||||
|       int processCommand(std::string request, core::Session *session, std::stringstream &data) override; |       int processCommand(std::string request, core::TCPSession *session, std::stringstream &data) override; | ||||||
|        |        | ||||||
|    }; |    }; | ||||||
|        |        | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| 
 | 
 | ||||||
| #include "HTTPSession.h" | #include "HTTPSession.h" | ||||||
| #include "HTTPRequest.h" | #include "HTTPRequest.h" | ||||||
| #include "Session.h" | #include "TCPSession.h" | ||||||
| #include "Log.h" | #include "Log.h" | ||||||
| 
 | 
 | ||||||
| namespace http { | namespace http { | ||||||
| @ -23,7 +23,7 @@ namespace http { | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       virtual int processCommand(std::string request,  |       virtual int processCommand(std::string request,  | ||||||
|                                  core::Session *session,  |                                  core::TCPSession *session,  | ||||||
|                                  HTTPSession *httpSession,  |                                  HTTPSession *httpSession,  | ||||||
|                                  HTTPRequest &httpRequest,  |                                  HTTPRequest &httpRequest,  | ||||||
|                                  std::stringstream &data) { |                                  std::stringstream &data) { | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ | |||||||
| 
 | 
 | ||||||
| namespace http { | namespace http { | ||||||
|           |           | ||||||
|    bool HTTPPageList::processRequest(HTTPRequest &httpRequest, core::Session *session, HTTPSession *httpSession, std::stringstream &data) {       |    bool HTTPPageList::processRequest(HTTPRequest &httpRequest, core::TCPSession *session, HTTPSession *httpSession, std::stringstream &data) {       | ||||||
|       httpRequest.response.setProtocol(httpRequest.request.getProtocol()); |       httpRequest.response.setProtocol(httpRequest.request.getProtocol()); | ||||||
|       for(auto *page : pages) { |       for(auto *page : pages) { | ||||||
|          if(page->check(httpRequest.request.getURI())) { |          if(page->check(httpRequest.request.getURI())) { | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| #ifndef __HTTPPageList_h__ | #ifndef __HTTPPageList_h__ | ||||||
| #define __HTTPPageList_h__ | #define __HTTPPageList_h__ | ||||||
| 
 | 
 | ||||||
| #include "Session.h" | #include "TCPSession.h" | ||||||
| #include "HTTPRequest.h" | #include "HTTPRequest.h" | ||||||
| #include "__index.h" | #include "__index.h" | ||||||
| #include "__script.h" | #include "__script.h" | ||||||
| @ -34,7 +34,7 @@ namespace http { | |||||||
|          add(viewlist, "/viewlist"); |          add(viewlist, "/viewlist"); | ||||||
|       }       |       }       | ||||||
| 
 | 
 | ||||||
|       bool processRequest(HTTPRequest &httpRequest, core::Session *session, HTTPSession *httpSession, std::stringstream &data);       |       bool processRequest(HTTPRequest &httpRequest, core::TCPSession *session, HTTPSession *httpSession, std::stringstream &data);       | ||||||
| 
 | 
 | ||||||
|       void add(HTTPPage &page, std::string name = ""); |       void add(HTTPPage &page, std::string name = ""); | ||||||
|        |        | ||||||
|  | |||||||
| @ -1,31 +1,31 @@ | |||||||
| #ifndef __HTTPService_h__ | #ifndef __HTTPServer_h__ | ||||||
| #define __HTTPService_h__ | #define __HTTPServer_h__ | ||||||
| 
 | 
 | ||||||
| #include "Service.h" | #include "TCPServer.h" | ||||||
| #include "HTTPSessions.h" | #include "HTTPSessions.h" | ||||||
| #include "HTTPPageList.h" | #include "HTTPPageList.h" | ||||||
| #include "Exception.h" |  | ||||||
| #include "HTTPHandler.h" | #include "HTTPHandler.h" | ||||||
| 
 | 
 | ||||||
| namespace http { | namespace http { | ||||||
|    |   | ||||||
|    class HTTPService : public core::Service { |    class HTTPServer : public core::TCPServer { | ||||||
| 
 |        | ||||||
|     public: |     public: | ||||||
|       HTTPService() {	    |       HTTPServer(core::EPoll &ePoll, core::IPAddress ipAddress, HTTPSessions &httpSessions)  | ||||||
|  |       : TCPServer(ePoll, ipAddress), httpSessions(httpSessions) { | ||||||
|          commands.add(getHandler, "GET"); |          commands.add(getHandler, "GET"); | ||||||
|          commands.add(postHandler, "POST"); |          commands.add(postHandler, "POST"); | ||||||
|       }       |       } | ||||||
| 
 | 
 | ||||||
|       HTTPSessions httpSessions; |       HTTPSessions &httpSessions; | ||||||
|       HTTPPageList pageList; |       HTTPPageList pageList; | ||||||
|             |             | ||||||
|     private: |     private: | ||||||
|       HTTPHandler getHandler; |       HTTPHandler getHandler; | ||||||
|       HTTPHandler postHandler; |       HTTPHandler postHandler; | ||||||
|        |  | ||||||
|    }; |  | ||||||
| 
 | 
 | ||||||
|  |    }; | ||||||
|  |    | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| @ -13,7 +13,7 @@ CurrentFileName        := | |||||||
| CurrentFilePath        := | CurrentFilePath        := | ||||||
| CurrentFileFullPath    := | CurrentFileFullPath    := | ||||||
| User                   :=Brad Arant | User                   :=Brad Arant | ||||||
| Date                   :=12/09/19 | Date                   :=18/09/19 | ||||||
| CodeLitePath           :=/home/bradarant/.codelite | CodeLitePath           :=/home/bradarant/.codelite | ||||||
| LinkerName             :=/usr/bin/x86_64-linux-gnu-g++ | LinkerName             :=/usr/bin/x86_64-linux-gnu-g++ | ||||||
| SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC | SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC | ||||||
|  | |||||||
| @ -3,7 +3,6 @@ | |||||||
|   <Description/> |   <Description/> | ||||||
|   <Dependencies/> |   <Dependencies/> | ||||||
|   <VirtualDirectory Name="src"> |   <VirtualDirectory Name="src"> | ||||||
|     <File Name="HTTPService.h"/> |  | ||||||
|     <File Name="main.cpp"/> |     <File Name="main.cpp"/> | ||||||
|     <File Name="HTTPSession.h"/> |     <File Name="HTTPSession.h"/> | ||||||
|     <File Name="HTTPSession.cpp"/> |     <File Name="HTTPSession.cpp"/> | ||||||
| @ -27,6 +26,7 @@ | |||||||
|     <File Name="__configure.h"/> |     <File Name="__configure.h"/> | ||||||
|     <File Name="__viewlist.h"/> |     <File Name="__viewlist.h"/> | ||||||
|     <File Name="HTTPPageCache.h"/> |     <File Name="HTTPPageCache.h"/> | ||||||
|  |     <File Name="HTTPServer.h"/> | ||||||
|   </VirtualDirectory> |   </VirtualDirectory> | ||||||
|   <Dependencies Name="Debug"/> |   <Dependencies Name="Debug"/> | ||||||
|   <Dependencies Name="Release"/> |   <Dependencies Name="Release"/> | ||||||
|  | |||||||
| @ -44,7 +44,7 @@ namespace http { | |||||||
|       return uuid_s; |       return uuid_s; | ||||||
|    } |    } | ||||||
|     |     | ||||||
|    int HTTPSessions::processCommand(std::string command, core::Session *session, std::stringstream &data) {  |    int HTTPSessions::processCommand(std::string command, core::TCPSession *session, std::stringstream &data) {  | ||||||
|       if(sessions.size() > 0) { |       if(sessions.size() > 0) { | ||||||
|          int seq = 0; |          int seq = 0; | ||||||
|          for(auto httpSession: sessions)  |          for(auto httpSession: sessions)  | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| 
 | 
 | ||||||
| #include "HTTPRequest.h" | #include "HTTPRequest.h" | ||||||
| #include "Command.h" | #include "Command.h" | ||||||
| #include "Session.h" | #include "TCPSession.h" | ||||||
| 
 | 
 | ||||||
| namespace http { | namespace http { | ||||||
| 
 | 
 | ||||||
| @ -15,7 +15,7 @@ namespace http { | |||||||
|       HTTPSession * findSessionByHeader(HTTPRequest &httpRequest);   |       HTTPSession * findSessionByHeader(HTTPRequest &httpRequest);   | ||||||
|       HTTPSession * findSessionById(std::string sessionId, HTTPRequest &httpRequest);   |       HTTPSession * findSessionById(std::string sessionId, HTTPRequest &httpRequest);   | ||||||
| 
 | 
 | ||||||
|       int processCommand(std::string request, core::Session *session, std::stringstream &data); |       int processCommand(std::string request, core::TCPSession *session, std::stringstream &data); | ||||||
|        |        | ||||||
|     private: |     private: | ||||||
|       HTTPSession * createHTTPSession(); |       HTTPSession * createHTTPSession(); | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ namespace http { | |||||||
| 
 | 
 | ||||||
|    class __configure : public HTTPPage { |    class __configure : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { |       int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { | ||||||
|           |           | ||||||
|          data << "<form name=\"configure\" action=\"setupadmin\" method=\"POST\">" << std::endl; |          data << "<form name=\"configure\" action=\"setupadmin\" method=\"POST\">" << std::endl; | ||||||
|          data << " <div class=\"window\"><h1>System Configuration</h1>" << std::endl; |          data << " <div class=\"window\"><h1>System Configuration</h1>" << std::endl; | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ namespace http { | |||||||
| 
 | 
 | ||||||
|    class __editview : public HTTPPage { |    class __editview : public HTTPPage { | ||||||
| 
 | 
 | ||||||
|       int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { |       int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { | ||||||
| 
 | 
 | ||||||
|          data << "  <div style=\"position: relative;\">" << std::endl; |          data << "  <div style=\"position: relative;\">" << std::endl; | ||||||
|          data << "" << std::endl; |          data << "" << std::endl; | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ namespace http { | |||||||
|    class __favicon_ico : public HTTPPage { |    class __favicon_ico : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request,  |       int processCommand(std::string request,  | ||||||
|                          core::Session *session,  |                          core::TCPSession *session,  | ||||||
|                          HTTPSession *httpSession,  |                          HTTPSession *httpSession,  | ||||||
|                          HTTPRequest &httpRequest,  |                          HTTPRequest &httpRequest,  | ||||||
|                          std::stringstream &data) override { |                          std::stringstream &data) override { | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ namespace http { | |||||||
| 
 | 
 | ||||||
|    class __index : public HTTPPage { |    class __index : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { |       int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { | ||||||
|           |           | ||||||
|          data << "<html>" << std::endl; |          data << "<html>" << std::endl; | ||||||
|          data << " <head>" << std::endl; |          data << " <head>" << std::endl; | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ namespace http { | |||||||
|    class __mainmenu : public HTTPPage { |    class __mainmenu : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request,  |       int processCommand(std::string request,  | ||||||
|                          core::Session *session,  |                          core::TCPSession *session,  | ||||||
|                          HTTPSession *httpSession,  |                          HTTPSession *httpSession,  | ||||||
|                          HTTPRequest &httpRequest,  |                          HTTPRequest &httpRequest,  | ||||||
|                          std::stringstream &data) override { |                          std::stringstream &data) override { | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ namespace http { | |||||||
|    class __newview : public HTTPPage { |    class __newview : public HTTPPage { | ||||||
| 
 | 
 | ||||||
|       int processCommand(std::string request,  |       int processCommand(std::string request,  | ||||||
|                          core::Session *session,  |                          core::TCPSession *session,  | ||||||
|                          HTTPSession *httpSession,  |                          HTTPSession *httpSession,  | ||||||
|                          HTTPRequest &httpRequest,  |                          HTTPRequest &httpRequest,  | ||||||
|                          std::stringstream &data) override { |                          std::stringstream &data) override { | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ namespace http { | |||||||
| 
 | 
 | ||||||
|    class __script : public HTTPPage { |    class __script : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { |       int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { | ||||||
|                    |                    | ||||||
|          data << "function serverSend(url, type, receiver, formData, callback) {" << std::endl; |          data << "function serverSend(url, type, receiver, formData, callback) {" << std::endl; | ||||||
|          data << "   var server = new XMLHttpRequest();" << std::endl; |          data << "   var server = new XMLHttpRequest();" << std::endl; | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ namespace http { | |||||||
| 
 | 
 | ||||||
|    class __setupadmin : public HTTPPage { |    class __setupadmin : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { |       int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { | ||||||
|           |           | ||||||
|          data << "<form name=\"setupadmin\" action=\"setupadmin\" method=\"POST\">" << std::endl; |          data << "<form name=\"setupadmin\" action=\"setupadmin\" method=\"POST\">" << std::endl; | ||||||
|          data << " <div class=\"window\"><p>Please enter credential information" << std::endl; |          data << " <div class=\"window\"><p>Please enter credential information" << std::endl; | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ namespace http { | |||||||
| 
 | 
 | ||||||
|    class __style : public HTTPPage { |    class __style : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { |       int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { | ||||||
|           |           | ||||||
|          data << "body {background: #006;" << std::endl; |          data << "body {background: #006;" << std::endl; | ||||||
|          data << "      color: #fff;" << std::endl; |          data << "      color: #fff;" << std::endl; | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ namespace http { | |||||||
|    class __viewlist : public HTTPPage { |    class __viewlist : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request,  |       int processCommand(std::string request,  | ||||||
|                          core::Session *session,  |                          core::TCPSession *session,  | ||||||
|                          HTTPSession *httpSession,  |                          HTTPSession *httpSession,  | ||||||
|                          HTTPRequest &httpRequest,  |                          HTTPRequest &httpRequest,  | ||||||
|                          std::stringstream &data) override { |                          std::stringstream &data) override { | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ namespace http { | |||||||
|    class __welcome : public HTTPPage { |    class __welcome : public HTTPPage { | ||||||
|     |     | ||||||
|       int processCommand(std::string request,  |       int processCommand(std::string request,  | ||||||
|                          core::Session *session,  |                          core::TCPSession *session,  | ||||||
|                          HTTPSession *httpSession,  |                          HTTPSession *httpSession,  | ||||||
|                          HTTPRequest &httpRequest,  |                          HTTPRequest &httpRequest,  | ||||||
|                          std::stringstream &data) override { |                          std::stringstream &data) override { | ||||||
|  | |||||||
							
								
								
									
										22
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								main.cpp
									
									
									
									
									
								
							| @ -1,11 +1,11 @@ | |||||||
| #include "includes" | #include "includes" | ||||||
| #include "EPoll.h" | #include "EPoll.h" | ||||||
| #include "ConsoleService.h" | #include "ConsoleServer.h" | ||||||
| #include "Exception.h" | #include "Exception.h" | ||||||
| #include "File.h" | #include "File.h" | ||||||
| #include "Log.h" | #include "Log.h" | ||||||
| #include "IPAddress.h" | #include "IPAddress.h" | ||||||
| #include "HTTPService.h" | #include "HTTPServer.h" | ||||||
| 
 | 
 | ||||||
| int main(int argc, char **argv) { | int main(int argc, char **argv) { | ||||||
| 
 | 
 | ||||||
| @ -18,17 +18,17 @@ int main(int argc, char **argv) { | |||||||
|     |     | ||||||
|       core::EPoll ePoll; |       core::EPoll ePoll; | ||||||
|        |        | ||||||
|       http::HTTPService httpService; |       http::HTTPSessions httpSessions; | ||||||
|       core::TCPServerSocket http(ePoll, httpService, core::IPAddress(ipAddress, 8080)); |       http::HTTPServer http(ePoll, core::IPAddress(ipAddress, 8080), httpSessions); | ||||||
|  | //      http::HTTPSServer http(ePoll, core::IPAddress(ipAddress, 8143));
 | ||||||
| 
 | 
 | ||||||
|       core::ConsoleService consoleService; |       core::ConsoleServer console(ePoll, core::IPAddress(ipAddress, 1027)); | ||||||
|       core::TCPServerSocket console(ePoll, consoleService, core::IPAddress(ipAddress, 1027)); |  | ||||||
|        |        | ||||||
|       consoleService.commands.add(ePoll, "threads"); |       console.commands.add(ePoll, "threads"); | ||||||
|       consoleService.commands.add(httpService.httpSessions, "sessions");  |       console.commands.add(httpSessions, "sessions");  | ||||||
|       consoleService.commands.add(console, "consoles"); |       console.commands.add(console, "consoles"); | ||||||
|       consoleService.commands.add(consoleService.commands, "help"); |       console.commands.add(console.commands, "help"); | ||||||
|       ePoll.start(16, 1000); |       ePoll.start(2, 1000); | ||||||
| 
 | 
 | ||||||
|       while(true) |       while(true) | ||||||
|         sleep(300); |         sleep(300); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user