Skip to content

Content-Length omitted by OkHttp so payload size is not reported in Firebase #952

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

Open
arnavzoman opened this issue Oct 31, 2019 · 3 comments
Assignees
Labels

Comments

@arnavzoman
Copy link

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.5.1
  • Firebase Component: Performance
  • Component version: 19.1.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

When using Firebase Performance Monitoring (automatic http metrics) with OkHttp, the response payload size is not reported to Firebase.

The reason is if OkHttp does transparent gzip decompression, the library omits the Content-Length header, and hence Firebase is unable to report it.

I do not know what would be better -

  • Intercept requests at network level rather than application level
  • Check body.length instead of Content-Length

Here is more details about the issue on OkHttp
square/okhttp#259 (comment)

Relevant Code:

@samtstern
Copy link
Contributor

@arnavzoman thanks for filing this! That's a good explanation.

@samtstern samtstern added the type: bug Something isn't working label Oct 31, 2019
@visumickey
Copy link
Contributor

Internally tracked at b/143903937!

@ramanpreetSinghKhinda ramanpreetSinghKhinda added type: feature request New feature or request and removed type: bug Something isn't working labels Nov 5, 2019
@ramanpreetSinghKhinda
Copy link
Contributor

ramanpreetSinghKhinda commented Nov 5, 2019

This qualifies as a Feature Request to provide responsePayloadBytes (the original unzipped response's content-length) information when OkHttp performs transparent gzip, in which case they strip the content-length information.

I have replied on square/okhttp#259 (comment) to check and clarify some questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants