Compare commits
4 Commits
505bfb053f
...
a5d3e11c1f
Author | SHA1 | Date | |
---|---|---|---|
a5d3e11c1f | |||
76fccefc84 | |||
51a7fd577c | |||
92681fcde4 |
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
#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>
|
||||||
|
|
||||||
@ -563,7 +564,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));
|
||||||
}
|
}
|
||||||
g_string_append_len(uri, GSTR_LEN(vr->request.uri.raw_orig_path));
|
li_string_encode_append(vr->request.uri.path->str, uri, LI_ENCODING_URI);
|
||||||
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, '?');
|
||||||
|
@ -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(fname)
|
self._test_cleanup_dirs.append(dirname)
|
||||||
return self.tests.PrepareDir(dirname)
|
return self.tests.PrepareDir(dirname)
|
||||||
|
|
||||||
def MissingFeature(self, feature):
|
def MissingFeature(self, feature):
|
||||||
|
42
tests/t-dirlist.py
Normal file
42
tests/t-dirlist.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# -*- 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")
|
Loading…
Reference in New Issue
Block a user