0 votes
by (2.0k points)

I'm curious when and why the "Unexpected data appeared after end of response" error occurs.

When downloading files, this error occurs quite occasionally.
However, we have not yet found the cause of it.

It seems to be due to more read requests than the given Content-Length.

It is common to return 0 if there is no data when requesting Read.

How do I handle this exception?

I am using the latest fixed version (5.0.7733.0) that you sent me.

Thank you.

Best regards.

BooKyung Oh.
OpenBoxLab Inc.

Applies to: Rebex HTTPS

1 Answer

0 votes
by (148k points)

This error occurs when the server sends more data that it was expected to. A mismatch between the number of bytes reported in Content-Length and actual number of bytes received is the most common cause.

We choose to fail in this case because silently ignoring the problem could lead to data corruption. Sending more data than announced indicates a serious server-side issue that should not be hidden from the caller.

by (73.5k points)
Happy new year!

I have analyzed the issue and I found this:
- In R5.5 we modified the read behavior as you requested to not fail if you read exact Content-Length.
- However, the modified behavior caused an issue with caching HTTP sessions, which we fixed in R5.7. Unfortunately, our tests did not detect that the previously modified read behavior is not working as requested.

I have fixed the tests. I have also modified the read behavior to work as requested and still cache HTTP sessions if possible.

The change will be in the next public release. Please let me know, if you want to receive beta version to test it yourself.
by (2.0k points)
I want to get a beta version.
thank you.
by (148k points)
I just sent a link to the latest build to your e-mail address. Please give it a try and let us know whether it resolves the issue.
by (2.0k points)
R6.1 RC1 test version works correctly.
Thank you.
by (148k points)
Thanks for testing. R6.1 has been published: https://www.rebex.net/total-pack/history.aspx#R6.1
...