Botan 3.13.0
Crypto and TLS for C&
Botan::HTTP::Case_Insensitive_Less Struct Referencefinal

#include <http_util.h>

Public Types

using is_transparent = void

Public Member Functions

bool operator() (std::string_view a, std::string_view b) const

Detailed Description

Transparent case-insensitive comparator for HTTP field names. RFC 9110 5.1: "field names are case-insensitive".

Definition at line 48 of file http_util.h.

Member Typedef Documentation

◆ is_transparent

Definition at line 49 of file http_util.h.

Member Function Documentation

◆ operator()()

bool Botan::HTTP::Case_Insensitive_Less::operator() ( std::string_view a,
std::string_view b ) const
inline

Definition at line 51 of file http_util.h.

51 {
52 const auto ascii_lower = [](unsigned char c) -> unsigned char {
53 return (c >= 'A' && c <= 'Z') ? static_cast<unsigned char>(c + 32) : c;
54 };
55 return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end(), [&](char x, char y) {
56 return ascii_lower(static_cast<unsigned char>(x)) < ascii_lower(static_cast<unsigned char>(y));
57 });
58 }

The documentation for this struct was generated from the following file: