Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,10 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = CROW_ENABLE_SSL \
CROW_ENABLE_COMPRESSION \
CROW_ENABLE_DEBUG \
CROW_ENABLE_LOGGING

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
2 changes: 1 addition & 1 deletion examples/example_static_file.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#define CROW_STATIC_DRIECTORY "alternative_directory/"
//#define CROW_STATIC_DIRECTORY "alternative_directory/"
//#define CROW_STATIC_ENDPOINT "/alternative_endpoint/<path>"
//#define CROW_DISABLE_STATIC_DIR
#include "crow.h"
Expand Down
30 changes: 27 additions & 3 deletions include/crow/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace crow
/// Process an Upgrade request

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

#ifdef CROW_ENABLE_SSL

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

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

/// Use certificate chain and key files for SSL
self_t& ssl_chainfile(const std::string& crt_filename, const std::string& key_filename)
{
ssl_used_ = true;
ssl_context_.set_verify_mode(boost::asio::ssl::verify_peer);
ssl_context_.set_verify_mode(boost::asio::ssl::verify_client_once);
ssl_context_.use_certificate_chain_file(crt_filename);
ssl_context_.use_private_key_file(key_filename, ssl_context_t::pem);
ssl_context_.set_options(
boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | boost::asio::ssl::context::no_sslv3);
return *this;
}

self_t& ssl(boost::asio::ssl::context&& ctx)
{
ssl_used_ = true;
Expand All @@ -390,6 +403,17 @@ namespace crow
return *this;
}

template<typename T, typename... Remain>
self_t& ssl_chainfile(T&&, Remain&&...)
{
// We can't call .ssl() member function unless CROW_ENABLE_SSL is defined.
static_assert(
// make static_assert dependent to T; always false
std::is_base_of<T, void>::value,
"Define CROW_ENABLE_SSL to enable ssl support.");
return *this;
}

template<typename T>
self_t& ssl(T&&)
{
Expand Down
2 changes: 1 addition & 1 deletion include/crow/multipart.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace crow
return empty;
}

/// Same as \ref get_header_value_Object() but for \ref multipart.header
/// Same as \ref get_header_value_object() but for \ref multipart.header
template<typename T>
inline const header& get_header_object(const T& headers, const std::string& key)
{
Expand Down
2 changes: 0 additions & 2 deletions include/crow/routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,6 @@ namespace crow
allow = allow.substr(0, allow.size() - 2);
res = response(204);
res.set_header("Allow", allow);
res.manual_length_header = true;
res.end();
return;
}
Expand All @@ -1486,7 +1485,6 @@ namespace crow
allow = allow.substr(0, allow.size() - 2);
res = response(204);
res.set_header("Allow", allow);
res.manual_length_header = true;
res.end();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion include/crow/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
#if __cplusplus > 201103L
#define CROW_GCC83_WORKAROUND
#else
#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."
#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."
#endif
#endif