From 9f746d958099458dc11afdf410fb0b24ee510cac Mon Sep 17 00:00:00 2001 From: Comment Date: Thu, 14 Feb 2013 00:10:51 +0000 Subject: URI segmentation --- rotord/rotord.cpp | 21 ++++++++++++++++++--- rotord/rotord.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/rotord/rotord.cpp b/rotord/rotord.cpp index ccb770b..965d290 100644 --- a/rotord/rotord.cpp +++ b/rotord/rotord.cpp @@ -14,7 +14,7 @@ void RotorRequestHandler::handleRequest(HTTPServerRequest& request,HTTPServerRes std::ostream& ostr = response.send(); ostr << "RotorServer powered by " "POCO C++ Libraries"; - ostr << ""; + ostr << ""; ostr << "

"; ostr << dt; @@ -27,8 +27,23 @@ RotorRequestHandlerFactory::RotorRequestHandlerFactory(const std::string& format HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPServerRequest& request){ Application& app = Application::instance(); - app.logger().information("Request from "+ request.clientAddress().toString()+": "+request.getURI()); - if (request.getURI() == "/") + + Poco::URI theuri=Poco::URI(request.getURI()); + std::vector segments; + theuri.getPathSegments(segments); + + std::ostringstream ostr; + ostr << segments.size(); + + std::string out; + for (uint i=0;i +#include #include "Poco/URI.h" using Poco::Net::ServerSocket; -- cgit v1.2.3