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

Use local variable instead of a field for contentCompressionEnabled #71

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer

private FileTransferJob connectJob;

private boolean contentCompressionEnabled;

private HttpRequest httpRequest;

public HttpClientRetrieveFileTransfer(HttpClient client) {
Expand Down Expand Up @@ -547,14 +545,17 @@ protected void openStreams() throws IncomingFileTransferException {
// Set request header for possible gzip encoding, but only if
// 1) The file range specification is null (we want the whole file)
// 2) The target remote file does *not* end in .gz (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280205)
boolean contentCompressionEnabled;
if (getFileRangeSpecification() == null && !targetHasGzSuffix(super.getRemoteFileName())) {
// The interceptors to provide gzip are always added and are enabled by default
Trace.trace(Activator.PLUGIN_ID, "Accept-Encoding: gzip,deflate added to request header"); //$NON-NLS-1$
setContentCompressionEnabled(rcfgBuilder, true);
contentCompressionEnabled = true;
} else {
// Disable the interceptors to provide gzip
Trace.trace(Activator.PLUGIN_ID, "Accept-Encoding NOT added to header"); //$NON-NLS-1$
setContentCompressionEnabled(rcfgBuilder, false);
contentCompressionEnabled = false;
}
httpRequest = rcfgBuilder.build();

Expand Down Expand Up @@ -647,7 +648,6 @@ private void consume(CompletableFuture<HttpResponse<InputStream>> httpResponse)
}

private void setContentCompressionEnabled(Builder builder, boolean value) {
this.contentCompressionEnabled = value;
if (value) {
builder.setHeader(ACCEPT_ENCODING_HEADER, GZIP_ENCODING);
} else {
Expand Down