-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
ChuckerInterceptor fetches the whole body even if the application isn't doing so #263
Comments
Thanks for reporting this issue. How do you use Chucker? As a As to you suggestion on observing only what application does - could you elaborate more on this? |
I'm using it as an application interceptor. I can't use it as a network interceptor due to issue #242.
I'm not really familiar with the internals of OkHttp or Chucker so I don't know if it can be easily done. But it seems that Chucker is already returning a copy of the At the very least, I'd like to have an option to not read the body at all. This would be preferable to having any side effects. P.S. Android Studio's profiler seems to be able to inspect http requests as well. Perhaps there's an API for that? |
I am still not sure that I understood your idea. |
If I understand it correctly it is more or less like the idea I mentioned some time ago about streaming simultaneously to the end user and a file. We would need an implementation of
I disagree, however, about this point. I think if Chucker is applied as an application interceptor it makes sense. But if it is applied as a network interceptor then it should observe all the traffic regardless of the end consumer because they are interested in the network traffic. |
What I'm trying to say is, if there's a 5 MB picture on the server, and an application that uses OkHttp explicitly reads 3 MB of it, and 4 MB is actually transferred between the client and the server (due to the library or OS buffering), the observer should be reporting either 3 MB or 4 MB. What Chucker is doing, it's reading the whole file from the server and reporting 5 MB. |
this seems to work, thanks! one thought, though. it would be nice to be able to see the transferred amount, e.g. these numbers are also often stuck at it would be nice to have the transferred amount in the request list as well. |
There is #209 tracking wrong size of responses. It should be super easy to fix now with streaming approach. Progressive reports should also be doable and not that complex. The problem is showing |
other applications such as browsers are often showing something along also, i'm encountering the following exception only when i'm using Chucker:
this probably shouldn't be happening? |
Could you show |
i probably should put |
What is happening is that the trailer bytes of the compressed stream are missing because you read only part of the stream and we save it as such to a file. So when we try to close the file that is being used to read original bytes it fails because the source is exhausted without expected bytes. I didn't predict such a use case. I need to consider what is the best way to solve it. Could you report it as a separate issue and link to our conversation? |
Simply plugging in
ChuckerInterceptor
causes the whole response body to be read, even if the application isn't reading the whole of it. Not only this is a very unwanted side effect, this can also crash the app. This is an example crash while trying to (not) read a ~50MB file:you can reproduce this by starting a fake web server and looking at how much it sends (and observing the crash):
It is my impression that the interceptor should only observe the doings of the application and should report either what the application reads or what the device receives.
P.S. setting
maxContentLength
inChuckerInterceptor()
seems to have no effectThe text was updated successfully, but these errors were encountered: