comparison Core/HttpServer/MongooseServer.h @ 23:62bd05fe4b7c

support for ssl
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 Aug 2012 10:18:34 +0200
parents 3959d33612cc
children 166664f0f860
comparison
equal deleted inserted replaced
22:1bc6327d1de3 23:62bd05fe4b7c
21 #pragma once 21 #pragma once
22 22
23 #include "HttpHandler.h" 23 #include "HttpHandler.h"
24 24
25 #include <list> 25 #include <list>
26 #include <map>
26 #include <stdint.h> 27 #include <stdint.h>
27 #include <boost/shared_ptr.hpp> 28 #include <boost/shared_ptr.hpp>
28 29
29 namespace Palantir 30 namespace Palantir
30 { 31 {
38 boost::shared_ptr<PImpl> pimpl_; 39 boost::shared_ptr<PImpl> pimpl_;
39 40
40 typedef std::list<HttpHandler*> Handlers; 41 typedef std::list<HttpHandler*> Handlers;
41 Handlers handlers_; 42 Handlers handlers_;
42 43
44 typedef std::map<std::string, std::string> RegisteredUsers;
45 RegisteredUsers registeredUsers_;
46
47 bool ssl_;
48 std::string certificate_;
43 uint16_t port_; 49 uint16_t port_;
44 50
45 bool IsRunning() const; 51 bool IsRunning() const;
46 52
47 public: 53 public:
58 64
59 void Start(); 65 void Start();
60 66
61 void Stop(); 67 void Stop();
62 68
69 void RegisterUser(const char* username,
70 const char* password);
71
63 void RegisterHandler(HttpHandler* handler); // This takes the ownership 72 void RegisterHandler(HttpHandler* handler); // This takes the ownership
73
74 bool IsSslEnabled() const
75 {
76 return ssl_;
77 }
78
79 void SetSslEnabled(bool enabled);
80
81 const std::string& GetSslCertificate() const
82 {
83 return certificate_;
84 }
85
86 void SetSslCertificate(const char* path);
64 87
65 void ClearHandlers(); 88 void ClearHandlers();
66 89
67 // Can return NULL if no handler is associated to this URI 90 // Can return NULL if no handler is associated to this URI
68 HttpHandler* FindHandler(const UriComponents& forUri) const; 91 HttpHandler* FindHandler(const UriComponents& forUri) const;