Skip to content

fix: HttpLoggingInterceptor uses response body ByteBuffer copy #5250

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

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

manusa
Copy link
Member

@manusa manusa commented Jun 15, 2023

Description

Some HttpClient implementations (OkHttpClientImpl) are sending downstream the originally received ByteBuffer(s).
This fix forces the interceptor to store a copy of the ByteBuffer so when the body is logged the buffer is not actually consumed

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

Some HttpClient implementations (OkHttpClientImpl) are sending downstream
the originally received ByteBuffer(s).
This fix forces the interceptor to store a copy of the ByteBuffer so
when the body is logged the buffer is not actually consumed

Signed-off-by: Marc Nuri <[email protected]>
@manusa manusa self-assigned this Jun 15, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@manusa manusa merged commit 63bcd03 into fabric8io:master Jun 15, 2023
@manusa manusa deleted the fix/interceptor-bb branch June 15, 2023 10:10
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this pull request Oct 19, 2023
…ptor to not consume response bytes (fabric8io#5251)

Add a unit test in AbstractHttpLoggingInterceptor to verify response
bytes are not consumed after they've been processed by
HttpLoggingInterceptor.

I've verified that test fails when I revert fabric8io#5250
in httpclient-okhttp and httpclient-vertx modules

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this pull request Oct 19, 2023
…ptor to not consume response bytes (fabric8io#5251)

Add a unit test in AbstractHttpLoggingInterceptor to verify response
bytes are not consumed after they've been processed by
HttpLoggingInterceptor.

I've verified that test fails when I revert fabric8io#5250
in httpclient-okhttp and httpclient-vertx modules

Signed-off-by: Rohan Kumar <[email protected]>
manusa pushed a commit that referenced this pull request Nov 9, 2023
…ptor to not consume response bytes (#5251)

Add a unit test in AbstractHttpLoggingInterceptor to verify response
bytes are not consumed after they've been processed by
HttpLoggingInterceptor.

I've verified that test fails when I revert #5250
in httpclient-okhttp and httpclient-vertx modules

Signed-off-by: Rohan Kumar <[email protected]>
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.

3 participants