[#583] Fix list-buckets vhs routing
The problem is that with VHS requests, the list-buckets operation does not work because the request is filtered on list-objects-v1. Signed-off-by: Roman Loginov <r.loginov@yadro.com>
This commit is contained in:
parent
8867209e8a
commit
84726f7b7f
1 changed files with 8 additions and 4 deletions
|
@ -138,13 +138,17 @@ func (hf *HandlerFilters) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hf *HandlerFilters) match(r *http.Request) http.Handler {
|
func (hf *HandlerFilters) match(r *http.Request) http.Handler {
|
||||||
|
queries := r.URL.Query()
|
||||||
|
|
||||||
LOOP:
|
LOOP:
|
||||||
for _, filter := range hf.filters {
|
for _, filter := range hf.filters {
|
||||||
if filter.noQueries && len(r.URL.Query()) > 0 {
|
if filter.noQueries && len(queries) > 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(filter.allowedQueries) > 0 {
|
if len(filter.allowedQueries) > 0 {
|
||||||
queries := r.URL.Query()
|
if len(queries) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
for key := range queries {
|
for key := range queries {
|
||||||
if _, ok := filter.allowedQueries[key]; !ok {
|
if _, ok := filter.allowedQueries[key]; !ok {
|
||||||
continue LOOP
|
continue LOOP
|
||||||
|
@ -158,8 +162,8 @@ LOOP:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, query := range filter.queries {
|
for _, query := range filter.queries {
|
||||||
queryVal := r.URL.Query().Get(query.Key)
|
queryVal := queries.Get(query.Key)
|
||||||
if !r.URL.Query().Has(query.Key) || query.Value != "" && query.Value != queryVal {
|
if !queries.Has(query.Key) || query.Value != "" && query.Value != queryVal {
|
||||||
continue LOOP
|
continue LOOP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue