[#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. Since list-buckets can also have query parameters, in the end it is necessary to distinguish list-buckets from list-objects-v1 only by the presence of the bucket name in the URL (provided that the request is in VHS style). Signed-off-by: Roman Loginov <r.loginov@yadro.com>
This commit is contained in:
parent
f2274b2786
commit
09412d8f20
4 changed files with 126 additions and 35 deletions
|
@ -138,13 +138,14 @@ func (hf *HandlerFilters) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func (hf *HandlerFilters) match(r *http.Request) http.Handler {
|
||||
queries := r.URL.Query()
|
||||
|
||||
LOOP:
|
||||
for _, filter := range hf.filters {
|
||||
if filter.noQueries && len(r.URL.Query()) > 0 {
|
||||
if filter.noQueries && len(queries) > 0 {
|
||||
continue
|
||||
}
|
||||
if len(filter.allowedQueries) > 0 {
|
||||
queries := r.URL.Query()
|
||||
for key := range queries {
|
||||
if _, ok := filter.allowedQueries[key]; !ok {
|
||||
continue LOOP
|
||||
|
@ -158,8 +159,8 @@ LOOP:
|
|||
}
|
||||
}
|
||||
for _, query := range filter.queries {
|
||||
queryVal := r.URL.Query().Get(query.Key)
|
||||
if !r.URL.Query().Has(query.Key) || query.Value != "" && query.Value != queryVal {
|
||||
queryVal := queries.Get(query.Key)
|
||||
if !queries.Has(query.Key) || query.Value != "" && query.Value != queryVal {
|
||||
continue LOOP
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue