[cpp-sp] 01/02: Redo scheme checking algorithm without Boost.
Scott Cantor
cantor.2 at osu.edu
Tue Dec 31 00:18:20 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository cpp-sp.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=0d9766124a01b5528d731901991324bb45222d3c
commit 0d9766124a01b5528d731901991324bb45222d3c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Dec 30 15:22:39 2024 -0500
Redo scheme checking algorithm without Boost.
---
shibsp/io/impl/HTTPResponse.cpp | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/shibsp/io/impl/HTTPResponse.cpp b/shibsp/io/impl/HTTPResponse.cpp
index cdada70c..c023f45a 100644
--- a/shibsp/io/impl/HTTPResponse.cpp
+++ b/shibsp/io/impl/HTTPResponse.cpp
@@ -23,12 +23,12 @@
#include <stdexcept>
-#include <boost/algorithm/string/predicate.hpp>
-#define BOOST_BIND_GLOBAL_PLACEHOLDERS
-#include <boost/bind.hpp>
+#ifndef HAVE_STRCASECMP
+# define strcasecmp _stricmp
+#endif
+
using namespace shibsp;
-using namespace boost;
using namespace std;
GenericResponse::GenericResponse()
@@ -48,9 +48,6 @@ vector<string>& HTTPResponse::getAllowedSchemes()
void HTTPResponse::sanitizeURL(const char* url)
{
- // predicate for checking scheme below
- static bool (*fn)(const string&, const string&, const std::locale&) = iequals;
-
const char* ch;
for (ch=url; *ch; ++ch) {
if (iscntrl((unsigned char)(*ch))) // convert to unsigned to allow full range from 00-FF
@@ -61,11 +58,12 @@ void HTTPResponse::sanitizeURL(const char* url)
if (!ch)
throw domain_error("URL is missing a colon where expected; improper URL encoding?");
string s(url, ch - url);
- std::locale loc;
- vector<string>::const_iterator i =
- find_if(m_allowedSchemes.begin(), m_allowedSchemes.end(), boost::bind(fn, boost::cref(s), _1, boost::cref(loc)));
- if (i != m_allowedSchemes.end())
- return;
+
+ for (const string& scheme : m_allowedSchemes) {
+ if (strcasecmp(s.c_str(), scheme.c_str()) == 0) {
+ return;
+ }
+ }
throw domain_error("URL contains invalid scheme.");
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list