Skip to content

Commit

Permalink
Fix #6883 relative welcome redirect
Browse files Browse the repository at this point in the history
Fix the HttpFieldsContainsHeaderValue impl

Signed-off-by: Greg Wilkins <gregw@webtide.com>
  • Loading branch information
gregw committed Sep 22, 2021
1 parent 97c29a7 commit 7075724
Showing 1 changed file with 3 additions and 17 deletions.
Expand Up @@ -18,7 +18,7 @@

package org.eclipse.jetty.http.matchers;

import java.util.Locale;
import java.util.Objects;

import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.http.HttpFields;
Expand Down Expand Up @@ -55,21 +55,7 @@ protected boolean matchesSafely(HttpFields fields)
if (field == null)
return false;

// Use HttpField.contains() logic
if (field.contains(this.value))
return true;

// Simple equals
if (this.value == field.getValue())
return true;

// Try individual value logic
String lcValue = this.value.toLowerCase(Locale.ENGLISH);
for (String value : field.getValues())
{
if (value.toLowerCase(Locale.ENGLISH).contains(lcValue))
return true;
}
return false;
// exact match or HttpField.contains match (which is not just a simple substring).
return Objects.equals(this.value, field.getValue()) || field.contains(this.value);
}
}

0 comments on commit 7075724

Please sign in to comment.