refactored gzip code and added gzip support to http_connection
This commit is contained in:
@@ -80,7 +80,7 @@ void start_web_server(int port, bool ssl)
|
||||
}
|
||||
|
||||
std::ofstream f("lighty_config");
|
||||
f << "server.modules = (\"mod_access\", \"mod_redirect\")\n"
|
||||
f << "server.modules = (\"mod_access\", \"mod_redirect\", \"mod_setenv\")\n"
|
||||
"server.document-root = \"" << boost::filesystem::initial_path().string() << "\"\n"
|
||||
"server.range-requests = \"enable\"\n"
|
||||
"server.port = " << port << "\n"
|
||||
@@ -88,7 +88,11 @@ void start_web_server(int port, bool ssl)
|
||||
"url.redirect = (\"^/redirect$\" => \""
|
||||
<< (ssl?"https":"http") << "://127.0.0.1:" << port << "/test_file\", "
|
||||
"\"^/infinite_redirect$\" => \""
|
||||
<< (ssl?"https":"http") << "://127.0.0.1:" << port << "/infinite_redirect\")\n";
|
||||
<< (ssl?"https":"http") << "://127.0.0.1:" << port << "/infinite_redirect\")\n"
|
||||
"$HTTP[\"url\"] == \"/test_file.gz\" {\n"
|
||||
" setenv.add-response-header = ( \"Content-Encoding\" => \"gzip\" )\n"
|
||||
" mimetype.assign = ()\n"
|
||||
"}\n";
|
||||
// this requires lighttpd to be built with ssl support.
|
||||
// The port distribution for mac is not built with ssl
|
||||
// support by default.
|
||||
|
@@ -106,6 +106,7 @@ void run_suite(std::string const& protocol, proxy_settings const& ps)
|
||||
run_test(protocol + "://127.0.0.1:8001/redirect", 3216, 200, 2, asio::error_code(), ps);
|
||||
run_test(protocol + "://127.0.0.1:8001/infinite_redirect", 0, 301, 6, asio::error_code(), ps);
|
||||
run_test(protocol + "://127.0.0.1:8001/test_file", 3216, 200, 1, asio::error_code(), ps);
|
||||
run_test(protocol + "://127.0.0.1:8001/test_file.gz", 3216, 200, 1, asio::error_code(), ps);
|
||||
run_test(protocol + "://127.0.0.1:8001/non-existing-file", -1, 404, 1, err(), ps);
|
||||
// if we're going through an http proxy, we won't get the same error as if the hostname
|
||||
// resolution failed
|
||||
@@ -123,7 +124,8 @@ int test_main()
|
||||
std::srand(std::time(0));
|
||||
std::generate(data_buffer, data_buffer + sizeof(data_buffer), &std::rand);
|
||||
std::ofstream("test_file").write(data_buffer, 3216);
|
||||
|
||||
std::system("gzip -9 -c test_file > test_file.gz");
|
||||
|
||||
proxy_settings ps;
|
||||
ps.hostname = "127.0.0.1";
|
||||
ps.port = 8034;
|
||||
|
Reference in New Issue
Block a user