mirror of https://gitee.com/bigwinds/arangodb
issue #374
This commit is contained in:
parent
085c03609f
commit
57403527a9
|
@ -1,6 +1,9 @@
|
||||||
v1.2.alpha (XXXX-XX-XX)
|
v1.2.alpha (XXXX-XX-XX)
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
* issue #374: prevent endless redirects when calling admin interface with
|
||||||
|
unexpected URLs
|
||||||
|
|
||||||
* issue #373: TRAVERSE() `trackPaths` option does not work. Instead `paths` does work
|
* issue #373: TRAVERSE() `trackPaths` option does not work. Instead `paths` does work
|
||||||
|
|
||||||
* issue #358: added support for CORS
|
* issue #358: added support for CORS
|
||||||
|
|
|
@ -7,11 +7,17 @@ describe ArangoDB do
|
||||||
|
|
||||||
context "dealing with the admin interface:" do
|
context "dealing with the admin interface:" do
|
||||||
|
|
||||||
|
before do
|
||||||
|
# load the most current routing information
|
||||||
|
cmd = "/_admin/routing/reload"
|
||||||
|
doc = ArangoDB.log_get("admin-interface-get", cmd)
|
||||||
|
end
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
## check whether admin interface is accessible
|
## check whether admin interface is accessible
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
it "checks whether the admin interface is available at /_admin/html" do
|
it "checks whether the admin interface is available at /_admin/html/index.html" do
|
||||||
cmd = "/_admin/html/index.html"
|
cmd = "/_admin/html/index.html"
|
||||||
doc = ArangoDB.log_get("admin-interface-get", cmd, :format => :plain)
|
doc = ArangoDB.log_get("admin-interface-get", cmd, :format => :plain)
|
||||||
|
|
||||||
|
@ -19,7 +25,39 @@ describe ArangoDB do
|
||||||
doc.code.should eq(200)
|
doc.code.should eq(200)
|
||||||
# check whether HTML result contains expected title
|
# check whether HTML result contains expected title
|
||||||
doc.response.body.should include("ArangoDB - WebAdmin")
|
doc.response.body.should include("ArangoDB - WebAdmin")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "checks whether the admin interface is available at /_admin/html" do
|
||||||
|
cmd = "/_admin/html"
|
||||||
|
begin
|
||||||
|
doc = ArangoDB.log_get("admin-interface-get", cmd, :format => :plain, :no_follow => true)
|
||||||
|
rescue HTTParty::RedirectionTooDeep => e
|
||||||
|
# check response code
|
||||||
|
e.response.code.should eq("301")
|
||||||
|
e.response.header['location'].should eq("/_admin/html/index.html")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "checks whether the admin interface is available at /_admin/html/" do
|
||||||
|
cmd = "/_admin/html/"
|
||||||
|
begin
|
||||||
|
doc = ArangoDB.log_get("admin-interface-get", cmd, :format => :plain, :no_follow => true)
|
||||||
|
rescue HTTParty::RedirectionTooDeep => e
|
||||||
|
# check response code
|
||||||
|
e.response.code.should eq("301")
|
||||||
|
e.response.header['location'].should eq("/_admin/html/index.html")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "checks whether the admin interface is available at /" do
|
||||||
|
cmd = "/"
|
||||||
|
begin
|
||||||
|
doc = ArangoDB.log_get("admin-interface-get", cmd, :format => :plain, :no_follow => true)
|
||||||
|
rescue HTTParty::RedirectionTooDeep => e
|
||||||
|
# check response code
|
||||||
|
e.response.code.should eq("301")
|
||||||
|
e.response.header['location'].should eq("/_admin/html/index.html")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,10 +71,11 @@ namespace triagens {
|
||||||
|
|
||||||
if (names.empty() && ! defaultFile.empty()) {
|
if (names.empty() && ! defaultFile.empty()) {
|
||||||
string url = _request->requestPath();
|
string url = _request->requestPath();
|
||||||
|
|
||||||
if (! url.empty() && url[url.size() - 1] != '/') {
|
if (! url.empty() && url[url.size() - 1] != '/') {
|
||||||
url += "/" + defaultFile;
|
url += '/';
|
||||||
}
|
}
|
||||||
|
url += defaultFile;
|
||||||
|
|
||||||
_response = createResponse(HttpResponse::MOVED_PERMANENTLY);
|
_response = createResponse(HttpResponse::MOVED_PERMANENTLY);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue