Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Efficiency improvements for #5977 #5998

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ public HttpField getCacheControl()

public void setCacheControl(HttpField cacheControl)
{
_cacheControl = cacheControl;
if (cacheControl == null)
_cacheControl = null;
if (cacheControl.getHeader() != HttpHeader.CACHE_CONTROL)
throw new IllegalArgumentException("!Cache-Control");
_cacheControl = cacheControl instanceof PreEncodedHttpField
? cacheControl
: new PreEncodedHttpField(cacheControl.getHeader(), cacheControl.getValue());
gregw marked this conversation as resolved.
Show resolved Hide resolved
}

public List<String> getGzipEquivalentFileExtensions()
Expand Down Expand Up @@ -828,12 +834,12 @@ protected void putHeaders(HttpServletResponse response, HttpContent content, lon
{
Response r = (Response)response;
r.putHeaders(content, contentLength, _etags);
HttpFields f = r.getHttpFields();
if (_acceptRanges && !response.containsHeader(HttpHeader.ACCEPT_RANGES.asString()))
f.put(ACCEPT_RANGES);
HttpFields fields = r.getHttpFields();
if (_acceptRanges && !fields.contains(HttpHeader.ACCEPT_RANGES))
gregw marked this conversation as resolved.
Show resolved Hide resolved
fields.put(ACCEPT_RANGES);
gregw marked this conversation as resolved.
Show resolved Hide resolved

if (_cacheControl != null && !response.containsHeader(HttpHeader.CACHE_CONTROL.asString()))
f.put(_cacheControl);
if (_cacheControl != null && !fields.contains(HttpHeader.CACHE_CONTROL))
fields.put(_cacheControl);
}
else
{
Expand Down