This library is deprecated.

Dependents:   HTTPServerExample HTTPServerHelloWorld PoorMansScope Lab3 ... more

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Fri Jun 18 09:20:52 2010 +0000
Parent:
1:56636f5bf71a
Child:
3:caea647478d2
Commit message:

Changed in this revision

LPC1768/HTTPServer.ar Show annotated file Show diff for this revision Revisions of this file
LPC1768/dbg/dbg.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/services/http/server/HTTPRequestDispatcher.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/services/http/server/HTTPRequestHandler.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/services/http/server/HTTPServer.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/HTTPServer.ar Show annotated file Show diff for this revision Revisions of this file
LPC2368/dbg/dbg.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPRequestDispatcher.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPRequestHandler.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPServer.h Show annotated file Show diff for this revision Revisions of this file
Binary file LPC1768/HTTPServer.ar has changed
--- a/LPC1768/dbg/dbg.h	Mon Jun 14 10:22:58 2010 +0000
+++ b/LPC1768/dbg/dbg.h	Fri Jun 18 09:20:52 2010 +0000
@@ -39,21 +39,26 @@
 public:
 static void debug(const char* format, ...);
 static void release();
+static void breakPoint(const char* file, int line);
 private:
 
 };
 
 #undef DBG
 #undef DBG_END
+#undef BREAK
 #define DBG DebugStream::debug
 #define DBG_END DebugStream::release
+#define BREAK() DebugStream::breakPoint(__FILE__, __LINE__)
 #endif
 
 #else
 #undef DBG
 #undef DBG_END
+#undef BREAK
 #define DBG(...)
 #define DBG_END()
+#define BREAK()
 #endif
 
 #ifdef __LWIP_DEBUG
--- a/LPC1768/services/http/server/HTTPRequestDispatcher.h	Mon Jun 14 10:22:58 2010 +0000
+++ b/LPC1768/services/http/server/HTTPRequestDispatcher.h	Fri Jun 18 09:20:52 2010 +0000
@@ -26,7 +26,6 @@
 
 class HTTPServer;
 
-#include "if/net/net.h"
 #include "api/TCPSocket.h"
 #include "HTTPServer.h"
 
@@ -60,7 +59,7 @@
   
   void onTimeout(); //Connection has timed out
 
-  bool getRequest(string* rootPath, string* subPath, string* meth);
+  bool getRequest(string* path, string* meth);
   
   HTTPServer* m_pSvr;
   TCPSocket* m_pTCPSocket;
--- a/LPC1768/services/http/server/HTTPRequestHandler.h	Mon Jun 14 10:22:58 2010 +0000
+++ b/LPC1768/services/http/server/HTTPRequestHandler.h	Fri Jun 18 09:20:52 2010 +0000
@@ -24,7 +24,6 @@
 #ifndef HTTP_REQUEST_HANDLER_H
 #define HTTP_REQUEST_HANDLER_H
 
-#include "if/net/net.h"
 #include "api/TCPSocket.h"
 //#include "HTTPServer.h"
 
--- a/LPC1768/services/http/server/HTTPServer.h	Mon Jun 14 10:22:58 2010 +0000
+++ b/LPC1768/services/http/server/HTTPServer.h	Fri Jun 18 09:20:52 2010 +0000
@@ -42,6 +42,20 @@
 public:
   HTTPServer();
   ~HTTPServer();
+  
+  struct handlersComp //Used to order handlers in the right way
+  {
+    bool operator() (const string& handler1, const string& handler2) const
+    {
+      //The first handler is longer than the second one
+      if (handler1.length() > handler2.length())
+        return true; //Returns true if handler1 is to appear before handler2
+      else if (handler1.length() < handler2.length())
+        return false;
+      else //To avoid the == case, sort now by address
+        return ((&handler1)>(&handler2));
+    }
+  };
 
   template<typename T>
   void addHandler(const char* path) //Template decl in header
@@ -55,7 +69,7 @@
   void onTCPSocketEvent(TCPSocketEvent e);
   
   TCPSocket* m_pTCPSocket;
-  map< string, HTTPRequestHandler*(*)(const char*, const char*, TCPSocket*) > m_lpHandlers;
+  map< string, HTTPRequestHandler*(*)(const char*, const char*, TCPSocket*), handlersComp > m_lpHandlers;
 
 };
 
Binary file LPC2368/HTTPServer.ar has changed
--- a/LPC2368/dbg/dbg.h	Mon Jun 14 10:22:58 2010 +0000
+++ b/LPC2368/dbg/dbg.h	Fri Jun 18 09:20:52 2010 +0000
@@ -39,21 +39,26 @@
 public:
 static void debug(const char* format, ...);
 static void release();
+static void breakPoint(const char* file, int line);
 private:
 
 };
 
 #undef DBG
 #undef DBG_END
+#undef BREAK
 #define DBG DebugStream::debug
 #define DBG_END DebugStream::release
+#define BREAK() DebugStream::breakPoint(__FILE__, __LINE__)
 #endif
 
 #else
 #undef DBG
 #undef DBG_END
+#undef BREAK
 #define DBG(...)
 #define DBG_END()
+#define BREAK()
 #endif
 
 #ifdef __LWIP_DEBUG
--- a/LPC2368/services/http/server/HTTPRequestDispatcher.h	Mon Jun 14 10:22:58 2010 +0000
+++ b/LPC2368/services/http/server/HTTPRequestDispatcher.h	Fri Jun 18 09:20:52 2010 +0000
@@ -26,7 +26,6 @@
 
 class HTTPServer;
 
-#include "if/net/net.h"
 #include "api/TCPSocket.h"
 #include "HTTPServer.h"
 
@@ -60,7 +59,7 @@
   
   void onTimeout(); //Connection has timed out
 
-  bool getRequest(string* rootPath, string* subPath, string* meth);
+  bool getRequest(string* path, string* meth);
   
   HTTPServer* m_pSvr;
   TCPSocket* m_pTCPSocket;
--- a/LPC2368/services/http/server/HTTPRequestHandler.h	Mon Jun 14 10:22:58 2010 +0000
+++ b/LPC2368/services/http/server/HTTPRequestHandler.h	Fri Jun 18 09:20:52 2010 +0000
@@ -24,7 +24,6 @@
 #ifndef HTTP_REQUEST_HANDLER_H
 #define HTTP_REQUEST_HANDLER_H
 
-#include "if/net/net.h"
 #include "api/TCPSocket.h"
 //#include "HTTPServer.h"
 
--- a/LPC2368/services/http/server/HTTPServer.h	Mon Jun 14 10:22:58 2010 +0000
+++ b/LPC2368/services/http/server/HTTPServer.h	Fri Jun 18 09:20:52 2010 +0000
@@ -42,6 +42,20 @@
 public:
   HTTPServer();
   ~HTTPServer();
+  
+  struct handlersComp //Used to order handlers in the right way
+  {
+    bool operator() (const string& handler1, const string& handler2) const
+    {
+      //The first handler is longer than the second one
+      if (handler1.length() > handler2.length())
+        return true; //Returns true if handler1 is to appear before handler2
+      else if (handler1.length() < handler2.length())
+        return false;
+      else //To avoid the == case, sort now by address
+        return ((&handler1)>(&handler2));
+    }
+  };
 
   template<typename T>
   void addHandler(const char* path) //Template decl in header
@@ -55,7 +69,7 @@
   void onTCPSocketEvent(TCPSocketEvent e);
   
   TCPSocket* m_pTCPSocket;
-  map< string, HTTPRequestHandler*(*)(const char*, const char*, TCPSocket*) > m_lpHandlers;
+  map< string, HTTPRequestHandler*(*)(const char*, const char*, TCPSocket*), handlersComp > m_lpHandlers;
 
 };