@@ -200,11 +200,11 @@ using socket_t = int;
200
200
#include < mutex>
201
201
#include < random>
202
202
#include < regex>
203
+ #include < set>
203
204
#include < sstream>
204
205
#include < string>
205
206
#include < sys/stat.h>
206
207
#include < thread>
207
- #include < set>
208
208
209
209
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
210
210
#include < openssl/err.h>
@@ -257,7 +257,7 @@ namespace detail {
257
257
258
258
template <class T , class ... Args>
259
259
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
260
- make_unique (Args &&... args) {
260
+ make_unique (Args &&...args) {
261
261
return std::unique_ptr<T>(new T (std::forward<Args>(args)...));
262
262
}
263
263
@@ -487,7 +487,7 @@ class Stream {
487
487
virtual socket_t socket () const = 0;
488
488
489
489
template <typename ... Args>
490
- ssize_t write_format (const char *fmt, const Args &... args);
490
+ ssize_t write_format (const char *fmt, const Args &...args);
491
491
ssize_t write (const char *ptr);
492
492
ssize_t write (const std::string &s);
493
493
};
@@ -976,7 +976,8 @@ class ClientImpl {
976
976
977
977
void set_connection_timeout (time_t sec, time_t usec = 0 );
978
978
template <class Rep , class Period >
979
- void set_connection_timeout (const std::chrono::duration<Rep, Period> &duration);
979
+ void
980
+ set_connection_timeout (const std::chrono::duration<Rep, Period> &duration);
980
981
981
982
void set_read_timeout (time_t sec, time_t usec = 0 );
982
983
template <class Rep , class Period >
@@ -1286,7 +1287,8 @@ class Client {
1286
1287
1287
1288
void set_connection_timeout (time_t sec, time_t usec = 0 );
1288
1289
template <class Rep , class Period >
1289
- void set_connection_timeout (const std::chrono::duration<Rep, Period> &duration);
1290
+ void
1291
+ set_connection_timeout (const std::chrono::duration<Rep, Period> &duration);
1290
1292
1291
1293
void set_read_timeout (time_t sec, time_t usec = 0 );
1292
1294
template <class Rep , class Period >
@@ -3200,9 +3202,7 @@ inline void parse_query_text(const std::string &s, Params ¶ms) {
3200
3202
std::set<std::string> cache;
3201
3203
split (s.data (), s.data () + s.size (), ' &' , [&](const char *b, const char *e) {
3202
3204
std::string kv (b, e);
3203
- if (cache.find (kv) != cache.end ()) {
3204
- return ;
3205
- }
3205
+ if (cache.find (kv) != cache.end ()) { return ; }
3206
3206
cache.insert (kv);
3207
3207
3208
3208
std::string key;
@@ -3744,9 +3744,9 @@ inline std::pair<std::string, std::string> make_digest_authentication_header(
3744
3744
3745
3745
string response;
3746
3746
{
3747
- auto H = algo == " SHA-256"
3748
- ? detail::SHA_256
3749
- : algo == " SHA-512 " ? detail::SHA_512 : detail::MD5;
3747
+ auto H = algo == " SHA-256" ? detail::SHA_256
3748
+ : algo == " SHA-512 " ? detail::SHA_512
3749
+ : detail::MD5;
3750
3750
3751
3751
auto A1 = username + " :" + auth.at (" realm" ) + " :" + password;
3752
3752
@@ -4058,7 +4058,7 @@ inline ssize_t Stream::write(const std::string &s) {
4058
4058
}
4059
4059
4060
4060
template <typename ... Args>
4061
- inline ssize_t Stream::write_format (const char *fmt, const Args &... args) {
4061
+ inline ssize_t Stream::write_format (const char *fmt, const Args &...args) {
4062
4062
const auto bufsiz = 2048 ;
4063
4063
std::array<char , bufsiz> buf;
4064
4064
@@ -4333,13 +4333,11 @@ inline Server &
4333
4333
Server::set_file_extension_and_mimetype_mapping (const char *ext,
4334
4334
const char *mime) {
4335
4335
file_extension_and_mimetype_map_[ext] = mime;
4336
-
4337
4336
return *this ;
4338
4337
}
4339
4338
4340
4339
inline Server &Server::set_file_request_handler (Handler handler) {
4341
4340
file_request_handler_ = std::move (handler);
4342
-
4343
4341
return *this ;
4344
4342
}
4345
4343
@@ -4373,7 +4371,6 @@ inline Server &Server::set_post_routing_handler(Handler handler) {
4373
4371
4374
4372
inline Server &Server::set_logger (Logger logger) {
4375
4373
logger_ = std::move (logger);
4376
-
4377
4374
return *this ;
4378
4375
}
4379
4376
@@ -4386,79 +4383,68 @@ Server::set_expect_100_continue_handler(Expect100ContinueHandler handler) {
4386
4383
4387
4384
inline Server &Server::set_tcp_nodelay (bool on) {
4388
4385
tcp_nodelay_ = on;
4389
-
4390
4386
return *this ;
4391
4387
}
4392
4388
4393
4389
inline Server &Server::set_socket_options (SocketOptions socket_options) {
4394
4390
socket_options_ = std::move (socket_options);
4395
-
4396
4391
return *this ;
4397
4392
}
4398
4393
4399
4394
inline Server &Server::set_keep_alive_max_count (size_t count) {
4400
4395
keep_alive_max_count_ = count;
4401
-
4402
4396
return *this ;
4403
4397
}
4404
4398
4405
4399
inline Server &Server::set_keep_alive_timeout (time_t sec) {
4406
4400
keep_alive_timeout_sec_ = sec;
4407
-
4408
4401
return *this ;
4409
4402
}
4410
4403
4411
4404
inline Server &Server::set_read_timeout (time_t sec, time_t usec) {
4412
4405
read_timeout_sec_ = sec;
4413
4406
read_timeout_usec_ = usec;
4414
-
4415
4407
return *this ;
4416
4408
}
4417
4409
4418
4410
template <class Rep , class Period >
4419
- inline Server &Server::set_read_timeout (
4420
- const std::chrono::duration<Rep, Period> &duration) {
4421
- detail::duration_to_sec_and_usec (duration, [&](time_t sec, time_t usec) {
4422
- set_read_timeout (sec, usec);
4423
- });
4411
+ inline Server &
4412
+ Server::set_read_timeout (const std::chrono::duration<Rep, Period> &duration) {
4413
+ detail::duration_to_sec_and_usec (
4414
+ duration, [&](time_t sec, time_t usec) { set_read_timeout (sec, usec); });
4424
4415
return *this ;
4425
4416
}
4426
4417
4427
4418
inline Server &Server::set_write_timeout (time_t sec, time_t usec) {
4428
4419
write_timeout_sec_ = sec;
4429
4420
write_timeout_usec_ = usec;
4430
-
4431
4421
return *this ;
4432
4422
}
4433
4423
4434
4424
template <class Rep , class Period >
4435
- inline Server &Server::set_write_timeout (
4436
- const std::chrono::duration<Rep, Period> &duration) {
4437
- detail::duration_to_sec_and_usec (duration, [&](time_t sec, time_t usec) {
4438
- set_write_timeout (sec, usec);
4439
- });
4425
+ inline Server &
4426
+ Server::set_write_timeout (const std::chrono::duration<Rep, Period> &duration) {
4427
+ detail::duration_to_sec_and_usec (
4428
+ duration, [&](time_t sec, time_t usec) { set_write_timeout (sec, usec); });
4440
4429
return *this ;
4441
4430
}
4442
4431
4443
4432
inline Server &Server::set_idle_interval (time_t sec, time_t usec) {
4444
4433
idle_interval_sec_ = sec;
4445
4434
idle_interval_usec_ = usec;
4446
-
4447
4435
return *this ;
4448
4436
}
4449
4437
4450
4438
template <class Rep , class Period >
4451
- inline Server &Server::set_idle_interval (
4452
- const std::chrono::duration<Rep, Period> &duration) {
4453
- detail::duration_to_sec_and_usec (duration, [&](time_t sec, time_t usec) {
4454
- set_idle_interval (sec, usec);
4455
- });
4439
+ inline Server &
4440
+ Server::set_idle_interval (const std::chrono::duration<Rep, Period> &duration) {
4441
+ detail::duration_to_sec_and_usec (
4442
+ duration, [&](time_t sec, time_t usec) { set_idle_interval (sec, usec); });
4456
4443
return *this ;
4457
4444
}
4458
4445
4459
4446
inline Server &Server::set_payload_max_length (size_t length) {
4460
4447
payload_max_length_ = length;
4461
-
4462
4448
return *this ;
4463
4449
}
4464
4450
@@ -6339,7 +6325,7 @@ inline void ClientImpl::set_connection_timeout(time_t sec, time_t usec) {
6339
6325
6340
6326
template <class Rep , class Period >
6341
6327
inline void ClientImpl::set_connection_timeout (
6342
- const std::chrono::duration<Rep, Period> &duration) {
6328
+ const std::chrono::duration<Rep, Period> &duration) {
6343
6329
detail::duration_to_sec_and_usec (duration, [&](time_t sec, time_t usec) {
6344
6330
set_connection_timeout (sec, usec);
6345
6331
});
@@ -6352,10 +6338,9 @@ inline void ClientImpl::set_read_timeout(time_t sec, time_t usec) {
6352
6338
6353
6339
template <class Rep , class Period >
6354
6340
inline void ClientImpl::set_read_timeout (
6355
- const std::chrono::duration<Rep, Period> &duration) {
6356
- detail::duration_to_sec_and_usec (duration, [&](time_t sec, time_t usec) {
6357
- set_read_timeout (sec, usec);
6358
- });
6341
+ const std::chrono::duration<Rep, Period> &duration) {
6342
+ detail::duration_to_sec_and_usec (
6343
+ duration, [&](time_t sec, time_t usec) { set_read_timeout (sec, usec); });
6359
6344
}
6360
6345
6361
6346
inline void ClientImpl::set_write_timeout (time_t sec, time_t usec) {
@@ -6365,10 +6350,9 @@ inline void ClientImpl::set_write_timeout(time_t sec, time_t usec) {
6365
6350
6366
6351
template <class Rep , class Period >
6367
6352
inline void ClientImpl::set_write_timeout (
6368
- const std::chrono::duration<Rep, Period> &duration) {
6369
- detail::duration_to_sec_and_usec (duration, [&](time_t sec, time_t usec) {
6370
- set_write_timeout (sec, usec);
6371
- });
6353
+ const std::chrono::duration<Rep, Period> &duration) {
6354
+ detail::duration_to_sec_and_usec (
6355
+ duration, [&](time_t sec, time_t usec) { set_write_timeout (sec, usec); });
6372
6356
}
6373
6357
6374
6358
inline void ClientImpl::set_basic_auth (const char *username,
@@ -7471,7 +7455,7 @@ inline void Client::set_connection_timeout(time_t sec, time_t usec) {
7471
7455
7472
7456
template <class Rep , class Period >
7473
7457
inline void Client::set_connection_timeout (
7474
- const std::chrono::duration<Rep, Period> &duration) {
7458
+ const std::chrono::duration<Rep, Period> &duration) {
7475
7459
cli_->set_connection_timeout (duration);
7476
7460
}
7477
7461
@@ -7480,8 +7464,8 @@ inline void Client::set_read_timeout(time_t sec, time_t usec) {
7480
7464
}
7481
7465
7482
7466
template <class Rep , class Period >
7483
- inline void Client::set_read_timeout (
7484
- const std::chrono::duration<Rep, Period> &duration) {
7467
+ inline void
7468
+ Client::set_read_timeout ( const std::chrono::duration<Rep, Period> &duration) {
7485
7469
cli_->set_read_timeout (duration);
7486
7470
}
7487
7471
@@ -7490,8 +7474,8 @@ inline void Client::set_write_timeout(time_t sec, time_t usec) {
7490
7474
}
7491
7475
7492
7476
template <class Rep , class Period >
7493
- inline void Client::set_write_timeout (
7494
- const std::chrono::duration<Rep, Period> &duration) {
7477
+ inline void
7478
+ Client::set_write_timeout ( const std::chrono::duration<Rep, Period> &duration) {
7495
7479
cli_->set_write_timeout (duration);
7496
7480
}
7497
7481
0 commit comments