Skip to content

Commit

Permalink
Issue #5304 HTTP2 HostHeader
Browse files Browse the repository at this point in the history
 + refixed bug in HttpFields

Signed-off-by: Greg Wilkins <gregw@webtide.com>
  • Loading branch information
gregw committed Sep 22, 2020
1 parent 2b25630 commit 7898871
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,9 @@ public Mutable add(HttpFields fields)
if (fields.size() == 0)
return this;

if (_size + fields.size() >= _fields.length)
if (_fields == null)
_fields = new HttpField[fields.size() + 4];
else if (_size + fields.size() >= _fields.length)
_fields = Arrays.copyOf(_fields, _size + fields.size() + 4);

if (fields instanceof Immutable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,9 @@ public void testAddHttpFields()
{
HttpFields.Mutable fields = HttpFields.build();
fields.add("One", "1");

fields = new HttpFields.Mutable(fields);

fields.add(HttpFields.build().add("two", "2").add("three", "3"));
fields.add(HttpFields.build().add("four", "4").add("five", "5").asImmutable());

Expand Down

0 comments on commit 7898871

Please sign in to comment.