]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix compilation issues with older boost::string_ref and string_view 8954/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 19 Mar 2020 16:35:06 +0000 (17:35 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 19 Mar 2020 16:38:42 +0000 (17:38 +0100)
pdns/dnsdistdist/doh.cc

index 9e83cc4dfc68e803affebd706b6a9d1330ccc9f8..16132d9874a666bdcc1dd3cbcd0bbe3e70ab3a93 100644 (file)
@@ -658,9 +658,11 @@ static void doh_dispatch_query(DOHServerConfig* dsc, h2o_handler_t* self, h2o_re
 static bool getHTTPHeaderValue(const h2o_req_t* req, const std::string& headerName, string_view& value)
 {
   bool found = false;
+  /* early versions of boost::string_ref didn't have the ability to compare to string */
+  string_view headerNameView(headerName);
 
   for (size_t i = 0; i < req->headers.size; ++i) {
-    if (string_view(req->headers.entries[i].name->base, req->headers.entries[i].name->len) == headerName) {
+    if (string_view(req->headers.entries[i].name->base, req->headers.entries[i].name->len) == headerNameView) {
       value = string_view(req->headers.entries[i].value.base, req->headers.entries[i].value.len);
       /* don't stop there, we might have more than one header with the same name, and we want the last one */
       found = true;
@@ -680,7 +682,7 @@ static void processForwardedForHeader(const h2o_req_t* req, ComboAddress& remote
       auto pos = value.rfind(',');
       if (pos != string_view::npos) {
         ++pos;
-        for (; pos < value.size() && value.at(pos) == ' '; ++pos)
+        for (; pos < value.size() && value[pos] == ' '; ++pos)
         {
         }