From 1736bf4e0ae1882ee69d780331fd16e25d2f7ad9 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 12 Feb 2012 21:53:20 +0000 Subject: [PATCH] HttpQuery: CaseSensitive git-svn-id: svn://ultimatepp.org/upp/trunk@4580 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/TimeDate.cpp | 16 ---------------- uppsrc/Web/ScgiServer.cpp | 3 +++ uppsrc/Web/util.cpp | 2 +- uppsrc/Web/util.h | 8 ++++++-- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/uppsrc/Core/TimeDate.cpp b/uppsrc/Core/TimeDate.cpp index 8be0133a7..200b3c202 100644 --- a/uppsrc/Core/TimeDate.cpp +++ b/uppsrc/Core/TimeDate.cpp @@ -444,22 +444,6 @@ String Format(Time time, bool seconds) : Format(" %02d:%02d", time.hour, time.minute)); } -Time ScanTime(const char *fmt, const char *s, Date def) -{ - Date d; - if(StrToDate(fmt, d, s, def)) - return d; - return def; -} - -Time ScanTime(const char *s, Date def) -{ - Date d; - if(StrToDate(d, s, def)) - return d; - return def; -} - const char *StrToTime(Time& d, const char *s) { s = StrToDate(d, s); diff --git a/uppsrc/Web/ScgiServer.cpp b/uppsrc/Web/ScgiServer.cpp index 5d7183371..aa0fdd123 100644 --- a/uppsrc/Web/ScgiServer.cpp +++ b/uppsrc/Web/ScgiServer.cpp @@ -18,6 +18,9 @@ ScgiServer::ScgiServer(int port) signal(SIGABRT, sighandler); signal(SIGINT, sighandler); signal(SIGTERM, sighandler); + + query.CaseSensitive(); + post.CaseSensitive(); } void ScgiServer::Process() diff --git a/uppsrc/Web/util.cpp b/uppsrc/Web/util.cpp index c69b44284..dc49e5298 100644 --- a/uppsrc/Web/util.cpp +++ b/uppsrc/Web/util.cpp @@ -579,7 +579,7 @@ HttpQuery& HttpQuery::SetURL(const String& url) const char *last = p; while(*p && *p != '=' && *p != '&') p++; - String key = ToUpper(UrlDecode(last, p)); + String key = case_sensitive ? UrlDecode(last, p) : ToUpper(UrlDecode(last, p)); if(*p == '=') p++; last = p; diff --git a/uppsrc/Web/util.h b/uppsrc/Web/util.h index d6cbc9216..0a5ae6e3e 100644 --- a/uppsrc/Web/util.h +++ b/uppsrc/Web/util.h @@ -216,10 +216,14 @@ private: VectorMap map; }; + + bool case_sensitive; public: - HttpQuery(const Nuller& = Null) : data(Empty()) {} - explicit HttpQuery(String url) { data = Empty(); SetURL(url); } + HttpQuery(const Nuller& = Null) : data(Empty()) { case_sensitive = false; } + explicit HttpQuery(String url) { data = Empty(); SetURL(url); case_sensitive = false; } + + void CaseSensitive(bool b = true) { case_sensitive = b; } void Serialize(Stream& stream);