0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

Merge branch 'master' of github.com:mongodb/mongo

This commit is contained in:
Eliot Horowitz 2010-04-19 23:25:21 -04:00
commit 8e6791183f
2 changed files with 25 additions and 18 deletions

View File

@ -319,6 +319,29 @@ namespace mongo {
{
if ( url.size() > 1 ) {
if ( url.find( "/_status" ) == 0 ){
if ( ! allowed( rq , headers, from ) ){
responseCode = 401;
headers.push_back( "Content-Type: text/plain" );
responseMsg = "not allowed\n";
return;
}
headers.push_back( "Content-Type: application/json" );
generateServerStatus( url , responseMsg );
responseCode = 200;
return;
}
if ( ! cmdLine.rest ) {
responseCode = 403;
stringstream ss;
ss << "REST is not enabled. use --rest to turn on.\n";
ss << "check that port " << _port << " is secured for the network too.\n";
responseMsg = ss.str();
headers.push_back( "Content-Type: text/plain" );
return;
}
/* run a command from the web ui */
const char *p = url.c_str();
if( *p == '/' ) {
@ -350,23 +373,6 @@ namespace mongo {
}
}
if ( url.find( "/_status" ) == 0 ){
if ( ! allowed( rq , headers, from ) ){
responseCode = 401;
responseMsg = "not allowed\n";
return;
}
headers.push_back( "Content-Type: application/json" );
generateServerStatus( url , responseMsg );
responseCode = 200;
return;
}
if ( ! cmdLine.rest ){
responseCode = 403;
responseMsg = "rest is not enabled. use --rest to turn on";
return;
}
if ( ! allowed( rq , headers, from ) ){
responseCode = 401;
responseMsg = "not allowed\n";

View File

@ -41,9 +41,10 @@ namespace mongo {
assert(!"You must overwrite one of the accepted methods");
}
const int _port;
private:
string _ip;
int _port;
bool _logConnect;
};