Issue #5104 - AbstractProxyServlet include incorrect protocol version in Via header when accessed over H2.

Fixed HttpFields.computeField() removal loop.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-08-13 18:23:26 +02:00
parent 26c2d34439
commit 51d0780041
2 changed files with 5 additions and 4 deletions

View File

@ -218,7 +218,7 @@ public class HttpFields implements Iterable<HttpField>
}
// Remember and remove additional fields
found.add(f);
remove(i);
remove(i--);
}
}

View File

@ -885,11 +885,12 @@ public class HttpFieldsTest
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"));