<commit_before>#include <fnmatch.h>

#include "dispatch-handler.hh"
#include "request.hh"

namespace mimosa
{
  namespace http
  {
    DispatchHandler::DispatchHandler()
      : handlers_(),
        error_handler_(new ErrorHandler)
    {
    }

    void
    DispatchHandler::registerHandler(const std::string & pattern, Handler::ConstPtr handler)
    {
      handlers_[pattern] = handler;
    }

    bool
    DispatchHandler::handle(RequestReader & request, ResponseWriter & response) const
    {
      response.content_type_ = "text/html";
      for (auto it = handlers_.cbegin(); it != handlers_.cend(); ++it)
        if (!::fnmatch(it->first.c_str(), request.location().c_str(), FNM_PATHNAME))
          return it->second->handle(request, response);
      return error_handler_->handle(request, response, kStatusNotFound);
    }
  }
}
<commit_msg>Fixed dispatch handler fnmatch configuration<commit_after>#include <fnmatch.h>

#include "dispatch-handler.hh"
#include "request.hh"

namespace mimosa
{
  namespace http
  {
    DispatchHandler::DispatchHandler()
      : handlers_(),
        error_handler_(new ErrorHandler)
    {
    }

    void
    DispatchHandler::registerHandler(const std::string & pattern, Handler::ConstPtr handler)
    {
      handlers_[pattern] = handler;
    }

    bool
    DispatchHandler::handle(RequestReader & request, ResponseWriter & response) const
    {
      response.content_type_ = "text/html";
      for (auto it = handlers_.cbegin(); it != handlers_.cend(); ++it)
        if (!::fnmatch(it->first.c_str(), request.location().c_str(), 0))
          return it->second->handle(request, response);
      return error_handler_->handle(request, response, kStatusNotFound);
    }
  }
}

{'fraction_non_alphanumeric': 0.1313953488372093, 'fraction_numerical': 0.0005813953488372093, 'mean_word_length': 3.44702842377261, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4868873', 'n_tokens_mistral': 517, 'n_tokens_neox': 497, 'n_words': 100}