proxygen
UtilInl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
12 #include <folly/Range.h>
13 
14 namespace proxygen {
15 
16 // Case-insensitive string comparison
18  if (s.size() != t.size()) {
19  return false;
20  }
21  return std::equal(
22  s.begin(), s.end(), t.begin(), folly::AsciiCaseInsensitive());
23 }
24 
25 inline bool validateURL(folly::ByteRange url) {
26  for (auto p: url) {
27  if (p <= 0x20 || p == 0x7f) {
28  // no controls or unescaped spaces
29  return false;
30  }
31  }
32  return true;
33 }
34 }
bool caseInsensitiveEqual(folly::StringPiece s, folly::StringPiece t)
Definition: UtilInl.h:17
constexpr size_type size() const
Definition: Range.h:431
bool validateURL(folly::ByteRange url)
Definition: UtilInl.h:25
constexpr Iter end() const
Definition: Range.h:455
constexpr Iter begin() const
Definition: Range.h:452
static set< string > s