Skip to content

Commit

Permalink
Added HttpContentDecompressor to HttpBlobStore download pipeline and …
Browse files Browse the repository at this point in the history
…`Accept-Encoding: gzip` header. bazelbuild#4575
  • Loading branch information
excitoon committed Aug 20, 2019
1 parent ea6d12f commit e57d355
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.channel.unix.DomainSocketAddress;
import io.netty.handler.codec.http.HttpClientCodec;
import io.netty.handler.codec.http.HttpContentDecompressor;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpRequestEncoder;
Expand Down Expand Up @@ -367,6 +368,7 @@ private Future<Channel> acquireDownloadChannel() {
"timeout-handler",
new IdleTimeoutHandler(timeoutSeconds, ReadTimeoutException.INSTANCE));
p.addLast(new HttpClientCodec());
p.addLast("inflater", new HttpContentDecompressor());
synchronized (credentialsLock) {
p.addLast(new HttpDownloadHandler(creds, extraHttpHeaders));
}
Expand Down Expand Up @@ -397,6 +399,7 @@ private void releaseDownloadChannel(Channel ch) {
try {
ch.pipeline().remove(IdleTimeoutHandler.class);
ch.pipeline().remove(HttpClientCodec.class);
ch.pipeline().remove(HttpContentDecompressor.class);
ch.pipeline().remove(HttpDownloadHandler.class);
} catch (NoSuchElementException e) {
// If the channel is in the process of closing but not yet closed, some handlers could have
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ private HttpRequest buildRequest(String path, String host) {
httpRequest.headers().set(HttpHeaderNames.HOST, host);
httpRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
httpRequest.headers().set(HttpHeaderNames.ACCEPT, "*/*");
httpRequest.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP);
return httpRequest;
}

Expand Down

0 comments on commit e57d355

Please sign in to comment.