Comments (29)
@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.
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.
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.
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.
Might be worth a try 👍 Otherwise a pcap (Wireshark etc.) may also help.
from http-client.
I've uploaded it to GitHub gist here: https://gist.github.com/uniquoooo/c6c05261dbd67dd5f7c3ab5563927a14
from http-client.
@uniquoooo cheers, running tests with it ATM
from http-client.
@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.
@WyriHaximus I've captured the request but I'm not sure how to export it, could you help?
from http-client.
@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.
@WyriHaximus I've sent you an email with the file.
from http-client.
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.
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.
v0.4.14
has been tagged fixing this issue, thanks again for reporting 👍
from http-client.
Thanks for your help @WyriHaximus!
from http-client.
@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.
@brad-jones you could echo the result from fread in react/stream and email me the output.
from http-client.
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.
@brad-jones thanks, currently debugging 👍
from http-client.
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.
It's now causing some requests to hang the whole React loop indefinitely. Not sure if it's the hotfix.
from http-client.
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.
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.
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.
@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.
Yeah its been on my todo list. Ill try and get to it today.
from http-client.
Awesome, let me know how it performs for you 👍
from http-client.
@WyriHaximus Seems to work fine. Can do more (and longer) tests when I'm home and will report back.
from http-client.
@Akhawais awesome, glad to hear that, I'll get the PR up tonight.
from http-client.
Related Issues (20)
- Time Out Question HOT 1
- question regarding writing HOT 2
- Hanging connector HOT 1
- Unable to validate "1 " as chunk length header HOT 3
- strtolower() expects parameter 1 to be string, array given HOT 1
- Delay Request Connection HOT 6
- Error on "close" event HOT 8
- How to get the full response body? HOT 1
- [bug]Concurrent with more than 1000 requests. HOT 4
- client pool HOT 1
- Memory leak in SecureConnector HOT 4
- Integrate Server Sent event api (EventSource) or streaming HTTP api HOT 1
- Support detecting response body boundaries HOT 1
- Can this library be used in php-fpm mode? HOT 2
- Trying to POST multipart/form-data HOT 2
- Support for certificate authentication when using HttpClientAdapter HOT 1
- Stop streaming half-way. HOT 1
- Support HTTP upgrades (WebSocket etc.) HOT 1
- is $loop->run(); blocking? HOT 4
- Heads up! Development focus on react/http
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http-client.