Details
-
Improvement
-
Resolution: Fixed
-
Major
-
1.0
-
None
-
Security Level: Public
-
None
Description
Since we are connecting to a REST endpoint, I think it is most sane to let the user supply a URL when doing a connection to Couchbase:
couchbase_connect($url); and new Couchbase($url);
An $url would be parsed into
http[s]://[user:pass@]hostname[:port][/bucketname]
i.e. $proto = http / $user = null / $pass = null / $host / $port = 8091 / $bucket = default
The only required part is the hostname
$proto is null | (string) http | (string)https
$user is null | (string) username
$pass is null | (string) password
$host is (string) hostname or IP
$port is null | (int) TCP port
$bucket us null | (string) bucket name
if $proto is != null, append ://
if $user is != null, append : and require pass to be != null, append $pass, append @
if $port is != null, prepend :
if $bucket is != null, prepend /
I hope this covers all cases.