Skip to content

Commit 4813c57

Browse files
authored
Merge pull request zerebubuth#387 from Woazboat/regex-raw-string-literal
Use raw string literal for bearer token regex
2 parents c4887e4 + 3f49b44 commit 4813c57

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/backend.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ bool registry::add(std::unique_ptr<backend> ptr) {
7373

7474
void registry::setup_options(int argc, char *argv[],
7575
po::options_description &desc) {
76-
if (backends.empty() || (!(default_backend))) {
76+
if (backends.empty() || !default_backend) {
7777
throw std::runtime_error("No backends available - this is most likely a "
7878
"compile-time configuration error.");
7979
}

src/mime_types.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type parse_from(const std::string &name) {
4141
} else if (name == "text/plain") {
4242
return mime::type::text_plain;
4343
} else if (name == "text/xml") { // alias according to RFC 7303, section 9.2
44-
return mime::type:: application_xml;
44+
return mime::type::application_xml;
4545
} else if (name == "application/xml") {
4646
return mime::type::application_xml;
4747
#if HAVE_YAJL

src/oauth2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace oauth2 {
3636
[[nodiscard]] std::optional<osm_user_id_t> validate_bearer_token(const request &req, data_selection& selection, bool& allow_api_write)
3737
{
3838

39-
static const std::regex r("Bearer ([A-Za-z0-9~_\\-\\.\\+\\/]+=*)"); // according to RFC 6750, section 2.1
39+
static const std::regex r(R"(Bearer ([A-Za-z0-9~_\-\.\+\/]+=*))"); // according to RFC 6750, section 2.1
4040

4141
const char * auth_hdr = req.get_param ("HTTP_AUTHORIZATION");
4242
if (auth_hdr == nullptr)

0 commit comments

Comments
 (0)