Commit cd85d7f1 authored by Kenton Varda's avatar Kenton Varda
parent abaadba1
...@@ -310,6 +310,16 @@ struct HttpRequestTestCase { ...@@ -310,6 +310,16 @@ struct HttpRequestTestCase {
InitializeableArray<kj::StringPtr> requestBodyParts; InitializeableArray<kj::StringPtr> requestBodyParts;
Side side = BOTH; Side side = BOTH;
// TODO(cleanup): Delete this constructor if/when we move to C++14.
HttpRequestTestCase(kj::StringPtr raw, HttpMethod method, kj::StringPtr path,
InitializeableArray<HeaderTestCase> requestHeaders,
kj::Maybe<uint64_t> requestBodySize,
InitializeableArray<kj::StringPtr> requestBodyParts,
Side side = BOTH)
: raw(raw), method(method), path(path), requestHeaders(kj::mv(requestHeaders)),
requestBodySize(requestBodySize), requestBodyParts(kj::mv(requestBodyParts)),
side(side) {}
}; };
struct HttpResponseTestCase { struct HttpResponseTestCase {
...@@ -324,6 +334,17 @@ struct HttpResponseTestCase { ...@@ -324,6 +334,17 @@ struct HttpResponseTestCase {
HttpMethod method = HttpMethod::GET; HttpMethod method = HttpMethod::GET;
Side side = BOTH; Side side = BOTH;
// TODO(cleanup): Delete this constructor if/when we move to C++14.
HttpResponseTestCase(kj::StringPtr raw, uint64_t statusCode, kj::StringPtr statusText,
InitializeableArray<HeaderTestCase> responseHeaders,
kj::Maybe<uint64_t> responseBodySize,
InitializeableArray<kj::StringPtr> responseBodyParts,
HttpMethod method = HttpMethod::GET,
Side side = BOTH)
: raw(raw), statusCode(statusCode), statusText(statusText),
responseHeaders(kj::mv(responseHeaders)), responseBodySize(responseBodySize),
responseBodyParts(kj::mv(responseBodyParts)), method(method), side(side) {}
}; };
struct HttpTestCase { struct HttpTestCase {
......
...@@ -1181,13 +1181,12 @@ struct FastCaseCmp; ...@@ -1181,13 +1181,12 @@ struct FastCaseCmp;
template <char first, char... rest> template <char first, char... rest>
struct FastCaseCmp<first, rest...> { struct FastCaseCmp<first, rest...> {
static constexpr bool apply(const char* actual) { static constexpr bool apply(const char* actual) {
if ('a' <= first && first <= 'z') { return
return (*actual | 0x20) == first && FastCaseCmp<rest...>::apply(actual + 1); 'a' <= first && first <= 'z'
} else if ('A' <= first && first <= 'Z') { ? (*actual | 0x20) == first && FastCaseCmp<rest...>::apply(actual + 1)
return (*actual & ~0x20) == first && FastCaseCmp<rest...>::apply(actual + 1); : 'A' <= first && first <= 'Z'
} else { ? (*actual & ~0x20) == first && FastCaseCmp<rest...>::apply(actual + 1)
return *actual == first && FastCaseCmp<rest...>::apply(actual + 1); : *actual == first && FastCaseCmp<rest...>::apply(actual + 1);
}
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment