Boost uri update
Update to the latest version of boost::uri
The newest version of boost uri makes some breaking changes that we need
to account for. At the same time, we take the opportunity to move to
the error code based parse methods that don't rely on exceptions.
The biggest changes are:
The standalone build is no longer present. A discussion with the
boost::url maintainers shows that our best option is to do a simple
copy of the headers, and compile boost/url/src.hpp in a separate file.
This is intended to allow people to pull the library in "standalone" and
not have to rely on the build machinery in boost-url, which we don't
really need. Interestingly, this file doesn't have a newline at the
end, which clang correctly flags. OpenBMC doesn't really need that
warning, as we rely on clang-format to do that, so we add
-Wno-newline-eof clang to get the code to compile there.
All url parsers are moved to the parse_uri, or parse_relative_uri
equivalents. This slightly tightens the requirements around what URLs
are accepted, but in no ways that should break anything. (Ie,
"/redfish/v1" is no longer accepted for a virtual media endpoint.
boost::urls::url_view::params_type has been renamed to
query_params_type, and the relevant methods have been updated.
Because of the missing standalone mode, we now need to use
boost::string_view which doesn't implicitly construct from
std::string_view. Some discussion on the boost list shows that this is
coming soon, so that cruft can eventually be cleaned up, but for now we
need the construction.
Tested:
Loaded in qemu, and ran some URLs (/redfish/v1 and /redfish/v1/Chassis)
to ensure that the url handler functions as intended.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I5843776d4ec01b4d92af2ee3a9cf1ebb1d920ae7
diff --git a/meson.build b/meson.build
index 2bbc0d9..650a5ec 100644
--- a/meson.build
+++ b/meson.build
@@ -151,6 +151,7 @@
'-Wswitch-enum',
'-Wnull-dereference',
'-Wdouble-promotion',
+ '-Wno-newline-eof',
'-Wformat=2',
]),
language:'cpp')
@@ -363,7 +364,8 @@
srcfiles_bmcweb = [
'src/webserver_main.cpp',
'redfish-core/src/error_messages.cpp',
- 'redfish-core/src/utils/json_utils.cpp'
+ 'redfish-core/src/utils/json_utils.cpp',
+ 'src/boost_url.cpp'
]
srcfiles_unittest = [
@@ -433,7 +435,9 @@
if(get_option('tests').enabled())
foreach src_test : srcfiles_unittest
testname = src_test.split('/')[-1].split('.')[0]
- test(testname,executable(testname,src_test,
+ test(testname,executable(testname,
+ [src_test,
+ 'src/boost_url.cpp'],
include_directories : incdir,
install_dir: bindir,
dependencies: [