Skip to content

fix: do not hard-code content-encoding on writes#519

Merged
powersj merged 2 commits intomasterfrom
fix/content-encoding
Mar 27, 2023
Merged

fix: do not hard-code content-encoding on writes#519
powersj merged 2 commits intomasterfrom
fix/content-encoding

Conversation

@powersj
Copy link
Contributor

@powersj powersj commented Mar 17, 2023

Because the content-encoding was always getting set, we were never gzip encoding data. The content-encoding should only be set by the gzip class and only when we gzip data.

fixes: #521

Because the content-encoding was always getting set, we were never gzip
encoding data. The content-encoding should only be set by the gzip class
and only when we gzip data.
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.10 ⚠️

Comparison is base (55b5362) 88.51% compared to head (07d1fc7) 88.41%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #519      +/-   ##
============================================
- Coverage     88.51%   88.41%   -0.10%     
  Complexity      779      779              
============================================
  Files           172      172              
  Lines          7008     7008              
  Branches        380      380              
============================================
- Hits           6203     6196       -7     
- Misses          686      693       +7     
  Partials        119      119              
Impacted Files Coverage Δ
...b/client/internal/AbstractWriteBlockingClient.java 84.00% <ø> (ø)
.../influxdb/client/internal/AbstractWriteClient.java 89.47% <100.00%> (ø)

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@powersj powersj marked this pull request as ready for review March 17, 2023 18:57
@powersj
Copy link
Contributor Author

powersj commented Mar 21, 2023

The AbstractWriteClient and AbstractWriteBlockingClient the Content-Encoding is hard-coded to identity. In GzipInterceptor, we only gzip the content and set the encoding if the Content-Encoding header is null. This means, that we would never gzip data.

We can leave the Content-Encoding as null until the content is actually encoded. Therefore, the change is to have the two write clients set the Content-Encoding to null and let the GzipInterceptor set this if required.

Here is a screenshot of a local capture with gzip enabled. Note Content-Encoding is correctly set:

gzip

Here is a screenshot of a local capture with gzip disabled. Note Content-Encoding is not present since we are not encoding the content:

gzip-disabled

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for the fix @powersj!

@srebhan srebhan assigned powersj and unassigned srebhan Mar 22, 2023
@powersj powersj merged commit a658fca into master Mar 27, 2023
@powersj powersj deleted the fix/content-encoding branch March 27, 2023 19:28
@bednar bednar added this to the 6.8.0 milestone May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gzip: no write data is actually gzipped

4 participants