Skip to content

Conversation

@andig
Copy link
Contributor

@andigandig commented Oct 4, 2017

Partial UDS support for #231

if (isset($remoteAddress['port'])){
$serverParams['REMOTE_ADDR'] = $remoteAddress['host'];
$serverParams['REMOTE_PORT'] = $remoteAddress['port'];
}

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 to 0.

Copy link
ContributorAuthor

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 ________ as REMOTE_ADDR so I've removed both.

Copy link
Member

@clueclue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for filing this PR! I would like to look into this in more detail, can you add a test case that triggers this behavior and the expected output? 👍

publicfunctiontestUnixRemoteSocketWithoutPort()
{
// reactphp/socket Connect->parseAddress returns "tcp://NUL" for UDS
$parser = newRequestHeaderParser(null, 'tcp://' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these empty string concatenations?

Copy link
ContributorAuthor

@andigandigOct 7, 2017

Choose a reason for hiding this comment

The 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. I would appreciated upvotes on the bug.

Copy link
Member

Choose a reason for hiding this comment

The 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 null address here. Does this make sense to you?

Choose a reason for hiding this comment

The 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 "\0" . '' . "\0" there instead of simply "\0\0", why that?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You write "\0" . '' . "\0" there instead of simply "\0\0", why that?

That was copy/paste from var_export, will fix.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@andig@clue@kelunik