Skip to content

Commit

Permalink
Issue #5104 - AbstractProxyServlet include incorrect protocol version…
Browse files Browse the repository at this point in the history
… in Via header when accessed over H2.

Fixed HttpFields.computeField() removal loop.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Aug 13, 2020
1 parent 26c2d34 commit 51d0780
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -218,7 +218,7 @@ private <T> void computeField(T header, BiFunction<T, List<HttpField>, HttpField
}
// Remember and remove additional fields
found.add(f);
remove(i);
remove(i--);
}
}

Expand Down
Expand Up @@ -885,11 +885,12 @@ public void testComputeField()
header.add(new HttpField("After", "value"));
assertThat(header.stream().map(HttpField::toString).collect(Collectors.toList()), contains("Before: value", "Test: one", "After: value"));

header.add(new HttpField("Test", "extra"));
assertThat(header.stream().map(HttpField::toString).collect(Collectors.toList()), contains("Before: value", "Test: one", "After: value", "Test: extra"));
header.add(new HttpField("Test", "two"));
header.add(new HttpField("Test", "three"));
assertThat(header.stream().map(HttpField::toString).collect(Collectors.toList()), contains("Before: value", "Test: one", "After: value", "Test: two", "Test: three"));

header.computeField("Test", (n, f) -> new HttpField("TEST", "count=" + f.size()));
assertThat(header.stream().map(HttpField::toString).collect(Collectors.toList()), contains("Before: value", "TEST: count=2", "After: value"));
assertThat(header.stream().map(HttpField::toString).collect(Collectors.toList()), contains("Before: value", "TEST: count=3", "After: value"));

header.computeField("TEST", (n, f) -> null);
assertThat(header.stream().map(HttpField::toString).collect(Collectors.toList()), contains("Before: value", "After: value"));
Expand Down

0 comments on commit 51d0780

Please sign in to comment.