Uh oh!
There was an error while loading. Please reload this page.
Add main Connector facade - #93
Conversation
| } | ||
| if (!isset($this->connectors[$scheme])) { | ||
| return Promise\reject(new RuntimeException('No connector registered for unknown URI scheme')); |
There was a problem hiding this comment.
I'd suggest the following exception message:
returnPromise\reject(newRuntimeException(
sprintf(
'No connector registered for URI scheme %s',
$scheme
)
));| $scheme = 'tcp'; | ||
| if (strpos($uri, '://') !== false) { | ||
| $scheme = (string)substr($uri, 0, strpos($uri, '://')); | ||
| } |
There was a problem hiding this comment.
Suggestion: if no scheme is explicitely given and port is 443, use tls connector.
There was a problem hiding this comment.
More magic:
google.comwith'tcp' => false-> Use tlsgoogle.com:443with'tls' => false-> Use tcp
There was a problem hiding this comment.
Both suggestions make sense in higher-level protocols (e.g. HTTP/HTTPS), but I'm hesitant to add them in the low-level network protocols (TCP/IP etc.) here.
I believe this is best left up to consumers of this package (such as react/http-client), but I guess it makes sense to add some kind of support for these kind of things in future versions 👍
clue
commented
Mar 28, 2017
Thanks for the suggestion, updated and squashed to use improved error message |
This PR adds a new
Connectorclass that acts as a facade for all underlying connectors, which are now marked as "advanced usage", but continue to work unchanged.The
Connectorclass now makes it trivially easy to create plaintext TCP/IP, secure TLS and Unix domain socket connection streams like this:Resolves / closes#38