From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

httpserver: do not use Boost Regex library

Using Boost's regex library in the "httpserver" module caused us a lot of
grief, such as version mismatches, annoying warnings, and the straw that
broke the camel's back - failure to load in Boost 1.66 without the huge
ICU libraries being available.

But there was never really any good reason to use boost::regex, since C++11
has std::regex. So this patch finally stops using boost::regex, and
switches to using std::regex.

Fixes #962
Fixes #600

Signed-off-by: Nadav Har'El <n...@scylladb.com>

---
diff --git a/modules/httpserver-api/Makefile b/modules/httpserver-api/Makefile
--- a/modules/httpserver-api/Makefile
+++ b/modules/httpserver-api/Makefile
@@ -21,7 +21,7 @@ ifndef OSV_BUILD_PATH
 endif
 miscbase = $(src)/external/$(ARCH)/misc.bin
 libs-dir = $(miscbase)/usr/lib64
-boost-libs := -lboost_system -lboost_filesystem -lboost_regex
+boost-libs := -lboost_system -lboost_filesystem

 # the build target executable:
 TARGET = httpserver-api
diff --git a/modules/httpserver-api/api/file.cc b/modules/httpserver-api/api/file.cc
--- a/modules/httpserver-api/api/file.cc
+++ b/modules/httpserver-api/api/file.cc
@@ -23,7 +23,7 @@
 #include <vector>
 #include "boost/filesystem/path.hpp"
 #include <boost/algorithm/string.hpp>
-#include <boost/regex.hpp>
+#include <regex>
 #include <boost/algorithm/string/replace.hpp>
 #include <sys/stat.h>

@@ -263,15 +263,15 @@ class get_file_handler : public file_interaction_handler {

         struct stat buffer;
         auto reg = global_to_regexp(strs[pos]);
-        boost::regex pattern(reg, boost::regex::normal);
+        std::regex pattern(reg, std::regex::ECMAScript);
         boost::filesystem::directory_iterator end_itr;
         for (; itr != end_itr; ++itr) {
             if (pos + 1 == strs.size()) {
- if (boost::regex_match(itr->path().filename().string(), pattern) && stat((*itr).path().string().c_str(), &buffer) == 0) { + if (std::regex_match(itr->path().filename().string(), pattern) && stat((*itr).path().string().c_str(), &buffer) == 0) { res.push_back(get_file_status(itr->path().string(), itr->path().filename().string(), buffer));
                 }
             } else {
- if (boost::filesystem::is_directory(itr->status()) && boost::regex_match(itr->path().filename().string(), pattern)) { + if (boost::filesystem::is_directory(itr->status()) && std::regex_match(itr->path().filename().string(), pattern)) { boost::filesystem::directory_iterator subdir_itr(itr->path()); list_directory_using_wildcard(strs, pos + 1, subdir_itr,res);
                 }
diff --git a/modules/httpserver-jolokia-plugin/Makefile b/modules/httpserver-jolokia-plugin/Makefile
--- a/modules/httpserver-jolokia-plugin/Makefile
+++ b/modules/httpserver-jolokia-plugin/Makefile
@@ -28,8 +28,7 @@ endif
 miscbase = $(src)/external/$(ARCH)/misc.bin
 libs-dir = $(miscbase)/usr/lib64
 boost-libs := $(libs-dir)/libboost_system.so \
-              $(libs-dir)/libboost_filesystem.so \
-              $(libs-dir)/libboost_regex.so
+              $(libs-dir)/libboost_filesystem.so

 # the build target executable:
 TARGET = jolokia
diff --git a/modules/httpserver-jvm-plugin/Makefile b/modules/httpserver-jvm-plugin/Makefile
--- a/modules/httpserver-jvm-plugin/Makefile
+++ b/modules/httpserver-jvm-plugin/Makefile
@@ -28,8 +28,7 @@ endif
 miscbase = $(src)/external/$(ARCH)/misc.bin
 libs-dir = $(miscbase)/usr/lib64
 boost-libs := $(libs-dir)/libboost_system.so \
-              $(libs-dir)/libboost_filesystem.so \
-              $(libs-dir)/libboost_regex.so
+              $(libs-dir)/libboost_filesystem.so

 # the build target executable:
 TARGET = jvm

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to