Skip to content

Add support for stream context options with connectors #17

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

Closed
wants to merge 2 commits into from

Conversation

DaveRandom
Copy link
Contributor

Fixes #4

@cboden cboden added this to the v0.4.1 milestone Sep 10, 2014
@DaveRandom
Copy link
Contributor Author

Now also attempts to normalize the environment for SSL connections as far as possible.

$contextOpts['ssl'][$this->peerNameCtxKey] = $host;
}

// Disable TLS compression by default

Choose a reason for hiding this comment

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

This is done automatically in 5.6, but you may not care since you still need to do it pre 5.6.

@cboden
Copy link
Contributor

cboden commented Sep 10, 2014

@rdlowrey The intention is to normalize the behaviour between each of the PHP versions to match the changes you made in 5.6.

@DaveRandom Can you trigger another TravisCI build? The re-run button doesn't seem to be an option on PRs.

@DaveRandom
Copy link
Contributor Author

To summarise what has been discussed in IRC:

  • Currently this PR incorporates an alternate implementation of [WIP][RFC] Concept for connection timeout #10, which should probably be separated out into another PR.
  • A connect timeout implementation is required in order for this PR to pass Travis builds - probably because the configuration has changed on the Travis boxes so that attempts to connect to unbound sockets on 127.0.0.1 are now silently discarded instead of actively refused.
  • The connect timeout implementation uses a "fake" context option to allow for user-defined timeouts. This means that the two implementations are currently dependent on each other.
  • The key for the "fake" context option has been arbitrarily chosen as react_socket_client, this needs to be discussed and agreed upon. Whatever is chosen, it should contain a character that is not valid in a URI scheme - underscore _ is a good candidate but requires at least two words or a prefix/suffix.

@cboden cboden modified the milestones: v0.4.3, v0.4.2 Oct 16, 2014
@egeloen
Copy link

egeloen commented Nov 19, 2014

What is the state of this PR? I would like to be able to control the socket timeout throught react/http-client :)

@arunpoudel
Copy link

+1

Also, isn't it past due date?

@@ -4,5 +4,5 @@

interface ConnectorInterface
{
public function create($host, $port);
public function create($host, $port, array $contextOpts = []);
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the feature, but I'm not sure I like the API.

Let me quote from related ticket #10:

IMO we should first figure out some use cases for this feature to see how this is actually going to be used.

The socket-client component is quite lowlevel, so it's unlikely to be used by many users directly. It's probably more likely going to be used as part of some high level abstractions (say, a Redis or MySQL client implementation). These high level components depend on a ConnectorInterface and will likely use DI to inject this. They probably care little about how the connector works. Neither should they care about any "additional" parameters. They do care about the target (hostname and port).

Hence (IMHO) they should not have to take care of context options or connection timeouts.

See also the changes in the SecureConnector, most implementations of the ConnectorInterface will likely not care about the concept of "context options" and merely pass these through to their underlying Connector.

As an alternative, I would suggest passing context options to the constructor of the Connector.

@WyriHaximus
Copy link
Contributor

Any news on this? Just got an issue on one of my packages regarding this PR: WyriHaximus/react-guzzle-psr7#4

@clue
Copy link
Contributor

clue commented Sep 23, 2015

We're looking into pushing an intermediary release and will hence postpone all tickets related to context options to the next release.

See also #45 for an alternative implementation approach.

@clue clue added this to the v0.4.5 milestone Sep 23, 2015
@clue clue removed this from the v0.4.4 milestone Sep 23, 2015
@clue clue removed this from the v0.4.5 milestone Nov 21, 2015
@cboden cboden closed this in #52 Mar 8, 2016
Sign up for free to 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.

Allow context options when creating a socket
7 participants