From fb8f4cec67917c25102d6ae764d4e8635d0e7a11 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 1 Mar 2016 10:00:49 +0100 Subject: [PATCH] yhook: add helper function ParamList_exist() Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9c7ad87cff98c0186c0cddaead539f3da4eec021 Author: vanhofen Date: 2016-03-01 (Tue, 01 Mar 2016) Origin message was: ------------------ - yhook: add helper function ParamList_exist() --- src/nhttpd/yhttpd_core/yhook.cpp | 13 +++++++++++++ src/nhttpd/yhttpd_core/yhook.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index e9b9425ac..56537c057 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -366,6 +366,19 @@ std::string CyhookHandler::BuildHeader(bool cache) { return result; } +bool CyhookHandler::ParamList_exist(std::string keyword) +{ + bool exist = false; + unsigned int s = ParamList.size(); + for (unsigned int i = 1; i <= s; i++) + { + exist = (ParamList[itoa(i)] == keyword); + if (exist) + break; + } + return exist; +} + //============================================================================= // Output helpers //============================================================================= diff --git a/src/nhttpd/yhttpd_core/yhook.h b/src/nhttpd/yhttpd_core/yhook.h index 30bf18949..0fefe46a8 100644 --- a/src/nhttpd/yhttpd_core/yhook.h +++ b/src/nhttpd/yhttpd_core/yhook.h @@ -199,6 +199,8 @@ public: void SendRedirect(const std::string& url) {httpStatus=HTTP_MOVED_TEMPORARILY; NewURL = url; status = HANDLED_REDIRECTION;} void SendRewrite(const std::string& url) {NewURL = url; status = HANDLED_REWRITE;} + bool ParamList_exist(std::string keyword); + int _outIndent; TOutType outType; // Outputtpe = plain (default)|xml|json TOutType outStart(bool single = false);