RobT fork of HTTPServer library
Fork of HTTPServer by
Diff: LPC2368/services/http/server/HTTPServer.h
- Revision:
- 2:356c7fa399ae
- Parent:
- 1:56636f5bf71a
- Child:
- 6:d753966e4d97
--- 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; };