Skip to content

Commit

Permalink
Issue #5304 HTTP2 Host Header
Browse files Browse the repository at this point in the history
refactored common code
fast alphabet lookup
  • Loading branch information
gregw committed Dec 7, 2020
1 parent 397ea6c commit 4ceda7e
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1064,18 +1064,20 @@ else if (_endOfContent == EndOfContent.CHUNKED_CONTENT)
{
if (_fieldCache == null)
{
// TODO should we bypass the builder in this case?
_fieldCache = (getHeaderCacheSize() > 0 && (_version != null && _version == HttpVersion.HTTP_1_1))
? new Index.Builder<HttpField>()
.caseSensitive(false)
.mutable()
.alphabet(Index.VISIBLE_ASCII_ALPHABET)
.maxCapacity(getHeaderCacheSize())
.build()
: NO_CACHE;
}

if (_field == null)
_field = new HttpField(_header, caseInsensitiveHeader(_headerString, _header.asString()), _valueString);
if (!_fieldCache.put(_field))
if (_field.getValue().length() < getHeaderCacheSize() && !_fieldCache.put(_field))
{
_fieldCache.clear();
_fieldCache.put(_field);
Expand Down
Loading

0 comments on commit 4ceda7e

Please sign in to comment.