File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed
Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change 1919
2020#include < httpserver.hpp>
2121
22- using namespace httpserver ;
23-
24- class hello_world_resource : public http_resource
25- {
26- public:
27- std::shared_ptr<http_response> render (const http_request&)
28- {
29- return std::shared_ptr<http_response>(
22+ class hello_world_resource : public httpserver ::http_resource {
23+ public:
24+ std::shared_ptr<httpserver::http_response> render (const httpserver::http_request&) {
25+ return std::shared_ptr<httpserver::http_response>(
3026 new string_response (" Hello, World!" ));
3127 }
3228};
3329
34- std::string psk_callback (const std::string& username)
35- {
30+ std::string psk_callback (const std::string& username) {
3631 // Known identity from the database.
3732 auto identity = std::string {" oFWv9Cv3N9tUsm" };
3833
@@ -43,22 +38,21 @@ std::string psk_callback(const std::string& username)
4338 return (username == identity) ? key : std::string {};
4439}
4540
46- int main ()
47- {
41+ int main () {
4842#ifdef HAVE_GNUTLS
49- webserver ws =
50- create_webserver (8080 )
43+ httpserver:: webserver ws =
44+ httpserver:: create_webserver (8080 )
5145 .use_ssl ()
5246 .https_priorities (" NORMAL:+PSK:+ECDHE-PSK:+DHE-PSK" )
53- .cred_type (http::http_utils::PSK)
47+ .cred_type (httpserver:: http::http_utils::PSK)
5448 .psk_cred_handler (psk_callback);
5549
5650 hello_world_resource hwr;
5751 ws.register_resource (" /hello" , &hwr);
5852 ws.start (true );
5953
6054 return 0 ;
61- #else
55+ #else
6256 return -1 ;
63- #endif
57+ #endif
6458}
You can’t perform that action at this time.
0 commit comments