summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbwebserver.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-03-25 15:17:12 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-03-26 10:05:05 -0400
commit8136a4d3138ab17188e6eab14c42cf61444f901b (patch)
treea6bceb22084c5711dfd6d8bbfd63bdf00c2d7735 /src/mongo/db/dbwebserver.h
parent3ab3f5e76a46d00a6c2d8a9e3464db83aef8d4ab (diff)
downloadmongo-8136a4d3138ab17188e6eab14c42cf61444f901b.tar.gz
SERVER-17653 Early allocate port for the HTTP interface
Diffstat (limited to 'src/mongo/db/dbwebserver.h')
-rw-r--r--src/mongo/db/dbwebserver.h42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/mongo/db/dbwebserver.h b/src/mongo/db/dbwebserver.h
index 8a47dde547e..b1c8529024a 100644
--- a/src/mongo/db/dbwebserver.h
+++ b/src/mongo/db/dbwebserver.h
@@ -29,15 +29,22 @@
* it in the license file.
*/
+#pragma once
+
+#include <boost/shared_ptr.hpp>
#include <string>
#include <vector>
-#include "mongo/util/admin_access.h"
+#include "mongo/util/net/miniwebserver.h"
#include "mongo/util/net/sock.h"
-#include "mongo/db/operation_context.h"
namespace mongo {
+ class AdminAccess;
+ class DbWebServer;
+ class OperationContext;
+
+
class Prioritizable {
public:
Prioritizable( double p ) : _priority(p) {}
@@ -79,6 +86,7 @@ namespace mongo {
static std::vector<DbWebHandler*> * _handlers;
};
+
class WebStatusPlugin : public Prioritizable {
public:
WebStatusPlugin( const std::string& secionName , double priority , const std::string& subheader = "" );
@@ -96,7 +104,35 @@ namespace mongo {
static std::vector<WebStatusPlugin*> * _plugins;
};
- void webServerThread(const AdminAccess* admins);
+
+ class DbWebServer : public MiniWebServer {
+ public:
+ DbWebServer(const std::string& ip, int port, const AdminAccess* webUsers);
+
+ private:
+ virtual void doRequest(const char *rq,
+ std::string url,
+ std::string& responseMsg,
+ int& responseCode,
+ std::vector<std::string>& headers,
+ const SockAddr &from);
+
+ bool _allowed(OperationContext* txn,
+ const char* rq,
+ std::vector<std::string>& headers,
+ const SockAddr& from);
+
+ void _rejectREST(std::string& responseMsg,
+ int& responseCode,
+ std::vector<std::string>& headers);
+
+
+ // not owned here
+ const AdminAccess* _webUsers;
+ };
+
+ void webServerListenThread(boost::shared_ptr<DbWebServer> dbWebServer);
+
std::string prettyHostName();
};