Code Monkey home page Code Monkey logo

Comments (29)

WyriHaximus avatar WyriHaximus commented on May 19, 2024 1

@brad-jones could you verify for me that the hot fix I just created works for you? You can test that by swapping vendor/src/react/http-client/src/ChunkedStreamDecoder.php out with this one ChunkedStreamDecoder.php in the mean time I'll write up tests as well for it and create a PR.

from http-client.

clue avatar clue commented on May 19, 2024

Is this a client side problem?

We'll have to figure this out :-)

Have you checked the server is actually sending a valid chunked encoded stream? Can you post a public URL to test this?

The server might close the connection prematurely which would result in this error. Perhaps we may want to look into providing a non-strict parser (Be strict in what you send, but generous in what you receive).

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

Hey @uniquoooo the Stream ended with incomplete control code exception is thrown when the request ends in an unclean way. Do you have a easy way to reproduce this issue?

from http-client.

davidcole1340 avatar davidcole1340 commented on May 19, 2024

Hi guys,

There isn't a public URL that I can post as it requires authorization, however, I can capture the response. Would it be fine if I capture it with curl -iv --raw?

Thanks

from http-client.

clue avatar clue commented on May 19, 2024

Might be worth a try 👍 Otherwise a pcap (Wireshark etc.) may also help.

from http-client.

davidcole1340 avatar davidcole1340 commented on May 19, 2024

I've uploaded it to GitHub gist here: https://gist.github.com/uniquoooo/c6c05261dbd67dd5f7c3ab5563927a14

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

@uniquoooo cheers, running tests with it ATM

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

@uniquoooo any change you can supply a pcap of the communication between your code and that server for a request that fails? Just put your gist into DecodeChunkedStreamTest as a data set, and it passed decoding the message.

If you don't want to share the pcap publicly (which I would discourage tbh) feel free to send it to the email address on my profile.

from http-client.

davidcole1340 avatar davidcole1340 commented on May 19, 2024

@WyriHaximus I've captured the request but I'm not sure how to export it, could you help?

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

@uniquoooo Wireshark has a Save as option that just saves the entire capure. I can open the pcapng (or just pcap) file on my machine and go through the request.

from http-client.

davidcole1340 avatar davidcole1340 commented on May 19, 2024

@WyriHaximus I've sent you an email with the file.

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

Managed to reproduce the issue with help from @uniquoooo, tracking down the cause of it and will submit a PR with a fix once I've came up with a solution.

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

So the chunked decoding parser is fine, the flaw turns out to be in the moment the headers are parsed and there is a bit of body coming with it from the stream. That bit of body was emitted from the response object while it should have been emitted from the stream. #68 is up to fix that.

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

v0.4.14 has been tagged fixing this issue, thanks again for reporting 👍

from http-client.

davidcole1340 avatar davidcole1340 commented on May 19, 2024

Thanks for your help @WyriHaximus!

from http-client.

brad-jones avatar brad-jones commented on May 19, 2024

@WyriHaximus Not sure if it's related to this issue or not.

In ChunkedTreamDecoder->handleEnd(), the value of $this->buffer looks like this:

string(5) "0

"

If I comment out the check of $this->buffer then my request works fine.

How would you suggest the easiest way to get you a packet dump, considering this is over TLS.
ie: A Normal pcap dump will be encrypted uselessness to you.

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

@brad-jones you could echo the result from fread in react/stream and email me the output.

from http-client.

brad-jones avatar brad-jones commented on May 19, 2024

Here are 3 files, captured each time fread was hit before the Stream ended with incomplete control code exception is thrown.

I have removed / swapped out the sensitive stuff (most of which is just the body of a SOAP request).

react-http-client-issue.1478816829.3675.txt
react-http-client-issue.1478816829.3692.txt
react-http-client-issue.1478816829.3693.txt

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

@brad-jones thanks, currently debugging 👍

from http-client.

Akhawais avatar Akhawais commented on May 19, 2024

Using WyriHaximus/react-guzzle-psr7:

Async works as expected. However synchronous responses almost always fail.

Sending a sync to Stream Labs API (Which uses chunked transfer encoding) fails with Connection closed before receiving response.

@WyriHaximus Your hotfix has successfuly fixed the issue for me. Thanks for all your continued support!

from http-client.

Akhawais avatar Akhawais commented on May 19, 2024

It's now causing some requests to hang the whole React loop indefinitely. Not sure if it's the hotfix.

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

It's now causing some requests to hang the whole React loop indefinitely. Not sure if it's the hotfix.

It isn't, the hotfix applied to a specific situation where there is some data left to process. It should never let the loop run indefinitely on it's own.

from http-client.

Akhawais avatar Akhawais commented on May 19, 2024

Thanks for clearing that up! Posted an issue in your handler repo but pretty sure it belongs here if it uses http-client.

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

No problem, locally trying to figure out what exactly went wrong. In my cause I was hitting the Blizzard API which sometimes causes the error

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

@brad-jones @Akhawais If you have time could you test this hotfix with me? https://gist.github.com/WyriHaximus/b6891672a4aaa78830076004b2c7839a It seems to be running fine on my end right now but would appreciate your help testing it

from http-client.

brad-jones avatar brad-jones commented on May 19, 2024

Yeah its been on my todo list. Ill try and get to it today.

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

Awesome, let me know how it performs for you 👍

from http-client.

Akhawais avatar Akhawais commented on May 19, 2024

@WyriHaximus Seems to work fine. Can do more (and longer) tests when I'm home and will report back.

from http-client.

WyriHaximus avatar WyriHaximus commented on May 19, 2024

@Akhawais awesome, glad to hear that, I'll get the PR up tonight.

from http-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.