aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/net/http_base.h
diff options
context:
space:
mode:
authormj-xmr <mjxmr@protonmail.com>2020-11-12 19:14:32 +0100
committermj-xmr <mjxmr@protonmail.com>2021-04-16 20:54:20 +0200
commitdc81e23e60f6539b5d273bd42024e765b6cdf2d5 (patch)
tree32229c8c475a3a3f73dec63cf36a57c00e768e39 /contrib/epee/include/net/http_base.h
parentRevert "Merge pull request #7136" (diff)
downloadmonero-dc81e23e60f6539b5d273bd42024e765b6cdf2d5.tar.xz
Split epee/string_tools.h and encapsulate boost::lexical_cast
Diffstat (limited to 'contrib/epee/include/net/http_base.h')
-rw-r--r--contrib/epee/include/net/http_base.h38
1 files changed, 6 insertions, 32 deletions
diff --git a/contrib/epee/include/net/http_base.h b/contrib/epee/include/net/http_base.h
index bf6589c92..4af4da790 100644
--- a/contrib/epee/include/net/http_base.h
+++ b/contrib/epee/include/net/http_base.h
@@ -27,14 +27,13 @@
#pragma once
-#include <boost/lexical_cast.hpp>
-#include <boost/regex.hpp>
+#include "memwipe.h"
+
#include <boost/utility/string_ref.hpp>
+
#include <string>
#include <utility>
-
-#include "memwipe.h"
-#include "string_tools.h"
+#include <list>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
@@ -66,34 +65,9 @@ namespace net_utils
typedef std::list<std::pair<std::string, std::string> > fields_list;
- inline
- std::string get_value_from_fields_list(const std::string& param_name, const net_utils::http::fields_list& fields)
- {
- fields_list::const_iterator it = fields.begin();
- for(; it != fields.end(); it++)
- if(!string_tools::compare_no_case(param_name, it->first))
- break;
-
- if(it==fields.end())
- return std::string();
+ std::string get_value_from_fields_list(const std::string& param_name, const net_utils::http::fields_list& fields);
- return it->second;
- }
-
-
- inline
- std::string get_value_from_uri_line(const std::string& param_name, const std::string& uri)
- {
- std::string buff = "([\\?|&])";
- buff += param_name + "=([^&]*)";
- boost::regex match_param(buff.c_str(), boost::regex::icase | boost::regex::normal);
- boost::smatch result;
- if(boost::regex_search(uri, result, match_param, boost::match_default) && result[0].matched)
- {
- return result[2];
- }
- return std::string();
- }
+ std::string get_value_from_uri_line(const std::string& param_name, const std::string& uri);
static inline void add_field(std::string& out, const boost::string_ref name, const boost::string_ref value)
{