@@ -202,9 +202,6 @@ int main() {
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\x2b\x50\xa8\x56\x48\xcb\xcf\x2b\xd1\x2d\xce\xac\x4a\xb5\x52\x30\x34\x32\x4e\xcd\xb5\x56\xa8\xe5\x02\x00\x0c\x97\x72\x35\x18\x00\x00\x00"s;
etest::test("stylesheet link, gzip Content-Encoding", [gzipped_css] {
protocol::Headers css_response_headers;
css_response_headers.add({"Content-Encoding", "gzip"});
std::map<std::string, Response> responses;
responses["hax://example.com"s] = Response{
.err = Error::Ok,
@@ -214,7 +211,7 @@ int main() {
responses["hax://example.com/lol.css"s] = Response{
.err = Error::Ok,
.status_line = {.status_code = 200},
.headers{std::move(css_response_headers)},
.headers{{"Content-Encoding", "gzip"}},
.body{gzipped_css},
};
engine::Engine e{std::make_unique<FakeProtocolHandler>(responses)};
@@ -227,12 +224,10 @@ int main() {
!= end(e.stylesheet()));
// And again, but with x-gzip instead.
css_response_headers = {};
css_response_headers.add({"Content-Encoding", "x-gzip"});
responses["hax://example.com/lol.css"s] = Response{
.err = Error::Ok,
.status_line = {.status_code = 200},
.headers{std::move(css_response_headers)},
.headers{{"Content-Encoding", "x-gzip"}},
.body{std::move(gzipped_css)},
};
e = engine::Engine{std::make_unique<FakeProtocolHandler>(responses)};
@@ -246,9 +241,6 @@ int main() {
});
etest::test("stylesheet link, gzip Content-Encoding, bad header", [gzipped_css]() mutable {
protocol::Headers css_response_headers;
css_response_headers.add({"Content-Encoding", "gzip"});
std::map<std::string, Response> responses;
responses["hax://example.com"s] = Response{
.err = Error::Ok,
@@ -260,7 +252,7 @@ int main() {
responses["hax://example.com/lol.css"s] = Response{
.err = Error::Ok,
.status_line = {.status_code = 200},
.headers{std::move(css_response_headers)},
.headers{{"Content-Encoding", "gzip"}},
.body{std::move(gzipped_css)},
};
engine::Engine e{std::make_unique<FakeProtocolHandler>(std::move(responses))};
@@ -274,9 +266,6 @@ int main() {
});
etest::test("stylesheet link, gzip Content-Encoding, crc32 mismatch", [gzipped_css]() mutable {
protocol::Headers css_response_headers;
css_response_headers.add({"Content-Encoding", "gzip"});
std::map<std::string, Response> responses;
responses["hax://example.com"s] = Response{
.err = Error::Ok,
@@ -288,7 +277,7 @@ int main() {
responses["hax://example.com/lol.css"s] = Response{
.err = Error::Ok,
.status_line = {.status_code = 200},
.headers{std::move(css_response_headers)},
.headers{{"Content-Encoding", "gzip"}},
.body{std::move(gzipped_css)},
};
engine::Engine e{std::make_unique<FakeProtocolHandler>(std::move(responses))};