diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2009-02-11 05:29:41 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2009-02-11 05:29:41 +0000 |
| commit | f4b191f0ea396b58465bfba40749977780a3af58 (patch) | |
| tree | 891490e91ab3b67524be67b2b71c85d84fd2f92a /src/old/tests/httpsrv | |
| parent | 292ae9453e7fdb2f1023ed9dfc99cbcd751f8b90 (diff) | |
| download | libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.gz libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.bz2 libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.xz libbu++-f4b191f0ea396b58465bfba40749977780a3af58.zip | |
Just removing some things that are cluttering up the source tree.
Diffstat (limited to 'src/old/tests/httpsrv')
| -rw-r--r-- | src/old/tests/httpsrv/httpconnectionmonitor.cpp | 88 | ||||
| -rw-r--r-- | src/old/tests/httpsrv/httpconnectionmonitor.h | 16 | ||||
| -rw-r--r-- | src/old/tests/httpsrv/main.cpp | 22 |
3 files changed, 0 insertions, 126 deletions
diff --git a/src/old/tests/httpsrv/httpconnectionmonitor.cpp b/src/old/tests/httpsrv/httpconnectionmonitor.cpp deleted file mode 100644 index 51d82f3..0000000 --- a/src/old/tests/httpsrv/httpconnectionmonitor.cpp +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | #include "httpconnectionmonitor.h" | ||
| 2 | #include "http.h" | ||
| 3 | #include "exceptions.h" | ||
| 4 | #include <sys/stat.h> | ||
| 5 | |||
| 6 | HttpConnectionMonitor::HttpConnectionMonitor() | ||
| 7 | { | ||
| 8 | } | ||
| 9 | |||
| 10 | HttpConnectionMonitor::~HttpConnectionMonitor() | ||
| 11 | { | ||
| 12 | } | ||
| 13 | |||
| 14 | bool HttpConnectionMonitor::onNewConnection( Connection *pCon, int nPort ) | ||
| 15 | { | ||
| 16 | printf("Got connection on port %d\n", nPort ); | ||
| 17 | |||
| 18 | try | ||
| 19 | { | ||
| 20 | pCon->readInput( 60, 0 ); | ||
| 21 | printf("#######################\n%s\n#######################\n", pCon->getInput() ); | ||
| 22 | |||
| 23 | Http hp( pCon ); | ||
| 24 | while( hp.parseRequest() == false ); | ||
| 25 | printf("Done parsing.\n\n"); | ||
| 26 | |||
| 27 | if( hp.getRequestType() == Http::reqGet ) | ||
| 28 | { | ||
| 29 | printf("\"\"\"%s\"\"\"\n", hp.getRequestURI() ); | ||
| 30 | if( !strcmp( hp.getRequestURI(), "/" ) ) | ||
| 31 | { | ||
| 32 | std::string content("<html><head><title>Server Test</test></head><body>This is a test of a new system where all the pages will be more or less dynamic...<br>If you want to try to login, you can do that here:<br><form method=\"post\" action=\"showvars\" enctype=\"multipart/form-data\">Name: <input type=\"text\" name=\"name\"><br>Password: <input type=\"password\" name=\"pass\"><br><input type=\"submit\" name=\"action\" value=\"login\"></form></body></html>"); | ||
| 33 | hp.buildResponse(); | ||
| 34 | hp.setResponseContent( | ||
| 35 | "text/html", | ||
| 36 | content.c_str(), | ||
| 37 | content.size() | ||
| 38 | ); | ||
| 39 | hp.sendResponse(); | ||
| 40 | } | ||
| 41 | else | ||
| 42 | { | ||
| 43 | std::string content("<html><head><title>URL Not Found</test></head><body>There is no content mapped to the URL you requested. Please try another one.</body></html>"); | ||
| 44 | hp.buildResponse( 404, "File not found."); | ||
| 45 | hp.setResponseContent( | ||
| 46 | "text/html", | ||
| 47 | content.c_str(), | ||
| 48 | content.size() | ||
| 49 | ); | ||
| 50 | hp.sendResponse(); | ||
| 51 | } | ||
| 52 | } | ||
| 53 | else | ||
| 54 | { | ||
| 55 | printf("Non get: %s\n", hp.getRequestTypeStr() ); | ||
| 56 | pCon->appendOutput("HTTP/1.1 100 Continue\r\n\r\n"); | ||
| 57 | } | ||
| 58 | pCon->writeOutput(); | ||
| 59 | //for( int j = 0; j < 50; j++ ) | ||
| 60 | { | ||
| 61 | pCon->readInput( 1, 0 ); | ||
| 62 | //printf("Size so far: %d\n", pCon->getInputAmnt() ); | ||
| 63 | } | ||
| 64 | |||
| 65 | if( pCon->hasInput() ) | ||
| 66 | { | ||
| 67 | std::string s( pCon->getInput(), pCon->getInputAmnt() ); | ||
| 68 | |||
| 69 | pCon->printInputDebug(); | ||
| 70 | //printf("Reamining data\n==============\n%s\n==============\n", | ||
| 71 | // s.c_str() ); | ||
| 72 | } | ||
| 73 | |||
| 74 | pCon->disconnect(); | ||
| 75 | } | ||
| 76 | catch( ConnectionException &e ) | ||
| 77 | { | ||
| 78 | printf("Connection: %s\n", e.what() ); | ||
| 79 | } | ||
| 80 | |||
| 81 | return true; | ||
| 82 | } | ||
| 83 | |||
| 84 | bool HttpConnectionMonitor::onClosedConnection( Connection *pCon ) | ||
| 85 | { | ||
| 86 | return true; | ||
| 87 | } | ||
| 88 | |||
diff --git a/src/old/tests/httpsrv/httpconnectionmonitor.h b/src/old/tests/httpsrv/httpconnectionmonitor.h deleted file mode 100644 index 30c0afd..0000000 --- a/src/old/tests/httpsrv/httpconnectionmonitor.h +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | #ifndef HTTPCONNECTIONMONITOR_H | ||
| 2 | #define HTTPCONNECTIONMONITOR_H | ||
| 3 | |||
| 4 | #include "connectionmonitor.h" | ||
| 5 | |||
| 6 | class HttpConnectionMonitor : public ConnectionMonitor | ||
| 7 | { | ||
| 8 | public: | ||
| 9 | HttpConnectionMonitor(); | ||
| 10 | ~HttpConnectionMonitor(); | ||
| 11 | |||
| 12 | bool onNewConnection( Connection *pCon, int nPort ); | ||
| 13 | bool onClosedConnection( Connection *pCon ); | ||
| 14 | }; | ||
| 15 | |||
| 16 | #endif | ||
diff --git a/src/old/tests/httpsrv/main.cpp b/src/old/tests/httpsrv/main.cpp deleted file mode 100644 index 2f1563c..0000000 --- a/src/old/tests/httpsrv/main.cpp +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | #include "connectionmanager.h" | ||
| 2 | #include "httpconnectionmonitor.h" | ||
| 3 | |||
| 4 | int main() | ||
| 5 | { | ||
| 6 | printf("Starting server...\n"); | ||
| 7 | |||
| 8 | ConnectionManager srv; | ||
| 9 | HttpConnectionMonitor http; | ||
| 10 | |||
| 11 | srv.setConnectionMonitor( &http ); | ||
| 12 | |||
| 13 | printf("Listening on port 7331\n"); | ||
| 14 | srv.startServer( 7331 ); | ||
| 15 | |||
| 16 | for(;;) | ||
| 17 | { | ||
| 18 | srv.scanConnections( 5000, false ); | ||
| 19 | } | ||
| 20 | |||
| 21 | return 0; | ||
| 22 | } | ||
