Http_request streaming callback does not stream chunks anymore

My implementation of the http_request_streaming_callback does not work anymore - i.e. I only get the first chunk of data.

For example this image gets truncated, the response length is 70000 instead of 1115313 (two chunks in memory, one of 70000 + 415313).

The workaround is still valid? or was the candid issue has been solved Fix ty() for reference · Issue #273 · dfinity/candid · GitHub?

I tried with .jpg and .png files. Both does not get the correct content-length headers. I get only the first chunk length as value - i.e content-length: 700000.

As a result, the PNG files are displayed truncated by Chrome. However if I do the same test with a JPG file, the browser does display the all data.

Therefore does it means the http_request_streaming_callback still works out? The issue is related to content-length?

My motoko implementation is based on this workaround which was linked with the usage of the streaming function in agent-js proxy.

 let is_streaming = http_response.streaming_strategy.is_some();
    let response = if let Some(streaming_strategy) = http_response.streaming_strategy {

However above piece of code and function does not exist anymore in main branch of agent-rs.

There is no change on the candid side. The icx-proxy has been moved to GitHub - dfinity/icx-proxy: A rust-based command line tool to serve as a gateway for a Internet Computer replica., not sure if there were some changes there.

Does it work through non-raw? Can you repro locally on dfx using the latest icx-proxy?

FWIW, even after upgrading to 0.9.2, I can still stream using the callback.

Yes I can reproduce the issue locally with the latest dfx.

I extracted the code to a sample repo: GitHub - peterpeterparker/icstreaming: https://forum.dfinity.org/t/http-request-streaming-callback-does-not-stream-chunks-anymore/11298

Also double checked that indeed the upload worked as expected - i.e. that two chunks are available in memory. Issue has definitely todo with streaming.

i meet the same problem,did you sovle it?

Ok, I’ve debugged the issue and it stems from a change to the candid rust library used in icx-proxy. The change fixed some issues but made it difficult to support generic tokens. The workaround introduced only supported a very specific subset, based on the fields of the token. I’ve designed a fix in ic-utils which should resolve this issue.

Thanks Daniel! Looking forward to the fix.

But my code still doesn’t work.
It should show wwccyy
but it just show the ww
so the http_steaming did not work still

Daniel has created a fix that first needs to be reviewed, then merged and finally be rolled out to ultimately solve the issue.

ok,i got it.
very thank u.

Is this be fixed?
i can not achieve the http streaming callback,still.
If you can achieve,can you show me a demo code?

Some more issues were found during testing, but I have another fix which should resolve these further issues.

Ok, I think I’ve finally resolved all the issues. I’m working on merging the fixes in. In the mean time, if you want to test locally, you can replace the icx-proxy that ships with dfx with my custom build here and report any issues you run into.

What is timeline on release? Entrepot has thousands of images not loading correctly due to this chunk streaming issue and I’m wondering if we should try to implement a quick fix ourselves, or if we should just wait for the fix to go live on mainnet. What do you think?

We also have concerns with the launch of Canistore because of this issue

Ping again. Any updates?

I’ll ping folks and ask around