summaryrefslogtreecommitdiff
path: root/src/mongo/db/restapi.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2014-06-18 18:15:03 -0400
committerEliot Horowitz <eliot@10gen.com>2014-06-19 01:49:58 -0400
commitb4cafb46595d6e889f8effdca16e98c3f505078e (patch)
treeb3304b672e2d540a72c7ba7424469e9b78bcce74 /src/mongo/db/restapi.cpp
parent7ce2ffdbbaac003fb608e81ae03090adef960237 (diff)
downloadmongo-b4cafb46595d6e889f8effdca16e98c3f505078e.tar.gz
SERVER-13635 SERVER-1153: can choose heap1 at startup, but doesn't remotely work yet
Diffstat (limited to 'src/mongo/db/restapi.cpp')
-rw-r--r--src/mongo/db/restapi.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp
index cc6b7eceed2..c01dfeb90e0 100644
--- a/src/mongo/db/restapi.cpp
+++ b/src/mongo/db/restapi.cpp
@@ -70,6 +70,8 @@ namespace mongo {
string& responseMsg, int& responseCode,
vector<string>& headers, const SockAddr &from ) {
+ DBDirectClient db( txn );
+
string::size_type first = url.find( "/" , 1 );
if ( first == string::npos ) {
responseCode = 400;
@@ -106,11 +108,11 @@ namespace mongo {
if ( method == "GET" ) {
responseCode = 200;
- html = handleRESTQuery( fullns , action , params , responseCode , ss );
+ html = handleRESTQuery( db, fullns, action, params, responseCode, ss );
}
else if ( method == "POST" ) {
responseCode = 201;
- handlePost( fullns , MiniWebServer::body( rq ) , params , responseCode , ss );
+ handlePost( db, fullns, MiniWebServer::body( rq ), params, responseCode, ss );
}
else {
responseCode = 400;
@@ -127,7 +129,8 @@ namespace mongo {
responseMsg = ss.str();
}
- bool handleRESTQuery( const std::string& ns,
+ bool handleRESTQuery( DBDirectClient& db,
+ const std::string& ns,
const std::string& action,
BSONObj & params,
int & responseCode,
@@ -229,7 +232,8 @@ namespace mongo {
}
// TODO Generate id and revision per couch POST spec
- void handlePost( const std::string& ns,
+ void handlePost( DBDirectClient& db,
+ const std::string& ns,
const char *body,
BSONObj& params,
int & responseCode,
@@ -256,8 +260,6 @@ namespace mongo {
return def;
}
- DBDirectClient db;
-
} restHandler;
bool RestAdminAccess::haveAdminUsers(OperationContext* txn) const {