Skip to content

Commit c854404

Browse files
author
Sebastiano Merlino
committed
Removed assignment operator from webserver class and made constants its
unchangeable attributes
1 parent 90e7a0d commit c854404

File tree

2 files changed

+27
-68
lines changed

2 files changed

+27
-68
lines changed

src/httpserver/webserver.hpp

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ class webserver
331331
render_ptr internal_error_resource = 0x0
332332
);
333333
webserver(const create_webserver& params);
334-
webserver& operator=(const webserver& b);
335334
/**
336335
* Destructor of the class
337336
**/
@@ -471,38 +470,38 @@ class webserver
471470
**/
472471
void sweet_kill();
473472
private:
474-
int port;
475-
http_utils::start_method_T start_method;
476-
int max_threads;
477-
int max_connections;
478-
int memory_limit;
479-
int connection_timeout;
480-
int per_IP_connection_limit;
473+
const int port;
474+
const http_utils::start_method_T start_method;
475+
const int max_threads;
476+
const int max_connections;
477+
const int memory_limit;
478+
const int connection_timeout;
479+
const int per_IP_connection_limit;
481480
log_access_ptr log_access;
482481
log_error_ptr log_error;
483482
validator_ptr validator;
484483
unescaper_ptr unescaper;
485484
const struct sockaddr* bind_address;
486485
int bind_socket;
487-
int max_thread_stack_size;
488-
bool use_ssl;
489-
bool use_ipv6;
490-
bool debug;
491-
bool pedantic;
492-
std::string https_mem_key;
493-
std::string https_mem_cert;
494-
std::string https_mem_trust;
495-
std::string https_priorities;
496-
http_utils::cred_type_T cred_type;
497-
std::string digest_auth_random;
498-
int nonce_nc_size;
486+
const int max_thread_stack_size;
487+
const bool use_ssl;
488+
const bool use_ipv6;
489+
const bool debug;
490+
const bool pedantic;
491+
const std::string https_mem_key;
492+
const std::string https_mem_cert;
493+
const std::string https_mem_trust;
494+
const std::string https_priorities;
495+
const http_utils::cred_type_T cred_type;
496+
const std::string digest_auth_random;
497+
const int nonce_nc_size;
499498
bool running;
500-
http_utils::policy_T default_policy;
501-
bool basic_auth_enabled;
502-
bool digest_auth_enabled;
503-
bool regex_checking;
504-
bool ban_system_enabled;
505-
bool post_process_enabled;
499+
const http_utils::policy_T default_policy;
500+
const bool basic_auth_enabled;
501+
const bool digest_auth_enabled;
502+
const bool regex_checking;
503+
const bool ban_system_enabled;
504+
const bool post_process_enabled;
506505
bool single_resource;
507506
pthread_mutex_t mutexwait;
508507
pthread_rwlock_t runguard;
@@ -539,6 +538,8 @@ class webserver
539538

540539
std::map<std::string, details::event_tuple> event_suppliers;
541540

541+
webserver& operator=(const webserver& b);
542+
542543
void init(render_ptr single_resource);
543544
static void* select(void* self);
544545
void schedule_fd(int fd, fd_set* schedule_list, int* max);

src/webserver.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -502,48 +502,6 @@ webserver::webserver(const create_webserver& params):
502502
init(params._single_resource);
503503
}
504504

505-
webserver& webserver::operator=(const webserver& b)
506-
{
507-
port = b.port;
508-
start_method = b.start_method;
509-
max_threads = b.max_threads;
510-
max_connections = b.max_connections;
511-
memory_limit = b.memory_limit;
512-
connection_timeout = b.connection_timeout;
513-
per_IP_connection_limit = b.per_IP_connection_limit;
514-
log_access = b.log_access;
515-
log_error = b.log_error;
516-
validator = b.validator;
517-
unescaper = b.unescaper;
518-
bind_address = b.bind_address;
519-
bind_socket = b.bind_socket;
520-
max_thread_stack_size = b.max_thread_stack_size;
521-
use_ssl = b.use_ssl;
522-
use_ipv6 = b.use_ipv6;
523-
debug = b.debug;
524-
pedantic = b.pedantic;
525-
https_mem_key = b.https_mem_key;
526-
https_mem_cert = b.https_mem_cert;
527-
https_mem_trust = b.https_mem_trust;
528-
https_priorities = b.https_priorities;
529-
cred_type = b.cred_type;
530-
digest_auth_random = b.digest_auth_random;
531-
nonce_nc_size = b.nonce_nc_size;
532-
running = b.running;
533-
default_policy = b.default_policy;
534-
basic_auth_enabled = b.basic_auth_enabled;
535-
digest_auth_enabled = b.digest_auth_enabled;
536-
regex_checking = b.regex_checking;
537-
ban_system_enabled = b.ban_system_enabled;
538-
post_process_enabled = b.post_process_enabled;
539-
not_found_resource = b.not_found_resource;
540-
method_not_allowed_resource = b.method_not_allowed_resource;
541-
method_not_acceptable_resource = b.method_not_acceptable_resource;
542-
internal_error_resource = b.internal_error_resource;
543-
next_to_choose = b.next_to_choose;
544-
return *this;
545-
}
546-
547505
void webserver::init(render_ptr single_resource)
548506
{
549507
if(single_resource != 0x0)

0 commit comments

Comments
 (0)