diff Core/HttpServer/MongooseServer.cpp @ 901:7d88f3f4a3b3 plugins

refactoring IsServedUri, answer PNG images, regular expression groups
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Jun 2014 15:22:13 +0200
parents bb0a51561016
children e078ea944089
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp	Wed Jun 18 14:02:02 2014 +0200
+++ b/Core/HttpServer/MongooseServer.cpp	Wed Jun 18 15:22:13 2014 +0200
@@ -255,22 +255,6 @@
 
 
 
-  void MongooseServer::FindHandlers(std::list<HttpHandler*>& result,
-                                    const UriComponents& forUri) const
-  {
-    for (Handlers::const_iterator it = 
-           handlers_.begin(); it != handlers_.end(); ++it) 
-    {
-      if ((*it)->IsServedUri(forUri))
-      {
-        result.push_back(*it);
-      }
-    }
-  }
-
-
-
-
   static PostDataStatus ReadBody(std::string& postData,
                                  struct mg_connection *connection,
                                  const HttpHandler::Arguments& headers)
@@ -702,20 +686,15 @@
       }
 
 
-      // Locate the candidate handlers for this URI
+      // Loop over the candidate handlers for this URI
       LOG(INFO) << EnumerationToString(method) << " " << Toolbox::FlattenUri(uri);
-      std::list<HttpHandler*> handlers;
-      that->FindHandlers(handlers, uri);
-
       bool found = false;
       bool isError = false;
       HttpStatus errorStatus;
       std::string errorDescription;
 
-
-      // Loop over the candidate handlers for this URI
-      for (std::list<HttpHandler*>::const_iterator
-             it = handlers.begin(); it != handlers.end() && !found; it++)
+      for (MongooseServer::Handlers::const_iterator it = 
+             that->GetHandlers().begin(); it != that->GetHandlers().end(); ++it) 
       {
         try
         {