fixed error handling and added support for relative http redirects (which aren't allowed by the standard)

This commit is contained in:
Arvid Norberg
2008-05-18 04:48:06 +00:00
parent 031cfe09da
commit b952d85734
4 changed files with 39 additions and 8 deletions

View File

@@ -97,10 +97,11 @@ void start_web_server(int port, bool ssl)
"server.range-requests = \"enable\"\n"
"server.port = " << port << "\n"
"server.pid-file = \"./lighty" << port << ".pid\"\n"
"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"
"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\""
", \"^/relative/redirect$\" => \"../test_file\""
")\n"
"$HTTP[\"url\"] == \"/test_file.gz\" {\n"
" setenv.add-response-header = ( \"Content-Encoding\" => \"gzip\" )\n"
"# mimetype.assign = ()\n"

View File

@@ -104,6 +104,7 @@ void run_suite(std::string const& protocol, proxy_settings const& ps)
<< " proxy **********************\n" << std::endl;
typedef boost::optional<error_code> err;
run_test(protocol + "://127.0.0.1:8001/relative/redirect", 3216, 200, 2, error_code(), ps);
run_test(protocol + "://127.0.0.1:8001/redirect", 3216, 200, 2, error_code(), ps);
run_test(protocol + "://127.0.0.1:8001/infinite_redirect", 0, 301, 6, error_code(), ps);
run_test(protocol + "://127.0.0.1:8001/test_file", 3216, 200, 1, error_code(), ps);