Skip to content

Commit 4ff57b2

Browse files
author
Sebastiano Merlino
committed
Created operator= in webserver
1 parent 2cae58e commit 4ff57b2

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

src/httpserver/webserver.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ class webserver
219219
http_resource* internal_error_resource = 0x0
220220
);
221221
webserver(const create_webserver& params);
222+
webserver& operator=(const webserver& b);
222223
/**
223224
* Destructor of the class
224225
**/

src/webserver.cpp

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ namespace details
5959
struct cache_manager
6060
{
6161
std::map<std::string, details::cache_entry> response_cache;
62+
63+
cache_manager()
64+
{
65+
}
6266
};
6367

6468
struct http_response_ptr
@@ -351,7 +355,8 @@ webserver::webserver
351355
not_found_resource(not_found_resource),
352356
method_not_allowed_resource(method_not_allowed_resource),
353357
method_not_acceptable_resource(method_not_acceptable_resource),
354-
internal_error_resource(internal_error_resource)
358+
internal_error_resource(internal_error_resource),
359+
cache_m(new details::cache_manager())
355360
{
356361
init(single_resource);
357362
}
@@ -391,11 +396,53 @@ webserver::webserver(const create_webserver& params):
391396
not_found_resource(params._not_found_resource),
392397
method_not_allowed_resource(params._method_not_allowed_resource),
393398
method_not_acceptable_resource(params._method_not_acceptable_resource),
394-
internal_error_resource(params._internal_error_resource)
399+
internal_error_resource(params._internal_error_resource),
400+
cache_m(new details::cache_manager())
395401
{
396402
init(params._single_resource);
397403
}
398404

405+
webserver& webserver::operator=(const webserver& b)
406+
{
407+
port = b.port;
408+
start_method = b.start_method;
409+
max_threads = b.max_threads;
410+
max_connections = b.max_connections;
411+
memory_limit = b.memory_limit;
412+
connection_timeout = b.connection_timeout;
413+
per_IP_connection_limit = b.per_IP_connection_limit;
414+
log_delegate = b.log_delegate;
415+
validator = b.validator;
416+
unescaper_pointer = b.unescaper_pointer;
417+
bind_address = b.bind_address;
418+
bind_socket = b.bind_socket;
419+
max_thread_stack_size = b.max_thread_stack_size;
420+
use_ssl = b.use_ssl;
421+
use_ipv6 = b.use_ipv6;
422+
debug = b.debug;
423+
pedantic = b.pedantic;
424+
https_mem_key = b.https_mem_key;
425+
https_mem_cert = b.https_mem_cert;
426+
https_mem_trust = b.https_mem_trust;
427+
https_priorities = b.https_priorities;
428+
cred_type = b.cred_type;
429+
digest_auth_random = b.digest_auth_random;
430+
nonce_nc_size = b.nonce_nc_size;
431+
running = b.running;
432+
default_policy = b.default_policy;
433+
basic_auth_enabled = b.basic_auth_enabled;
434+
digest_auth_enabled = b.digest_auth_enabled;
435+
regex_checking = b.regex_checking;
436+
ban_system_enabled = b.ban_system_enabled;
437+
post_process_enabled = b.post_process_enabled;
438+
not_found_resource = b.not_found_resource;
439+
method_not_allowed_resource = b.method_not_allowed_resource;
440+
method_not_acceptable_resource = b.method_not_acceptable_resource;
441+
internal_error_resource = b.internal_error_resource;
442+
cache_m->response_cache = b.cache_m->response_cache;
443+
return *this;
444+
}
445+
399446
void webserver::init(http_resource* single_resource)
400447
{
401448
if(single_resource != 0x0)
@@ -415,7 +462,6 @@ void webserver::init(http_resource* single_resource)
415462
pthread_mutex_init(&cleanmux, NULL);
416463
pthread_cond_init(&cleancond, NULL);
417464
#endif //USE_COMET
418-
cache_m = new details::cache_manager();
419465
}
420466

421467
webserver::~webserver()

0 commit comments

Comments
 (0)