You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bug that let responsePayloadBytes get set to -1 (#6721)
Fix a bug in `InstrHttpInputStream` that let
`NetworkRequestMetric.responsePayloadBytes` get set to -1 in some
conditions.
While investigating [b/398063523](http://b/398063523), I found that
`inputStream.read(...)` can return 0 in some cases, for example, when
the byte buffer length is 0. When this happens, it was possible to set
`responsePayloadBytes` to -1 because `-1 + 0 = -1`. I didn't just have
`bytesRead` initialize to 0 because there is a difference between 0
bytes read, and no read happened. Tested manually by hacking a test app
to force this to happen, and by unit tests.
0 commit comments