Skip to content

Commit 08cc3d6

Browse files
authored
Merge pull request #424 from CrowCpp/multiple_small_changes
Multiple small changes
2 parents 4f533c4 + 82e894d commit 08cc3d6

File tree

6 files changed

+34
-9
lines changed

6 files changed

+34
-9
lines changed

Doxyfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2129,7 +2129,10 @@ INCLUDE_FILE_PATTERNS =
21292129
# recursively expanded use the := operator instead of the = operator.
21302130
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
21312131

2132-
PREDEFINED =
2132+
PREDEFINED = CROW_ENABLE_SSL \
2133+
CROW_ENABLE_COMPRESSION \
2134+
CROW_ENABLE_DEBUG \
2135+
CROW_ENABLE_LOGGING
21332136

21342137
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
21352138
# tag can be used to specify a list of macro names that should be expanded. The

examples/example_static_file.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//#define CROW_STATIC_DRIECTORY "alternative_directory/"
1+
//#define CROW_STATIC_DIRECTORY "alternative_directory/"
22
//#define CROW_STATIC_ENDPOINT "/alternative_endpoint/<path>"
33
//#define CROW_DISABLE_STATIC_DIR
44
#include "crow.h"

include/crow/app.h

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace crow
6161
/// Process an Upgrade request
6262

6363
///
64-
/// Currently used to upgrrade an HTTP connection to a WebSocket connection
64+
/// Currently used to upgrade an HTTP connection to a WebSocket connection
6565
template<typename Adaptor>
6666
void handle_upgrade(const request& req, response& res, Adaptor&& adaptor)
6767
{
@@ -342,7 +342,7 @@ namespace crow
342342

343343
#ifdef CROW_ENABLE_SSL
344344

345-
/// use certificate and key files for SSL
345+
/// Use certificate and key files for SSL
346346
self_t& ssl_file(const std::string& crt_filename, const std::string& key_filename)
347347
{
348348
ssl_used_ = true;
@@ -355,7 +355,7 @@ namespace crow
355355
return *this;
356356
}
357357

358-
/// use .pem file for SSL
358+
/// Use .pem file for SSL
359359
self_t& ssl_file(const std::string& pem_filename)
360360
{
361361
ssl_used_ = true;
@@ -367,6 +367,19 @@ namespace crow
367367
return *this;
368368
}
369369

370+
/// Use certificate chain and key files for SSL
371+
self_t& ssl_chainfile(const std::string& crt_filename, const std::string& key_filename)
372+
{
373+
ssl_used_ = true;
374+
ssl_context_.set_verify_mode(boost::asio::ssl::verify_peer);
375+
ssl_context_.set_verify_mode(boost::asio::ssl::verify_client_once);
376+
ssl_context_.use_certificate_chain_file(crt_filename);
377+
ssl_context_.use_private_key_file(key_filename, ssl_context_t::pem);
378+
ssl_context_.set_options(
379+
boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | boost::asio::ssl::context::no_sslv3);
380+
return *this;
381+
}
382+
370383
self_t& ssl(boost::asio::ssl::context&& ctx)
371384
{
372385
ssl_used_ = true;
@@ -390,6 +403,17 @@ namespace crow
390403
return *this;
391404
}
392405

406+
template<typename T, typename... Remain>
407+
self_t& ssl_chainfile(T&&, Remain&&...)
408+
{
409+
// We can't call .ssl() member function unless CROW_ENABLE_SSL is defined.
410+
static_assert(
411+
// make static_assert dependent to T; always false
412+
std::is_base_of<T, void>::value,
413+
"Define CROW_ENABLE_SSL to enable ssl support.");
414+
return *this;
415+
}
416+
393417
template<typename T>
394418
self_t& ssl(T&&)
395419
{

include/crow/multipart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace crow
4242
return empty;
4343
}
4444

45-
/// Same as \ref get_header_value_Object() but for \ref multipart.header
45+
/// Same as \ref get_header_value_object() but for \ref multipart.header
4646
template<typename T>
4747
inline const header& get_header_object(const T& headers, const std::string& key)
4848
{

include/crow/routing.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,6 @@ namespace crow
14681468
allow = allow.substr(0, allow.size() - 2);
14691469
res = response(204);
14701470
res.set_header("Allow", allow);
1471-
res.manual_length_header = true;
14721471
res.end();
14731472
return;
14741473
}
@@ -1486,7 +1485,6 @@ namespace crow
14861485
allow = allow.substr(0, allow.size() - 2);
14871486
res = response(204);
14881487
res.set_header("Allow", allow);
1489-
res.manual_length_header = true;
14901488
res.end();
14911489
return;
14921490
}

include/crow/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@
5959
#if __cplusplus > 201103L
6060
#define CROW_GCC83_WORKAROUND
6161
#else
62-
#error "GCC 8.1 - 8.3 has a bug that prevents crow from compiling with C++11. Please update GCC to > 8.3 or use C++ > 11."
62+
#error "GCC 8.1 - 8.3 has a bug that prevents Crow from compiling with C++11. Please update GCC to > 8.3 or use C++ > 11."
6363
#endif
6464
#endif

0 commit comments

Comments
 (0)