-
-
Notifications
You must be signed in to change notification settings - Fork 61
Catch Guzzle parser exception #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,7 +132,13 @@ public function handleData($data) | |
| $this->buffer .= $data; | ||
|
|
||
| if (false !== strpos($this->buffer, "\r\n\r\n")) { | ||
| list($response, $bodyChunk) = $this->parseResponse($this->buffer); | ||
| try { | ||
| list($response, $bodyChunk) = $this->parseResponse($this->buffer); | ||
| } catch (\InvalidArgumentException $exception) { | ||
| $this->emit('error', [$exception, $this]); | ||
|
|
||
| return; | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May I ask you to amend your changes to return within this block instead? :)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I just wasn't sure if we need to clear the buffer and remove listeners if we emit an error.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @djagya It looks like your analysis may be right and makes perfect sense here, sorry for the confusion 👍 Can you update this again?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @clue done, sorry for the delay |
||
|
|
||
| $this->buffer = null; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we also unsubscribe from the stream as we do here https://github.com/djagya/http-client/blob/61bf248481da1101d432a57a9c2748a8af7016e0/src/Request.php#L145 since the response parsing has failed and nothing new coming from the stream could change that.
Ping @clue