Skip to content

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

Open
@arnavzoman

Description

@arnavzoman

[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:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions