Fix silent fails due to chunked transfer encoding problems.#17
Fix silent fails due to chunked transfer encoding problems.#17fago wants to merge 1 commit intorelaxedws:masterfrom
Conversation
|
Note that without the bugfix the json_decode failed silently and replicatoin did not replicate any content without error. Thus, error handling should be improved here also, but that's another issue. |
|
@fago Maybe this depends by the server and it's configuration, I wonder if for your case you get that \r\n already chopped and it's still necessary for other types of servers/configurations. Could you check if you have the \r\n and you don't get the body content already without that? If json_decode fails without this fix maybe the substr cuts from the end of the body where there is not any \r\n and makes the json invalid? |
|
Yes, the \r\n was already chopped of previously. After a while, we ran into this again. json_decoding failed again, now the \r\n was not chopped in chunks. The only symptom are errors like the following:
I worked over the problematic code passage a bit to make it work by simply trimming any trailing whitespaces if any for each chunk. Will update the PR in a moment. |
|
I opened a new PR to keep the history of this one. -> #20 |
After some debugging I figured that transfer-encoding chunked connections broke replication.
This happened with a web-server being traefik -> varnish -> nginx, but given #4 is already open it's probably not specific to the web-server's used. It works locally with a plain Apache without this fix though.
Anyway, #4 did not resolve the issue for me, but this PR does. I don't know why it should be necessary to chop off \r\n - it seems it's not.