mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Fix unix socket parsing and add test SERVER-1867
This commit is contained in:
parent
b6716766b5
commit
4e1692b74f
@ -75,7 +75,7 @@ namespace mongo {
|
||||
ConnectionString ConnectionString::parse( const string& host , string& errmsg ){
|
||||
|
||||
string::size_type i = host.find( '/' );
|
||||
if ( i != string::npos ){
|
||||
if ( i != string::npos && i != 0){
|
||||
// replica set
|
||||
return ConnectionString( SET , host.substr( i + 1 ) , host.substr( 0 , i ) );
|
||||
}
|
||||
|
15
jstests/unix_socket1.js
Normal file
15
jstests/unix_socket1.js
Normal file
@ -0,0 +1,15 @@
|
||||
if ( ! _isWindows() ) {
|
||||
hoststring = db.getMongo().host
|
||||
index = hoststring.lastIndexOf(':')
|
||||
if (index == -1){
|
||||
port = '27017'
|
||||
} else {
|
||||
port = hoststring.substr(index + 1)
|
||||
}
|
||||
|
||||
sock = new Mongo('/tmp/mongodb-' + port + '.sock')
|
||||
sockdb = sock.getDB(db.getName())
|
||||
assert( sockdb.runCommand('ping').ok )
|
||||
} else {
|
||||
print("Not testing unix sockets on Windows");
|
||||
}
|
Loading…
Reference in New Issue
Block a user