2
0

Compare commits

..

No commits in common. "a5d3e11c1f7573c6b4cd1f26ded34cfe9036ae5a" and "505bfb053f481b39ffd0f03336e4a8511f45883e" have entirely different histories.

3 changed files with 2 additions and 45 deletions

View File

@ -1,6 +1,5 @@
#include <lighttpd/base.h> #include <lighttpd/base.h>
#include <lighttpd/encoding.h>
#include <lighttpd/plugin_core.h> #include <lighttpd/plugin_core.h>
#include <lighttpd/filter_buffer_on_disk.h> #include <lighttpd/filter_buffer_on_disk.h>
@ -564,7 +563,7 @@ gboolean li_vrequest_redirect_directory(liVRequest *vr) {
} else { } else {
g_string_append_len(uri, GSTR_LEN(vr->coninfo->local_addr_str)); g_string_append_len(uri, GSTR_LEN(vr->coninfo->local_addr_str));
} }
li_string_encode_append(vr->request.uri.path->str, uri, LI_ENCODING_URI); g_string_append_len(uri, GSTR_LEN(vr->request.uri.raw_orig_path));
g_string_append_c(uri, '/'); g_string_append_c(uri, '/');
if (vr->request.uri.query->len) { if (vr->request.uri.query->len) {
g_string_append_c(uri, '?'); g_string_append_c(uri, '?');

View File

@ -226,7 +226,7 @@ var.vhosts = var.vhosts + [ "%s" => {
def PrepareDir(self, dirname): def PrepareDir(self, dirname):
"""remembers which directories have been prepared and while remove them on cleanup; returns absolute pathname""" """remembers which directories have been prepared and while remove them on cleanup; returns absolute pathname"""
self._test_cleanup_dirs.append(dirname) self._test_cleanup_dirs.append(fname)
return self.tests.PrepareDir(dirname) return self.tests.PrepareDir(dirname)
def MissingFeature(self, feature): def MissingFeature(self, feature):

View File

@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
from base import *
from requests import *
class TestDirlist(CurlRequest):
URL = "/foo/"
EXPECT_RESPONSE_CODE = 200
EXPECT_RESPONSE_HEADERS = [("Content-Type", "text/html; charset=utf-8")]
class TestRedirectDir(CurlRequest):
URL = "/foo"
EXPECT_RESPONSE_CODE = 301
EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/foo/")]
class TestRedirectDirWithQuery(CurlRequest):
URL = "/foo?bar=baz"
EXPECT_RESPONSE_CODE = 301
EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/foo/?bar=baz")]
class TestRedirectDirWithQueryAndSpecialChars(CurlRequest):
URL = "/f%3f%20o?bar=baz"
EXPECT_RESPONSE_CODE = 301
EXPECT_RESPONSE_HEADERS = [("Location", "http://dirlist/f%3f%20o/?bar=baz")]
class Test(GroupTest):
group = [
TestDirlist,
TestRedirectDir,
TestRedirectDirWithQuery,
]
config = """
setup { module_load "mod_dirlist"; }
dirlist;
"""
def Prepare(self):
self.PrepareDir("www/vhosts/dirlist/foo")
self.PrepareFile("www/vhosts/dirlist/foo/test.txt", "abc")
self.PrepareDir("www/vhosts/dirlist/f? o")
self.PrepareFile("www/vhosts/dirlist/f? o/test.txt", "abc")