You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2019/06/22 08:28:17 UTC

[thrift] branch master updated: THRIFT-4893 Enable automatic content encoding handling for gzip, deflate in the HTTP client Client: netstd Patch: Jens Geyer

This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 1e808af  THRIFT-4893 Enable automatic content encoding handling for gzip,deflate in the HTTP client Client: netstd Patch: Jens Geyer
1e808af is described below

commit 1e808af7b319802527517a7161d4e3edbde6f5b3
Author: Jens Geyer <je...@apache.org>
AuthorDate: Sat Jun 22 00:24:07 2019 +0200

    THRIFT-4893 Enable automatic content encoding handling for gzip,deflate in the HTTP client
    Client: netstd
    Patch: Jens Geyer
    
    This closes #1818
---
 lib/netstd/Thrift/Transport/Client/THttpTransport.cs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/netstd/Thrift/Transport/Client/THttpTransport.cs b/lib/netstd/Thrift/Transport/Client/THttpTransport.cs
index 982e91e..21cc409 100644
--- a/lib/netstd/Thrift/Transport/Client/THttpTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/THttpTransport.cs
@@ -139,6 +139,7 @@ namespace Thrift.Transport.Client
         {
             var handler = new HttpClientHandler();
             handler.ClientCertificates.AddRange(_certificates);
+            handler.AutomaticDecompression = System.Net.DecompressionMethods.Deflate | System.Net.DecompressionMethods.GZip;
 
             var httpClient = new HttpClient(handler);
 
@@ -149,7 +150,10 @@ namespace Thrift.Transport.Client
 
             httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-thrift"));
             httpClient.DefaultRequestHeaders.UserAgent.TryParseAdd(UserAgent);
-            
+
+            httpClient.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("deflate"));
+            httpClient.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
+
             if (customRequestHeaders != null)
             {
                 foreach (var item in customRequestHeaders)