-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Prevent exception if underlying socket is a unix socket #234
Changes from all commits
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 |
---|---|---|
|
@@ -447,6 +447,18 @@ public function testQueryParmetersWillBeSet() | |
$this->assertEquals('this', $queryParams['test']); | ||
} | ||
|
||
public function testUnixRemoteSocketWithoutPort() | ||
{ | ||
// reactphp/socket Connect->parseAddress returns "tcp://NUL" for UDS | ||
$parser = new RequestHeaderParser(null, 'tcp://' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . ''); | ||
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. Why these empty string concatenations? 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. See https://bugs.php.net/bug.php?id=74556. Thats what PHP returns for stream address of UDS on OSX. 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. @andig Thanks for the update! Have you seen reactphp/socket#100? IMO this should be handled by the Socket component, which is also where this address comes from (afaict). This way, we would likely expect a 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. Why do you want upvotes on an already fixed bug? But it's not what I asked. You write 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.
That was copy/paste from |
||
|
||
$parser->on('error', $this->expectCallableNever()); | ||
|
||
$data = $this->createGetRequest(); | ||
$parser->feed($data); | ||
|
||
} | ||
|
||
private function createGetRequest() | ||
{ | ||
$data = "GET / HTTP/1.1\r\n"; | ||
|
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.
But the
REMOTE_ADDR
should still be set, no? I guess the port could just be set to0
.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.
In case of OSX I get
________
asREMOTE_ADDR
so I've removed both.