Crow  1.0
A C++ microframework for the web
crow Namespace Reference

Namespaces

 detail
 
 json
 
 multipart
 Encapsulates anything related to processing and organizing multipart/xyz messages.
 
 mustache
 
 websocket
 

Classes

class  BaseRule
 A base class for all rules. More...
 
class  Blueprint
 A blueprint can be considered a smaller section of a Crow app, specifically where the router is conecerned. More...
 
class  CatchallRule
 
class  CerrLogHandler
 
struct  ci_hash
 Hashing function for ci_map (unordered_multimap). More...
 
struct  ci_key_eq
 Equals function for ci_map (unordered_multimap). More...
 
class  Connection
 An HTTP connection. More...
 
struct  CookieParser
 
struct  CORSHandler
 CORSHandler is a global middleware for setting CORS headers. More...
 
struct  CORSRules
 Used for tuning CORS policies. More...
 
class  Crow
 The main server application. More...
 
class  DynamicRule
 A rule that can change its parameters during runtime. More...
 
struct  HTTPParser
 A wrapper for nodejs/http-parser. More...
 
struct  ILocalMiddleware
 Local middleware should extend ILocalMiddleware. More...
 
class  ILogHandler
 
class  logger
 
class  query_string
 A class to represent any data coming after the ? in the request URL into key-value pairs. More...
 
struct  request
 An HTTP request. More...
 
struct  response
 HTTP response. More...
 
struct  returnable
 An abstract class that allows any other class to be returned by a handler. More...
 
class  Router
 Handles matching requests to existing rules and upgrade requests. More...
 
struct  RuleParameterTraits
 Allows the user to assign parameters using functions. More...
 
class  Server
 
struct  SocketAdaptor
 A wrapper for the asio::ip::tcp::socket and asio::ssl::stream. More...
 
class  TaggedRule
 Default rule created when CROW_ROUTE is called. More...
 
class  Trie
 A search tree. More...
 
struct  UTF8
 
class  WebSocketRule
 A rule dealing with websockets. More...
 

Typedefs

template<typename... Middlewares>
using App = Crow< Middlewares... >
 
using SimpleApp = Crow<>
 
using ci_map = std::unordered_multimap< std::string, std::string, ci_hash, ci_key_eq >
 
using tcp = asio::ip::tcp
 

Enumerations

enum  HTTPMethod : char {
  HTTPMethod::DELETE = 0,
  HTTPMethod::GET,
  HTTPMethod::HEAD,
  HTTPMethod::POST,
  HTTPMethod::PUT,
  HTTPMethod::CONNECT,
  HTTPMethod::OPTIONS,
  HTTPMethod::TRACE,
  HTTPMethod::PATCH,
  HTTPMethod::PURGE,
  HTTPMethod::COPY,
  HTTPMethod::LOCK,
  HTTPMethod::MKCOL,
  HTTPMethod::MOVE,
  HTTPMethod::PROPFIND,
  HTTPMethod::PROPPATCH,
  HTTPMethod::SEARCH,
  HTTPMethod::UNLOCK,
  HTTPMethod::BIND,
  HTTPMethod::REBIND,
  HTTPMethod::UNBIND,
  HTTPMethod::ACL,
  HTTPMethod::REPORT,
  HTTPMethod::MKACTIVITY,
  HTTPMethod::CHECKOUT,
  HTTPMethod::MERGE,
  HTTPMethod::MSEARCH,
  HTTPMethod::NOTIFY,
  HTTPMethod::SUBSCRIBE,
  HTTPMethod::UNSUBSCRIBE,
  HTTPMethod::MKCALENDAR,
  HTTPMethod::LINK,
  HTTPMethod::UNLINK,
  HTTPMethod::SOURCE,
  HTTPMethod::Delete = 0,
  HTTPMethod::Get,
  HTTPMethod::Head,
  HTTPMethod::Post,
  HTTPMethod::Put,
  HTTPMethod::Connect,
  HTTPMethod::Options,
  HTTPMethod::Trace,
  HTTPMethod::Patch,
  HTTPMethod::Purge,
  HTTPMethod::Copy,
  HTTPMethod::Lock,
  HTTPMethod::MkCol,
  HTTPMethod::Move,
  HTTPMethod::Propfind,
  HTTPMethod::Proppatch,
  HTTPMethod::Search,
  HTTPMethod::Unlock,
  HTTPMethod::Bind,
  HTTPMethod::Rebind,
  HTTPMethod::Unbind,
  HTTPMethod::Acl,
  HTTPMethod::Report,
  HTTPMethod::MkActivity,
  HTTPMethod::Checkout,
  HTTPMethod::Merge,
  HTTPMethod::MSearch,
  HTTPMethod::Notify,
  HTTPMethod::Subscribe,
  HTTPMethod::Unsubscribe,
  HTTPMethod::MkCalendar,
  HTTPMethod::Link,
  HTTPMethod::Unlink,
  HTTPMethod::Source,
  HTTPMethod::InternalMethodCount
}
 
enum  status {
  CONTINUE = 100,
  SWITCHING_PROTOCOLS = 101,
  OK = 200,
  CREATED = 201,
  ACCEPTED = 202,
  NON_AUTHORITATIVE_INFORMATION = 203,
  NO_CONTENT = 204,
  RESET_CONTENT = 205,
  PARTIAL_CONTENT = 206,
  MULTIPLE_CHOICES = 300,
  MOVED_PERMANENTLY = 301,
  FOUND = 302,
  SEE_OTHER = 303,
  NOT_MODIFIED = 304,
  TEMPORARY_REDIRECT = 307,
  PERMANENT_REDIRECT = 308,
  BAD_REQUEST = 400,
  UNAUTHORIZED = 401,
  FORBIDDEN = 403,
  NOT_FOUND = 404,
  METHOD_NOT_ALLOWED = 405,
  PROXY_AUTHENTICATION_REQUIRED = 407,
  CONFLICT = 409,
  GONE = 410,
  PAYLOAD_TOO_LARGE = 413,
  UNSUPPORTED_MEDIA_TYPE = 415,
  RANGE_NOT_SATISFIABLE = 416,
  EXPECTATION_FAILED = 417,
  PRECONDITION_REQUIRED = 428,
  TOO_MANY_REQUESTS = 429,
  UNAVAILABLE_FOR_LEGAL_REASONS = 451,
  INTERNAL_SERVER_ERROR = 500,
  NOT_IMPLEMENTED = 501,
  BAD_GATEWAY = 502,
  SERVICE_UNAVAILABLE = 503,
  GATEWAY_TIMEOUT = 504,
  VARIANT_ALSO_NEGOTIATES = 506
}
 
enum  ParamType : char {
  ParamType::INT,
  ParamType::UINT,
  ParamType::DOUBLE,
  ParamType::STRING,
  ParamType::PATH,
  ParamType::MAX
}
 
enum  LogLevel {
  LogLevel::DEBUG = 0,
  LogLevel::INFO,
  LogLevel::WARNING,
  LogLevel::ERROR,
  LogLevel::CRITICAL,
  LogLevel::Debug = 0,
  LogLevel::Info,
  LogLevel::Warning,
  LogLevel::Error,
  LogLevel::Critical
}
 

Functions

const std::string crlf ("\r\n")
 
std::string method_name (HTTPMethod method)
 
template<typename T >
const std::string & get_header_value (const T &headers, const std::string &key)
 Find and return the value associated with the key. (returns an empty string if nothing is found) More...
 
int qs_strncmp (const char *s, const char *qs, size_t n)
 
int qs_parse (char *qs, char *qs_kv[], int qs_kv_size)
 
int qs_decode (char *qs)
 
char * qs_k2v (const char *key, char *const *qs_kv, int qs_kv_size, int nth)
 
char * qs_scanvalue (const char *key, const char *qs, char *val, size_t val_len)
 
boost::optional< std::pair< std::string, std::string > > qs_dict_name2kv (const char *dict_name, char *const *qs_kv, int qs_kv_size, int nth=0)
 
static std::string base64encode (const unsigned char *data, size_t size, const char *key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
 
static std::string base64encode (std::string data, size_t size, const char *key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
 
static std::string base64encode_urlsafe (const unsigned char *data, size_t size)
 
static std::string base64encode_urlsafe (std::string data, size_t size)
 
static std::string base64decode (const char *data, size_t size)
 
static std::string base64decode (const std::string &data, size_t size)
 
static std::string base64decode (const std::string &data)
 
static void sanitize_filename (std::string &data, char replacement='_')
 

Variables

const char cr = '\r'
 
const char lf = '\n'
 
constexpr const char * method_strings []
 
const std::unordered_map< std::string, std::string > mime_types
 
constexpr const uint16_t INVALID_BP_ID {((uint16_t)-1)}
 
const int RULE_SPECIAL_REDIRECT_SLASH = 1
 
constexpr const char VERSION [] = "master"
 

Typedef Documentation

◆ App

template<typename... Middlewares>
using crow::App = typedef Crow<Middlewares...>

◆ SimpleApp

using crow::SimpleApp = typedef Crow<>

◆ ci_map

using crow::ci_map = typedef std::unordered_multimap<std::string, std::string, ci_hash, ci_key_eq>

◆ tcp

typedef asio::ip::tcp crow::tcp

Enumeration Type Documentation

◆ HTTPMethod

enum crow::HTTPMethod : char
strong
Enumerator
DELETE 
GET 
HEAD 
POST 
PUT 
CONNECT 
OPTIONS 
TRACE 
PATCH 
PURGE 
COPY 
LOCK 
MKCOL 
MOVE 
PROPFIND 
PROPPATCH 
SEARCH 
UNLOCK 
BIND 
REBIND 
UNBIND 
ACL 
REPORT 
MKACTIVITY 
CHECKOUT 
MERGE 
MSEARCH 
NOTIFY 
SUBSCRIBE 
UNSUBSCRIBE 
MKCALENDAR 
LINK 
UNLINK 
SOURCE 
Delete 
Get 
Head 
Post 
Put 
Connect 
Options 
Trace 
Patch 
Purge 
Copy 
Lock 
MkCol 
Move 
Propfind 
Proppatch 
Search 
Unlock 
Bind 
Rebind 
Unbind 
Acl 
Report 
MkActivity 
Checkout 
Merge 
MSearch 
Notify 
Subscribe 
Unsubscribe 
MkCalendar 
Link 
Unlink 
Source 
InternalMethodCount 

◆ status

Enumerator
CONTINUE 
SWITCHING_PROTOCOLS 
OK 
CREATED 
ACCEPTED 
NON_AUTHORITATIVE_INFORMATION 
NO_CONTENT 
RESET_CONTENT 
PARTIAL_CONTENT 
MULTIPLE_CHOICES 
MOVED_PERMANENTLY 
FOUND 
SEE_OTHER 
NOT_MODIFIED 
TEMPORARY_REDIRECT 
PERMANENT_REDIRECT 
BAD_REQUEST 
UNAUTHORIZED 
FORBIDDEN 
NOT_FOUND 
METHOD_NOT_ALLOWED 
PROXY_AUTHENTICATION_REQUIRED 
CONFLICT 
GONE 
PAYLOAD_TOO_LARGE 
UNSUPPORTED_MEDIA_TYPE 
RANGE_NOT_SATISFIABLE 
EXPECTATION_FAILED 
PRECONDITION_REQUIRED 
TOO_MANY_REQUESTS 
UNAVAILABLE_FOR_LEGAL_REASONS 
INTERNAL_SERVER_ERROR 
NOT_IMPLEMENTED 
BAD_GATEWAY 
SERVICE_UNAVAILABLE 
GATEWAY_TIMEOUT 
VARIANT_ALSO_NEGOTIATES 

◆ ParamType

enum crow::ParamType : char
strong
Enumerator
INT 
UINT 
DOUBLE 
STRING 
PATH 
MAX 

◆ LogLevel

enum crow::LogLevel
strong
Enumerator
DEBUG 
INFO 
WARNING 
ERROR 
CRITICAL 
Debug 
Info 
Warning 
Error 
Critical 

Function Documentation

◆ crlf()

const std::string crow::crlf ( "\r\n"  )
Here is the caller graph for this function:

◆ method_name()

std::string crow::method_name ( HTTPMethod  method)
inline
Here is the caller graph for this function:

◆ get_header_value()

template<typename T >
const std::string& crow::get_header_value ( const T &  headers,
const std::string &  key 
)
inline

Find and return the value associated with the key. (returns an empty string if nothing is found)

Here is the caller graph for this function:

◆ qs_strncmp()

int crow::qs_strncmp ( const char *  s,
const char *  qs,
size_t  n 
)
inline
Here is the caller graph for this function:

◆ qs_parse()

int crow::qs_parse ( char *  qs,
char *  qs_kv[],
int  qs_kv_size 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ qs_decode()

int crow::qs_decode ( char *  qs)
inline
Here is the caller graph for this function:

◆ qs_k2v()

char * crow::qs_k2v ( const char *  key,
char *const *  qs_kv,
int  qs_kv_size,
int  nth = 0 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ qs_scanvalue()

char * crow::qs_scanvalue ( const char *  key,
const char *  qs,
char *  val,
size_t  val_len 
)
inline
Here is the call graph for this function:

◆ qs_dict_name2kv()

boost::optional<std::pair<std::string, std::string> > crow::qs_dict_name2kv ( const char *  dict_name,
char *const *  qs_kv,
int  qs_kv_size,
int  nth = 0 
)
inline
Here is the caller graph for this function:

◆ base64encode() [1/2]

static std::string crow::base64encode ( const unsigned char *  data,
size_t  size,
const char *  key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 
)
inlinestatic
Here is the caller graph for this function:

◆ base64encode() [2/2]

static std::string crow::base64encode ( std::string  data,
size_t  size,
const char *  key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 
)
inlinestatic
Here is the call graph for this function:

◆ base64encode_urlsafe() [1/2]

static std::string crow::base64encode_urlsafe ( const unsigned char *  data,
size_t  size 
)
inlinestatic
Here is the call graph for this function:

◆ base64encode_urlsafe() [2/2]

static std::string crow::base64encode_urlsafe ( std::string  data,
size_t  size 
)
inlinestatic
Here is the call graph for this function:

◆ base64decode() [1/3]

static std::string crow::base64decode ( const char *  data,
size_t  size 
)
inlinestatic
Here is the caller graph for this function:

◆ base64decode() [2/3]

static std::string crow::base64decode ( const std::string &  data,
size_t  size 
)
inlinestatic
Here is the call graph for this function:

◆ base64decode() [3/3]

static std::string crow::base64decode ( const std::string &  data)
inlinestatic
Here is the call graph for this function:

◆ sanitize_filename()

static void crow::sanitize_filename ( std::string &  data,
char  replacement = '_' 
)
inlinestatic

Variable Documentation

◆ cr

const char crow::cr = '\r'

◆ lf

const char crow::lf = '\n'

◆ method_strings

constexpr const char* crow::method_strings[]
constexpr

◆ mime_types

const std::unordered_map<std::string, std::string> crow::mime_types

◆ INVALID_BP_ID

constexpr const uint16_t crow::INVALID_BP_ID {((uint16_t)-1)}
constexpr

◆ RULE_SPECIAL_REDIRECT_SLASH

const int crow::RULE_SPECIAL_REDIRECT_SLASH = 1

◆ VERSION

constexpr const char crow::VERSION[] = "master"
constexpr
crow::HTTPParser::header_field
std::string header_field
Definition: parser.h:181
crow::json::rvalue::has
bool has(const std::string &str) const
Definition: json.h:495
crow::response::operator=
response & operator=(const response &r)=delete
crow::mustache::invalid_template_exception::what
virtual const char * what() const
Definition: mustache.h:26
crow::detail::routing_handler_call_helper::call_params::params
const routing_params & params
Definition: routing.h:112
crow::mustache::ActionType::Partial
@ Partial
crow::detail::handler_call_bridge::operator()
void operator()(F &&f) const
Definition: middleware.h:312
crow::CREATED
@ CREATED
Definition: common.h:173
crow::HTTPParser::url
std::string url
Definition: parser.h:178
crow::response::response
response(response &&r)
Definition: http_response.h:88
crow::websocket::Connection::post
void post(CompletionHandler handler)
Send data through the socket and return immediately.
Definition: websocket.h:117
crow::json::rvalue::operator[]
const rvalue & operator[](const std::string &str) const
Definition: json.h:586
crow::detail::task_timer::set_default_timeout
void set_default_timeout(std::uint8_t timeout)
Set the default timeout for this task_timer instance. (Default: 5)
Definition: task_timer.h:83
crow::request::http_ver_major
unsigned char http_ver_major
Definition: http_request.h:33
crow::request::request
request(HTTPMethod method, std::string raw_url, std::string url, query_string url_params, ci_map headers, std::string body, unsigned char http_major, unsigned char http_minor, bool has_keep_alive, bool has_close_connection, bool is_upgrade)
Construct a request with all values assigned.
Definition: http_request.h:46
crow::websocket::Connection::mask_
uint32_t mask_
Definition: websocket.h:626
crow::HTTPMethod::PUT
@ PUT
crow::Crow::signal_add
self_t & signal_add(int signal_number)
Definition: app.h:111
crow::qs_k2v
char * qs_k2v(const char *key, char *const *qs_kv, int qs_kv_size, int nth)
Definition: query_string.h:172
crow::Router::PerMethod::PerMethod
PerMethod()
Definition: routing.h:1598
crow::BaseRule::rule
const std::string & rule()
Definition: routing.h:80
crow::LogLevel::Info
@ Info
crow::websocket::Connection::close_handler_
std::function< void(crow::websocket::connection &, const std::string &)> close_handler_
Definition: websocket.h:636
crow::json::wvalue::wvalue
wvalue(std::string &&value)
Definition: json.h:1311
crow::logger::get_current_log_level
static LogLevel get_current_log_level()
Definition: logging.h:127
crow::json::wvalue::reset
void reset()
Definition: json.h:1438
crow::query_string::query_string
query_string(std::string url)
Definition: query_string.h:334
crow::PROXY_AUTHENTICATION_REQUIRED
@ PROXY_AUTHENTICATION_REQUIRED
Definition: common.h:193
crow::json::wvalue::operator[]
wvalue & operator[](const std::string &str)
Definition: json.h:1674
crow::CORSHandler::blueprint
CORSRules & blueprint(const Blueprint &bp)
Handle CORS for a specific blueprint.
Definition: cors.h:154
crow::Crow::stop
void stop()
Stop the server.
Definition: app.h:319
crow::Router::PerMethod::trie
Trie trie
Definition: routing.h:1595
crow::json::type
type
Definition: json.h:79
crow::Trie::get_size
size_t get_size()
Definition: routing.h:994
crow::request::body
std::string body
Definition: http_request.h:31
crow::request::middleware_container
void * middleware_container
Definition: http_request.h:37
crow::Connection::buffer_
boost::array< char, 4096 > buffer_
Definition: http_connection.h:603
crow::BaseRule::foreach_method
void foreach_method(F f)
Definition: routing.h:68
crow::detail::handler_middleware_wrapper::middleware_call_criteria
Definition: middleware.h:261
crow::CORSRules::set_header_no_override
void set_header_no_override(const std::string &key, const std::string &value, crow::response &res)
Set header key to value if it is not set.
Definition: cors.h:97
crow::detail::task_timer::clock_type
std::chrono::steady_clock clock_type
Definition: task_timer.h:24
crow::detail::task_timer::task_timer
task_timer(boost::asio::io_service &io_service)
Definition: task_timer.h:28
crow::Connection::cancel_deadline_timer
void cancel_deadline_timer()
Definition: http_connection.h:578
crow::detail::before_handler_call
std::enable_if<!is_before_handle_arity_3_impl< MW >::value >::type before_handler_call(MW &mw, request &req, response &res, Context &ctx, ParentContext &)
Definition: middleware.h:97
crow::CatchallRule::has_handler
bool has_handler()
Definition: routing.h:354
crow::mustache::invalid_template_exception::msg
std::string msg
Definition: mustache.h:30
crow::detail::is_before_handle_arity_3_impl
Definition: middleware.h:64
crow::detail::handler_call_bridge
Definition: middleware.h:300
crow::websocket::Connection::is_binary_
bool is_binary_
Definition: websocket.h:617
crow::SocketAdaptor::context
void context
Definition: socket_adaptors.h:20
crow::json::detail::r_string::end
const char * end() const
Definition: json.h:166
crow::json::wvalue::object
std::unordered_map< std::string, wvalue > object
Definition: json.h:1242
crow::HTTPParser::to_request
request to_request() const
Take the parsed HTTP request data and convert it to a crow::request.
Definition: parser.h:172
crow::detail::routing_handler_call_helper::Wrapped::handler_
handler_type_helper< ArgsWrapped... >::type handler_
Definition: routing.h:253
crow::json::wvalue::operator=
wvalue & operator=(double value)
Definition: json.h:1460
crow::CookieParser
Definition: cookie_parser.h:31
crow::json::detail::r_string::r_string
r_string(r_string &&r)
Definition: json.h:136
crow::HTTPParser::on_headers_complete
static int on_headers_complete(http_parser *self_)
Definition: parser.h:66
crow::mustache::Action::Action
Action(ActionType t, size_t start, size_t end, size_t pos=0)
Definition: mustache.h:66
crow::detail::handler_call_bridge::tptr
Route * tptr
Definition: middleware.h:318
crow::SocketAdaptor::socket
tcp::socket & socket()
Get the object handling data transfers, this can be either a TCP socket or an SSL stream (if SSL is e...
Definition: socket_adaptors.h:37
crow::request::close_connection
bool close_connection
Definition: http_request.h:34
crow::json::wvalue::number
Definition: json.h:1252
crow::CookieParser::context::jar
std::unordered_map< std::string, std::string > jar
Definition: cookie_parser.h:35
crow::request::url_params
query_string url_params
The parameters associated with the request. (everything after the ?)
Definition: http_request.h:29
crow::CookieParser::after_handle
void after_handle(request &, response &res, context &ctx)
Definition: cookie_parser.h:98
crow::websocket::connection::get_remote_ip
virtual std::string get_remote_ip()=0
crow::Trie::is_empty
bool is_empty()
Check whether or not the trie is empty.
Definition: routing.h:657
crow::LogLevel::Error
@ Error
crow::query_string::pop
char * pop(const std::string &name)
Works similar to get() except it removes the item from the query string.
Definition: query_string.h:376
crow::json::rvalue::operator=
rvalue & operator=(rvalue &&r) noexcept
Definition: json.h:264
crow::query_string::get_list
std::vector< char * > get_list(const std::string &name, bool use_brackets=true) const
Returns a list of values, passed as ?name[]=value1&name[]=value2&...name[]=valuen with n being the si...
Definition: query_string.h:398
crow::Server::pick_io_service_idx
uint16_t pick_io_service_idx()
Definition: http_server.h:180
crow::Trie::validate
void validate()
Definition: routing.h:738
crow::json::rvalue::keys
std::vector< std::string > keys()
Definition: json.h:633
crow::SWITCHING_PROTOCOLS
@ SWITCHING_PROTOCOLS
Definition: common.h:170
crow::request::headers
ci_map headers
Definition: http_request.h:30
crow::json::detail::r_string::begin
const char * begin() const
Definition: json.h:165
crow::json::rvalue::set_cached
void set_cached() const
Definition: json.h:653
crow::SEE_OTHER
@ SEE_OTHER
Definition: common.h:183
crow::ci_map
std::unordered_multimap< std::string, std::string, ci_hash, ci_key_eq > ci_map
Definition: ci_map.h:35
crow::logger::level_
LogLevel level_
Definition: logging.h:145
crow::response::set_static_file_info
void set_static_file_info(std::string path)
Return a static file as the response body.
Definition: http_response.h:227
crow::json::wvalue::operator=
wvalue & operator=(list &&v)
Definition: json.h:1557
crow::detail::context::after_handlers_call_helper
friend std::enable_if<(N==0)>::type after_handlers_call_helper(Container &middlewares, Context &ctx, request &req, response &res)
Definition: middleware.h:163
crow::CORSRules::add_list_item
void add_list_item(std::string &list, const std::string &val)
build comma separated list
Definition: cors.h:89
crow::SocketAdaptor::get_io_service
boost::asio::io_service & get_io_service()
Definition: socket_adaptors.h:25
crow::Connection
An HTTP connection.
Definition: http_connection.h:34
crow::detail::routing_handler_call_helper::Wrapped::set_
void set_(Func f, typename std::enable_if< std::is_same< typename std::tuple_element< 0, std::tuple< Args..., void >>::type, const request & >::value &&!std::is_same< typename std::tuple_element< 1, std::tuple< Args..., void, void >>::type, response & >::value, int >::type=0)
Definition: routing.h:209
crow::ILogHandler::log
virtual void log(std::string message, LogLevel level)=0
crow::json::wvalue::number::si
int64_t si
Definition: json.h:1255
crow::json::detail::r_string::e_
char * e_
End.
Definition: json.h:173
crow::HTTPMethod::UNLOCK
@ UNLOCK
crow::detail::check_before_handle_arity_3
Definition: middleware.h:32
crow::json::escape
void escape(const std::string &str, std::string &ret)
Definition: json.h:39
crow::ILocalMiddleware
Local middleware should extend ILocalMiddleware.
Definition: middleware.h:16
crow::Crow::notify_server_start
void notify_server_start()
Notify anything using wait_for_server_start() to proceed.
Definition: app.h:269
crow::BAD_GATEWAY
@ BAD_GATEWAY
Definition: common.h:206
crow::json::detail::r_string::operator<<
friend std::ostream & operator<<(std::ostream &os, const r_string &s)
Definition: json.h:175
crow::Trie::find
std::tuple< uint16_t, std::vector< uint16_t >, routing_params > find(const std::string &req_url, const Node *node=nullptr, unsigned pos=0, routing_params *params=nullptr, std::vector< uint16_t > *blueprints=nullptr) const
Definition: routing.h:746
crow::websocket::Connection::message_
std::string message_
Definition: websocket.h:618
crow::Crow::wait_for_server_start
void wait_for_server_start()
Wait until the server has properly started.
Definition: app.h:426
crow::websocket::Connection::fragment_
std::string fragment_
Definition: websocket.h:619
crow::NOT_MODIFIED
@ NOT_MODIFIED
Definition: common.h:184
crow::WebSocketRule::onaccept
self_t & onaccept(Func f)
Definition: routing.h:429
crow::response::response
response(int code, returnable &value)
Definition: http_response.h:81
crow::GATEWAY_TIMEOUT
@ GATEWAY_TIMEOUT
Definition: common.h:208
crow::HTTPMethod::Unbind
@ Unbind
crow::HTTPMethod::PURGE
@ PURGE
crow::CORSRules::methods_
std::string methods_
Definition: cors.h:118
crow::detail::routing_handler_call_helper::call< F, NInt, NUint, NDouble, NString, black_magic::S< uint64_t, Args1... >, black_magic::S< Args2... > >::operator()
void operator()(F cparams)
Definition: routing.h:134
crow::json::type::Function
@ Function
crow::Crow::validate
void validate()
A wrapper for validate() in the router.
Definition: app.h:235
crow::ParamType::INT
@ INT
crow::websocket::Connection::is_close_handler_called_
bool is_close_handler_called_
Definition: websocket.h:632
crow::websocket::Connection::has_sent_close_
bool has_sent_close_
Definition: websocket.h:628
crow::response::static_file_info::path
std::string path
Definition: http_response.h:221
crow::mustache::set_loader
void set_loader(std::function< std::string(std::string)> loader)
Definition: mustache.h:689
crow::Connection::req_
request req_
Definition: http_connection.h:606
crow::HTTPMethod::ACL
@ ACL
crow::multipart::message::parse_section_head
void parse_section_head(std::string &lines, part &part)
Definition: multipart.h:205
crow::Connection::adaptor_
Adaptor adaptor_
Definition: http_connection.h:600
crow::SocketAdaptor::start
void start(F f)
Definition: socket_adaptors.h:77
crow::FOUND
@ FOUND
Definition: common.h:182
crow::request::request
request()
Construct an empty request. (sets the method to GET)
Definition: http_request.h:41
crow::Trie::Node::key
std::string key
Definition: routing.h:636
crow::websocket::Connection::check_destroy
void check_destroy()
Destroy the Connection.
Definition: websocket.h:600
crow::mime_types
const std::unordered_map< std::string, std::string > mime_types
Definition: mime_types.h:7
crow::detail::task_timer::task_type
std::function< void()> task_type
Definition: task_timer.h:20
crow::Server::adaptor_ctx_
Adaptor::context * adaptor_ctx_
Definition: http_server.h:247
crow::HTTPMethod::Patch
@ Patch
crow::ILogHandler
Definition: logging.h:33
crow::response::response
response(int code)
Definition: http_response.h:67
crow::Crow::bindaddr_
std::string bindaddr_
Definition: app.h:440
crow::Crow::cv_started_
std::condition_variable cv_started_
Definition: app.h:465
crow::websocket::Connection::has_recv_close_
bool has_recv_close_
Definition: websocket.h:629
crow::LogLevel::ERROR
@ ERROR
crow::response::is_alive_helper_
std::function< bool()> is_alive_helper_
Definition: http_response.h:269
crow::detail::context::get
T::context & get()
Definition: middleware_context.h:51
crow::BaseRule::name_
std::string name_
Definition: routing.h:86
crow::detail::is_after_handle_arity_3_impl::value
static constexpr bool value
Definition: middleware.h:92
crow::Connection::do_write_sync
void do_write_sync(std::vector< asio::const_buffer > &buffers)
Definition: http_connection.h:549
crow::response::is_alive
bool is_alive()
Check if the connection is still alive (usually by checking the socket status).
Definition: http_response.h:204
crow::Connection::buffers_
std::vector< boost::asio::const_buffer > buffers_
Definition: http_connection.h:612
crow::SocketAdaptor::shutdown_write
void shutdown_write()
Definition: socket_adaptors.h:64
crow::response::static_file_info
This constains metadata (coming from the stat command) related to any static files associated with th...
Definition: http_response.h:219
crow::logger::stringstream_
std::ostringstream stringstream_
Definition: logging.h:144
crow::multipart::mph_map
std::unordered_multimap< std::string, header, ci_hash, ci_key_eq > mph_map
Multipart header map (key is header key).
Definition: multipart.h:31
crow::mustache::template_t::template_t
template_t(std::string body)
Definition: mustache.h:76
crow::json::rvalue::has
bool has(const char *str) const
Check if the json object has the passed string as a key.
Definition: json.h:490
crow::ILocalMiddleware::call_global
std::false_type call_global
Definition: middleware.h:18
crow::CORSRules::CORSRules
CORSRules()=delete
crow::qs_parse
int qs_parse(char *qs, char *qs_kv[], int qs_kv_size)
Definition: query_string.h:99
crow::json::rvalue::rvalue
rvalue(rvalue &&r) noexcept
Definition: json.h:248
crow::response::redirect
void redirect(const std::string &location)
Return a "Temporary Redirect" response.
Definition: http_response.h:136
crow::Crow::middlewares_
std::tuple< Middlewares... > middlewares_
Definition: app.h:452
crow::response::headers
ci_map headers
HTTP headers.
Definition: http_response.h:39
crow::CORSRules::headers
CORSRules & headers(const std::string &header)
Set Access-Control-Allow-Headers. Default is "*".
Definition: cors.h:39
crow::logger::get_log_level_ref
static LogLevel & get_log_level_ref()
Definition: logging.h:131
crow::json::wvalue::t_
type t_
The type of the value.
Definition: json.h:1250
crow::websocket::Connection::send_text
void send_text(const std::string &msg) override
Send a plaintext message.
Definition: websocket.h:162
crow::mustache::Action::t
ActionType t
Definition: mustache.h:65
crow::json::wvalue::s
std::string s
Value if type is a string.
Definition: json.h:1268
crow::TaggedRule::operator()
void operator()(std::string name, Func &&f)
Definition: routing.h:589
crow::Server
Definition: http_server.h:26
crow::Router::register_blueprint
void register_blueprint(Blueprint &blueprint)
Definition: routing.h:1215
crow::Trie::Node::rule_index
uint16_t rule_index
Definition: routing.h:633
crow::Connection::get_cached_date_str
std::function< std::string()> & get_cached_date_str
Definition: http_connection.h:629
crow::CORSRules::blueprint
CORSRules & blueprint(const Blueprint &bp)
Handle CORS for specific blueprint.
Definition: cors.h:190
crow::TaggedRule::operator()
void operator()(Func &&f)
Definition: routing.h:575
crow::multipart::message::parts
std::vector< part > parts
The individual parts of the message.
Definition: multipart.h:78
crow::PARTIAL_CONTENT
@ PARTIAL_CONTENT
Definition: common.h:178
crow::response::set_static_file_info_unsafe
void set_static_file_info_unsafe(std::string path)
Return a static file as the response body without sanitizing the path (use set_static_file_info inste...
Definition: http_response.h:234
crow::json::rvalue::end
rvalue * end() const
Definition: json.h:534
crow::mustache::detail::get_loader_ref
std::function< std::string(std::string)> & get_loader_ref()
Definition: mustache.h:660
crow::query_string::query_string
query_string()
Definition: query_string.h:296
crow::json::type::True
@ True
crow::SERVICE_UNAVAILABLE
@ SERVICE_UNAVAILABLE
Definition: common.h:207
crow::DynamicRule
A rule that can change its parameters during runtime.
Definition: routing.h:480
crow::mustache::Action
Definition: mustache.h:60
crow::VARIANT_ALSO_NEGOTIATES
@ VARIANT_ALSO_NEGOTIATES
Definition: common.h:209
crow::ci_key_eq
Equals function for ci_map (unordered_multimap).
Definition: ci_map.h:27
crow::Crow::validated_
bool validated_
Definition: app.h:438
crow::query_string::url_
std::string url_
Definition: query_string.h:484
crow::Crow::signal_clear
self_t & signal_clear()
Definition: app.h:105
crow::websocket::Connection::adaptor_
Adaptor adaptor_
Definition: websocket.h:611
crow::GONE
@ GONE
Definition: common.h:195
crow::DynamicRule::validate
void validate() override
Definition: routing.h:487
crow::ParamType::PATH
@ PATH
crow::detail::check_after_handle_arity_3_const
Definition: middleware.h:40
crow::Router::get_found_bp
void get_found_bp(std::vector< uint16_t > &bp_i, std::vector< Blueprint * > &blueprints, std::vector< Blueprint * > &found_bps, uint16_t index=0)
Definition: routing.h:1373
crow::json::rvalue::unescape
void unescape() const
Convert escaped string character to their original form ("\\n" -> ' ').
Definition: json.h:425
crow::Crow::loglevel
self_t & loglevel(LogLevel level)
Set the server's log level.
Definition: app.h:176
crow::Server::io_service_
asio::io_service io_service_
Definition: http_server.h:226
crow::json::wvalue::num
union crow::json::wvalue::number num
Value if type is a number.
crow::Blueprint::Blueprint
Blueprint(const std::string &prefix, const std::string &static_dir)
Definition: routing.h:1035
crow::WebSocketRule::validate
void validate() override
Definition: routing.h:380
crow::json::rvalue::determine_num_type
void determine_num_type()
Determines num_type from the string.
Definition: json.h:688
crow::UNSUPPORTED_MEDIA_TYPE
@ UNSUPPORTED_MEDIA_TYPE
Definition: common.h:197
crow::mustache::template_t::render
rendered_template render() const
Output a returnable template from this mustache template.
Definition: mustache.h:360
crow::HTTPMethod::Put
@ Put
crow::json::rvalue::d
double d() const
The double precision floating-point number value.
Definition: json.h:378
crow::Server::server_name_
std::string server_name_
Definition: http_server.h:237
crow::Server::port_
uint16_t port_
Definition: http_server.h:238
crow::json::wvalue::operator=
wvalue & operator=(const std::string &str)
Definition: json.h:1549
crow::json::wvalue::o
std::unique_ptr< object > o
Value if type is a JSON object.
Definition: json.h:1270
crow::CookieParser::before_handle
void before_handle(request &req, response &res, context &ctx)
Definition: cookie_parser.h:52
crow::Connection::prepare_buffers
void prepare_buffers()
Definition: http_connection.h:272
crow::json::wvalue::wvalue
wvalue(std::int64_t value)
Definition: json.h:1298
crow::json::rvalue::key
const detail::r_string & key() const
Definition: json.h:543
crow::Blueprint::Blueprint
Blueprint(const std::string &prefix, const std::string &static_dir, const std::string &templates_dir)
Definition: routing.h:1038
crow::HTTPParser::process_message
void process_message()
Definition: parser.h:151
crow::HTTPParser::handler_
Handler * handler_
This is currently an HTTP connection object (crow::Connection).
Definition: parser.h:189
crow::Trie::add
void add(const std::string &url, uint16_t rule_index, unsigned bp_prefix_length=0, uint16_t blueprint_index=INVALID_BP_ID)
Definition: routing.h:909
crow::Server::io_service_pool_
std::vector< std::unique_ptr< asio::io_service > > io_service_pool_
Definition: http_server.h:227
crow::websocket::connection::userdata_
void * userdata_
Definition: websocket.h:36
crow::response::static_file_info::statbuf
struct stat statbuf
Definition: http_response.h:222
crow::HTTPMethod::MSearch
@ MSearch
crow::detail::task_timer::schedule
identifier_type schedule(const task_type &task)
Schedule the given task to be executed after the default amount of ticks.
Definition: task_timer.h:51
crow::Connection::do_read
void do_read()
Definition: http_connection.h:473
crow::json::wvalue::wvalue
wvalue(std::uint16_t value)
Definition: json.h:1285
crow::Connection::content_length_
std::string content_length_
Definition: http_connection.h:614
crow::Crow::server_name
self_t & server_name(std::string server_name)
Set the server name.
Definition: app.h:139
crow::detail::routing_handler_call_helper::call_params::res
response & res
Definition: routing.h:114
crow::request::get_header_value
const std::string & get_header_value(const std::string &key) const
Definition: http_request.h:55
crow::Crow::timeout_
std::uint8_t timeout_
Definition: app.h:435
crow::HTTPMethod::MkCol
@ MkCol
crow::TaggedRule::validate
void validate() override
Definition: routing.h:566
crow::query_string::query_string
query_string(const query_string &qs)
Definition: query_string.h:301
crow::HTTPMethod::GET
@ GET
crow::sanitize_filename
static void sanitize_filename(std::string &data, char replacement='_')
Definition: utility.h:671
crow::App
Crow< Middlewares... > App
Definition: app.h:469
crow::qs_decode
int qs_decode(char *qs)
Definition: query_string.h:143
crow::HTTPMethod::LINK
@ LINK
crow::Server::acceptor_
tcp::acceptor acceptor_
Definition: http_server.h:230
crow::Connection::socket
decltype(std::declval< Adaptor >().raw_socket()) & socket()
The TCP socket on top of which the connection is established.
Definition: http_connection.h:75
crow::ci_hash::operator()
size_t operator()(const std::string &key) const
Definition: ci_map.h:12
crow::detail::task_timer::deadline_timer_
boost::asio::deadline_timer deadline_timer_
Definition: task_timer.h:125
crow::LogLevel::CRITICAL
@ CRITICAL
crow::CerrLogHandler
Definition: logging.h:39
crow::detail::routing_handler_call_helper::call< F, NInt, NUint, NDouble, NString, black_magic::S< int64_t, Args1... >, black_magic::S< Args2... > >::operator()
void operator()(F cparams)
Definition: routing.h:124
crow::CORSRules::CORSRules
CORSRules(CORSHandler *handler)
Definition: cors.h:85
crow::logger::logger
logger(LogLevel level)
Definition: logging.h:96
crow::Crow::multithreaded
self_t & multithreaded()
Run the server on multiple threads using all available threads.
Definition: app.h:153
crow::base64encode_urlsafe
static std::string base64encode_urlsafe(const unsigned char *data, size_t size)
Definition: utility.h:575
crow::multipart::message::get_boundary
std::string get_boundary(const std::string &header) const
Definition: multipart.h:151
crow::HTTPParser::keep_alive
bool keep_alive
Whether or not the server should send a connection: Keep-Alive header to the client.
Definition: parser.h:186
crow::logger::operator<<
logger & operator<<(T const &value)
Definition: logging.h:111
crow::response::skip_body
bool skip_body
Whether this is a response to a HEAD request.
Definition: http_response.h:44
crow::CORSRules::handler_
CORSHandler * handler_
Definition: cors.h:123
crow::Crow::stream_threshold
self_t & stream_threshold(size_t threshold)
Set the response body size (in bytes) beyond which Crow automatically streams responses (Default is 1...
Definition: app.h:186
crow::Router::per_methods_
std::array< PerMethod, static_cast< int >HTTPMethod::InternalMethodCount)> per_methods_
Definition: routing.h:1601
crow::response::end
void end(const std::string &body_part)
Same as end() except it adds a body part right before ending.
Definition: http_response.h:197
crow::NOT_IMPLEMENTED
@ NOT_IMPLEMENTED
Definition: common.h:205
crow::Server::task_queue_length_pool_
std::vector< std::atomic< unsigned int > > task_queue_length_pool_
Definition: http_server.h:240
crow::HTTPMethod::UNLINK
@ UNLINK
crow::Connection::server_name_
const std::string & server_name_
Definition: http_connection.h:611
crow::Router::handle
void handle(request &req, response &res)
Definition: routing.h:1445
crow::json::wvalue::operator=
wvalue & operator=(wvalue &&r)
Definition: json.h:1422
crow::Router::handle_upgrade
void handle_upgrade(const request &req, response &res, Adaptor &&adaptor)
Definition: routing.h:1301
crow::SocketAdaptor::SocketAdaptor
SocketAdaptor(boost::asio::io_service &io_service, context *)
Definition: socket_adaptors.h:21
crow::multipart::header::params
std::unordered_map< std::string, std::string > params
The parameters of the header, come after the value
Definition: multipart.h:24
crow::HTTPParser::feed
bool feed(const char *buffer, int length)
Parse a buffer into the different sections of an HTTP request.
Definition: parser.h:104
crow::HTTPParser::body
std::string body
Definition: parser.h:185
crow::HTTPMethod::Acl
@ Acl
crow::HTTPMethod::Merge
@ Merge
crow::multipart::message::parse_section
part parse_section(std::string &section)
Definition: multipart.h:192
crow::mustache::ActionType
ActionType
Definition: mustache.h:49
crow::detail::routing_handler_call_helper::call_params
Definition: routing.h:109
crow::websocket::WebSocketReadState::MiniHeader
@ MiniHeader
crow::multipart::message::get_part_by_name
part get_part_by_name(const std::string &name)
Definition: multipart.h:86
crow::websocket::WebSocketReadState
WebSocketReadState
Definition: websocket.h:12
crow::websocket::Connection::handle_fragment
void handle_fragment()
Process the payload fragment.
Definition: websocket.h:482
crow::detail::routing_handler_call_helper::Wrapped::handler_type_helper< const request &, response &, Args... >::type
std::function< void(const crow::request &, crow::response &, Args...)> type
Definition: routing.h:249
crow::multipart::message::message
message(const ci_map &headers, const std::string &boundary, const std::vector< part > &sections)
Default constructor using default values.
Definition: multipart.h:126
crow::HTTPParser::done
bool done()
Definition: parser.h:124
crow::websocket::Connection::close_connection_
bool close_connection_
Definition: websocket.h:623
crow::json::rvalue::count
int count(const std::string &str)
Definition: json.h:521
crow::response::get_header_value
const std::string & get_header_value(const std::string &key)
Definition: http_response.h:60
crow::HTTPMethod::UNBIND
@ UNBIND
crow::json::wvalue::operator=
wvalue & operator=(unsigned short value)
Definition: json.h:1469
crow::base64encode
static std::string base64encode(const unsigned char *data, size_t size, const char *key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
Definition: utility.h:534
crow::mustache::template_t::render
rendered_template render(context &ctx) const
Apply the values from the context provided and output a returnable template from this mustache templa...
Definition: mustache.h:372
crow::detail::check_after_handle_arity_3_const::get
Definition: middleware.h:43
crow::json::wvalue::clear
void clear()
Used for compatibility, same as reset()
Definition: json.h:1433
crow::json::rvalue::nt_
num_type nt_
Definition: json.h:715
crow::json::detail::r_string::force
void force(char *s, uint32_t length)
Definition: json.h:182
crow::SocketAdaptor::shutdown_read
void shutdown_read()
Definition: socket_adaptors.h:70
crow::detail::task_timer::cancel
void cancel(identifier_type id)
Definition: task_timer.h:38
crow::Connection::middlewares_
std::tuple< Middlewares... > * middlewares_
Definition: http_connection.h:626
crow::response::response
response(returnable &&value)
Definition: http_response.h:71
crow::multipart::message::pad
std::string pad(std::string &string, const char &padding='"') const
Definition: multipart.h:258
crow::INVALID_BP_ID
constexpr const uint16_t INVALID_BP_ID
Definition: routing.h:23
crow::CookieParser::context::cookies_to_add
std::unordered_map< std::string, std::string > cookies_to_add
Definition: cookie_parser.h:36
crow::websocket::Connection::has_mask_
bool has_mask_
Definition: websocket.h:625
crow::mustache::rendered_template::rendered_template
rendered_template()
Definition: mustache.h:35
crow::SocketAdaptor::shutdown_readwrite
void shutdown_readwrite()
Definition: socket_adaptors.h:58
crow::websocket::connection
A base class for websocket connection.
Definition: websocket.h:22
crow::detail::check_before_handle_arity_3_const::get
Definition: middleware.h:27
crow::HTTPParser::close_connection
bool close_connection
Whether or not the server should shut down the TCP connection once a response is sent.
Definition: parser.h:187
crow::json::type::Null
@ Null
crow::DynamicRule::erased_handler_
std::function< void(request &, response &, const routing_params &)> erased_handler_
Definition: routing.h:552
crow::Connection::queue_length_
std::atomic< unsigned int > & queue_length_
Definition: http_connection.h:634
crow::Server::on_tick
void on_tick()
Definition: http_server.h:50
crow::query_string
A class to represent any data coming after the ? in the request URL into key-value pairs.
Definition: query_string.h:291
crow::websocket::Connection
A websocket connection.
Definition: websocket.h:64
crow::Server::middlewares_
std::tuple< Middlewares... > * middlewares_
Definition: http_server.h:245
crow::WebSocketRule
A rule dealing with websockets.
Definition: routing.h:371
crow::HTTPMethod::MOVE
@ MOVE
crow::json::load_nocopy_internal
rvalue load_nocopy_internal(char *data, size_t size)
Definition: json.h:819
crow::response::completed_
bool completed_
Definition: http_response.h:267
crow::detail::routing_handler_call_helper::call_params::handler
H1 & handler
Definition: routing.h:111
crow::response::is_static_type
bool is_static_type()
Check whether the response has a static file defined.
Definition: http_response.h:210
crow::websocket::connection::close
virtual void close(const std::string &msg="quit")=0
crow::json::rvalue::rvalue
rvalue(const rvalue &r)
Definition: json.h:242
crow::mustache::set_base
void set_base(const std::string &path)
Definition: mustache.h:667
crow::mustache::rendered_template::rendered_template
rendered_template(std::string &body)
Definition: mustache.h:38
crow::WebSocketRule::handle_upgrade
void handle_upgrade(const request &req, response &, SocketAdaptor &&adaptor) override
Definition: routing.h:389
crow::mustache::Action::start
int start
Definition: mustache.h:62
crow::Server::do_accept
void do_accept()
Definition: http_server.h:194
crow::HTTPMethod::MkCalendar
@ MkCalendar
crow::Crow::stream_threshold
size_t & stream_threshold()
Get the response body size (in bytes) beyond which Crow automatically streams responses.
Definition: app.h:193
crow::json::wvalue::wvalue
wvalue(list &r)
Definition: json.h:1331
crow::Crow::ssl_used
bool ssl_used() const
Definition: app.h:402
crow::mustache::template_t::render_string
std::string render_string() const
Output a returnable template from this mustache template.
Definition: mustache.h:383
crow::detail::handler_middleware_wrapper
Definition: http_response.h:25
crow::ci_key_eq::operator()
bool operator()(const std::string &l, const std::string &r) const
Definition: ci_map.h:29
crow::json::detail::operator>
bool operator>(const r_string &l, const std::string &r)
Definition: json.h:201
crow::HTTPMethod::MKCALENDAR
@ MKCALENDAR
crow::HTTPMethod::Get
@ Get
crow::mustache::template_t::render_string
std::string render_string(context &ctx) const
Apply the values from the context provided and output a returnable template from this mustache templa...
Definition: mustache.h:395
crow::json::wvalue::nt
num_type nt
The specific type of the number if t_ is a number.
Definition: json.h:1251
crow
Definition: app.h:37
crow::detail::context::middleware_call_helper
friend std::enable_if<(N< std::tuple_size< typename std::remove_reference< Container >::type >::value), bool >::type middleware_call_helper(Container &middlewares, request &req, response &res, Context &ctx)
Definition: middleware.h:127
crow::WebSocketRule::handle
void handle(request &, response &res, const routing_params &) override
Definition: routing.h:383
crow::request::keep_alive
bool keep_alive
Definition: http_request.h:34
crow::TOO_MANY_REQUESTS
@ TOO_MANY_REQUESTS
Definition: common.h:201
crow::detail::routing_handler_call_helper::call< F, NInt, NUint, NDouble, NString, black_magic::S< std::string, Args1... >, black_magic::S< Args2... > >::operator()
void operator()(F cparams)
Definition: routing.h:154
crow::json::wvalue::operator=
wvalue & operator=(std::function< std::string(std::string &)> &&func)
Definition: json.h:1645
crow::websocket::Connection::write_buffers_
std::vector< std::string > write_buffers_
Definition: websocket.h:614
crow::Trie::get_size
size_t get_size(Node *node)
Definition: routing.h:999
crow::HTTPMethod::Purge
@ Purge
crow::multipart::dd
const std::string dd
Definition: multipart.h:18
crow::Blueprint::blueprints_
std::vector< Blueprint * > blueprints_
Definition: routing.h:1155
crow::json::detail::r_string::operator=
r_string & operator=(r_string &&r)
Definition: json.h:141
crow::json::detail::operator==
bool operator==(const r_string &l, const r_string &r)
Definition: json.h:206
crow::multipart::header
The first part in a section, contains metadata about the part.
Definition: multipart.h:21
crow::request::url
std::string url
The endpoint without any parameters.
Definition: http_request.h:28
crow::detail::handler_call_bridge::check_app_contains
typename black_magic::has_type< MW, typename App::mw_container_t > check_app_contains
Definition: middleware.h:303
crow::json::rvalue::s
detail::r_string s() const
The string value.
Definition: json.h:398
crow::Router::catchall_rule
CatchallRule & catchall_rule()
Definition: routing.h:1186
crow::detail::is_after_handle_arity_3_impl
Definition: middleware.h:80
crow::RANGE_NOT_SATISFIABLE
@ RANGE_NOT_SATISFIABLE
Definition: common.h:198
crow::detail::check_global_call_false
Definition: middleware.h:56
crow::SocketAdaptor
A wrapper for the asio::ip::tcp::socket and asio::ssl::stream.
Definition: socket_adaptors.h:18
crow::websocket::connection::send_ping
virtual void send_ping(const std::string &msg)=0
crow::Crow::timeout
self_t & timeout(std::uint8_t timeout)
Set the connection timeout in seconds (default is 5)
Definition: app.h:132
crow::HTTPMethod::POST
@ POST
crow::json::wvalue::wvalue
wvalue(std::int32_t value)
Definition: json.h:1296
crow::RuleParameterTraits::websocket
WebSocketRule & websocket()
Definition: routing.h:451
crow::json::num_type::Unsigned_integer
@ Unsigned_integer
crow::json::rvalue::is_cached
bool is_cached() const
Definition: json.h:649
crow::detail::routing_handler_call_helper::Wrapped::handler_type_helper< const request &, Args... >::args_type
black_magic::S< typename black_magic::promote_t< Args >... > args_type
Definition: routing.h:243
crow::Crow::catchall_route
CatchallRule & catchall_route()
Create a route for any requests without a proper route (Use CROW_CATCHALL_ROUTE instead)
Definition: app.h:100
crow::json::rvalue::operator<<
friend std::ostream & operator<<(std::ostream &os, const rvalue &r)
Definition: json.h:720
crow::DynamicRule::operator()
void operator()(Func f)
Definition: routing.h:505
crow::Crow::tick
self_t & tick(Duration d, Func f)
Set a custom duration and function to run on every tick.
Definition: app.h:206
crow::mustache::Action::end
int end
Definition: mustache.h:63
crow::detail::routing_handler_call_helper::Wrapped::req_handler_wrapper::f
Func f
Definition: routing.h:205
crow::json::wvalue::t
type t() const
Definition: json.h:1247
crow::Server::set_tick_function
void set_tick_function(std::chrono::milliseconds d, std::function< void()> f)
Definition: http_server.h:44
crow::detail::middleware_call_criteria_only_global::value
static const bool value
Definition: middleware.h:200
crow::CORSHandler
CORSHandler is a global middleware for setting CORS headers.
Definition: cors.h:132
crow::json::wvalue::wvalue
wvalue(std::int8_t value)
Definition: json.h:1292
crow::HTTPMethod::Rebind
@ Rebind
crow::Blueprint::prefix_
std::string prefix_
Definition: routing.h:1150
crow::websocket::Connection::accept_handler_
std::function< bool(const crow::request &)> accept_handler_
Definition: websocket.h:638
crow::query_string::get_dict
std::unordered_map< std::string, std::string > get_dict(const std::string &name) const
Works similar to get_list() except the brackets are mandatory must not be empty.
Definition: query_string.h:439
crow::detail::check_global_call_false::get
Definition: middleware.h:59
crow::HTTPParser
A wrapper for nodejs/http-parser.
Definition: parser.h:18
crow::request::io_service
boost::asio::io_service * io_service
Definition: http_request.h:38
crow::EXPECTATION_FAILED
@ EXPECTATION_FAILED
Definition: common.h:199
crow::json::wvalue::wvalue
wvalue(double value)
Definition: json.h:1303
crow::detail::check_after_handle_arity_3::get
Definition: middleware.h:51
crow::detail::routing_handler_call_helper::call< F, NInt, NUint, NDouble, NString, black_magic::S< double, Args1... >, black_magic::S< Args2... > >::operator()
void operator()(F cparams)
Definition: routing.h:144
crow::request::remote_ip_address
std::string remote_ip_address
The IP address from which the request was sent.
Definition: http_request.h:32
crow::Trie
A search tree.
Definition: routing.h:628
crow::HTTPMethod::Report
@ Report
crow::Connection::ctx_
detail::context< Middlewares... > ctx_
Definition: http_connection.h:627
crow::Trie::optimize
void optimize()
Definition: routing.h:662
crow::RULE_SPECIAL_REDIRECT_SLASH
const int RULE_SPECIAL_REDIRECT_SLASH
Definition: routing.h:624
crow::json::load
rvalue load(const char *data, size_t size)
Definition: json.h:1204
crow::HTTPMethod::NOTIFY
@ NOTIFY
crow::get_header_value
const std::string & get_header_value(const T &headers, const std::string &key)
Find and return the value associated with the key. (returns an empty string if nothing is found)
Definition: http_request.h:13
crow::Trie::Node::param
ParamType param
Definition: routing.h:637
crow::cr
const char cr
Definition: common.h:11
crow::HTTPMethod::Propfind
@ Propfind
crow::json::rvalue::end_
char * end_
Definition: json.h:709
crow::Connection::do_write_general
void do_write_general()
Definition: http_connection.h:415
crow::HTTPParser::header_building_state
int header_building_state
Definition: parser.h:180
crow::Crow::router_
Router router_
Definition: app.h:442
crow::json::rvalue::operator[]
const rvalue & operator[](int index) const
Definition: json.h:559
crow::RuleParameterTraits::name
self_t & name(std::string name) noexcept
Definition: routing.h:458
crow::HTTPMethod::PROPFIND
@ PROPFIND
crow::HTTPMethod::DELETE
@ DELETE
crow::detail::check_before_handle_arity_3::get
Definition: middleware.h:35
crow::lf
const char lf
Definition: common.h:12
crow::json::rvalue::load
friend rvalue load(const char *data, size_t size)
Definition: json.h:1204
crow::websocket::Connection::build_header
std::string build_header(int opcode, size_t size)
Generate the websocket headers using an opcode and the message size (in bytes).
Definition: websocket.h:200
crow::json::rvalue::copy_l
void copy_l(const rvalue &r)
Definition: json.h:657
crow::Server::task_timer_pool_
std::vector< detail::task_timer * > task_timer_pool_
Definition: http_server.h:228
crow::websocket::connection::userdata
void userdata(void *u)
Definition: websocket.h:32
crow::detail::task_timer::highest_id_
identifier_type highest_id_
Definition: task_timer.h:130
crow::Blueprint::Blueprint
Blueprint(Blueprint &&value)
Definition: routing.h:1054
crow::Connection::date_str_
std::string date_str_
Definition: http_connection.h:615
crow::json::detail::r_string::~r_string
~r_string()
Definition: json.h:125
crow::query_string::key_value_pairs_
std::vector< char * > key_value_pairs_
Definition: query_string.h:485
crow::detail::routing_handler_call_helper::Wrapped
Definition: routing.h:174
crow::BaseRule::BaseRule
BaseRule(std::string rule)
Definition: routing.h:33
crow::multipart::message::message
message(const request &req)
Create a multipart message from a request data.
Definition: multipart.h:140
crow::response::response
response(returnable &value)
Definition: http_response.h:76
crow::request
An HTTP request.
Definition: http_request.h:24
crow::Connection::handle_header
void handle_header()
Definition: http_connection.h:97
crow::UTF8::before_handle
void before_handle(request &, response &, context &)
Definition: utf-8.h:13
crow::Blueprint::all_rules_
std::vector< std::unique_ptr< BaseRule > > all_rules_
Definition: routing.h:1153
crow::json::wvalue::operator=
wvalue & operator=(int value)
Definition: json.h:1505
crow::websocket::Connection::state_
WebSocketReadState state_
Definition: websocket.h:620
crow::response::response
response(std::string contentType, std::string body)
Definition: http_response.h:93
crow::json::wvalue::number::number
constexpr number(std::int64_t value) noexcept
Definition: json.h:1263
crow::detail::is_before_handle_arity_3_impl::f
static std::true_type f(typename check_before_handle_arity_3_const< T >::template get< C > *)
crow::WebSocketRule::onclose
self_t & onclose(Func f)
Definition: routing.h:415
crow::detail::handler_middleware_wrapper::operator()
void operator()(crow::request &req, crow::response &res, Args &&... args) const
Definition: middleware.h:267
crow::json::wvalue::operator=
wvalue & operator=(long value)
Definition: json.h:1496
crow::json::num_type::Floating_point
@ Floating_point
crow::HTTPMethod::Unsubscribe
@ Unsubscribe
crow::json::wvalue::number::ui
uint64_t ui
Definition: json.h:1256
crow::Crow::handle
void handle(request &req, response &res)
Process the request and generate a response for it.
Definition: app.h:72
crow::DynamicRule::operator()
void operator()(std::string name, Func &&f)
Definition: routing.h:545
crow::HTTPMethod::MkActivity
@ MkActivity
crow::LogLevel::Critical
@ Critical
crow::json::wvalue::wvalue
wvalue(std::uint64_t value)
Definition: json.h:1289
crow::detail::is_after_handle_arity_3_impl::f
static std::true_type f(typename check_after_handle_arity_3_const< T >::template get< C > *)
crow::HTTPParser::on_body
static int on_body(http_parser *self_, const char *at, size_t length)
Definition: parser.h:79
crow::mustache::Action::pos
int pos
Definition: mustache.h:64
crow::Trie::Trie
Trie()
Definition: routing.h:653
crow::json::wvalue::number::number
constexpr number(double value) noexcept
Definition: json.h:1265
crow::mustache::invalid_template_exception::invalid_template_exception
invalid_template_exception(const std::string &msg)
Definition: mustache.h:23
crow::detail::task_timer::process_tasks
void process_tasks()
Definition: task_timer.h:89
crow::Crow::route_dynamic
DynamicRule & route_dynamic(std::string &&rule)
Create a dynamic route using a rule (Use CROW_ROUTE instead)
Definition: app.h:78
crow::SocketAdaptor::close
void close()
Definition: socket_adaptors.h:52
crow::Connection::res
response res
Definition: http_connection.h:607
crow::detail::task_timer::tick_handler
void tick_handler(const boost::system::error_code &ec)
Definition: task_timer.h:111
crow::logger::get_handler_ref
static ILogHandler *& get_handler_ref()
Definition: logging.h:136
crow::Crow::concurrency_
uint16_t concurrency_
Definition: app.h:437
crow::CerrLogHandler::log
void log(std::string message, LogLevel level) override
Definition: logging.h:42
crow::Server::signal_clear
void signal_clear()
Definition: http_server.h:169
crow::Crow::server_started_
bool server_started_
Definition: app.h:464
crow::mustache::template_t::parse
void parse()
Definition: mustache.h:406
crow::UTF8
Definition: utf-8.h:8
crow::json::type::Object
@ Object
crow::Connection::res_stream_threshold_
size_t res_stream_threshold_
Definition: http_connection.h:632
crow::LogLevel::INFO
@ INFO
crow::HTTPMethod::Unlink
@ Unlink
crow::json::rvalue::error_bit
static const int error_bit
Definition: json.h:225
crow::json::detail::r_string::owned_
uint8_t owned_
Definition: json.h:174
crow::Blueprint::Blueprint
Blueprint(const std::string &prefix)
Definition: routing.h:1032
crow::Crow
The main server application.
Definition: app.h:47
crow::json::type::False
@ False
crow::Blueprint::catchall_rule_
CatchallRule catchall_rule_
Definition: routing.h:1154
crow::PERMANENT_REDIRECT
@ PERMANENT_REDIRECT
Definition: common.h:186
crow::response::code
int code
The Status code for the response.
Definition: http_response.h:37
crow::HTTPMethod::Unlock
@ Unlock
crow::WebSocketRule::onmessage
self_t & onmessage(Func f)
Definition: routing.h:408
crow::json::wvalue::operator=
wvalue & operator=(unsigned int value)
Definition: json.h:1532
crow::json::rvalue::i
int64_t i() const
The integer value.
Definition: json.h:345
crow::json::detail::r_string::r_string
r_string(char *s, char *e)
Definition: json.h:123
crow::CORSRules::max_age
CORSRules & max_age(int max_age)
Set Access-Control-Max-Age. Default is none.
Definition: cors.h:55
crow::HTTPMethod::OPTIONS
@ OPTIONS
crow::HTTPParser::set_connection_parameters
void set_connection_parameters()
Definition: parser.h:156
crow::query_string::pop_dict
std::unordered_map< std::string, std::string > pop_dict(const std::string &name)
Works the same as get_dict() but removes the values from the query string.
Definition: query_string.h:455
crow::json::detail::r_string::const_iterator
const char * const_iterator
Definition: json.h:170
crow::websocket::WebSocketReadState::Payload
@ Payload
crow::HTTPMethod::Head
@ Head
crow::DynamicRule::wrap
std::function< void(request &, response &, const routing_params &)> wrap(Func f, black_magic::seq< Indices... >)
Definition: routing.h:524
crow::Crow::bindaddr
self_t & bindaddr(std::string bindaddr)
The IP address that Crow will handle requests on (default is 0.0.0.0)
Definition: app.h:146
crow::json::rvalue::lo
std::vector< rvalue > lo()
The list or object value.
Definition: json.h:409
crow::WebSocketRule::error_handler_
std::function< void(crow::websocket::connection &)> error_handler_
Definition: routing.h:439
crow::response::file_info
static_file_info file_info
Definition: http_response.h:270
crow::Connection::parser_
HTTPParser< Connection > parser_
Definition: http_connection.h:605
crow::mustache::rendered_template
Definition: mustache.h:33
crow::json::rvalue::start_
char * start_
Definition: json.h:708
crow::Server::bindaddr_
std::string bindaddr_
Definition: http_server.h:239
crow::detail::handler_middleware_wrapper::f
F f
Definition: middleware.h:296
crow::json::wvalue::execute
std::string execute(std::string txt="") const
Definition: json.h:1696
crow::Router::debug_print
void debug_print()
Definition: routing.h:1575
crow::WebSocketRule::message_handler_
std::function< void(crow::websocket::connection &, const std::string &, bool)> message_handler_
Definition: routing.h:437
crow::multipart::get_header_object
const header & get_header_object(const T &headers, const std::string &key)
Same as get_header_value_object() but for multipart::header.
Definition: multipart.h:47
crow::json::wvalue::wvalue
wvalue(std::string const &value)
Definition: json.h:1309
crow::HTTPParser::url_params
query_string url_params
What comes after the ? in the URL.
Definition: parser.h:184
crow::CORSHandler::default_
CORSRules default_
Definition: cors.h:182
crow::json::type::Number
@ Number
crow::mustache::template_t::escape
void escape(const std::string &in, std::string &out) const
Definition: mustache.h:153
crow::HTTPMethod::Source
@ Source
crow::HTTPMethod::Link
@ Link
crow::base64decode
static std::string base64decode(const char *data, size_t size)
Definition: utility.h:585
crow::mustache::ActionType::UnescapeTag
@ UnescapeTag
crow::CORSHandler::rules
std::vector< std::pair< std::string, CORSRules > > rules
Definition: cors.h:181
crow::Blueprint::templates_dir_
std::string templates_dir_
Definition: routing.h:1152
crow::detail::task_timer::identifier_type
size_t identifier_type
Definition: task_timer.h:21
crow::json::wvalue::wvalue
wvalue(bool value)
Definition: json.h:1280
crow::RuleParameterTraits::methods
self_t & methods(HTTPMethod method)
Definition: routing.h:464
crow::json::rvalue::load_nocopy_internal
friend rvalue load_nocopy_internal(char *data, size_t size)
Definition: json.h:819
crow::response::response
response(int code, std::string body)
Definition: http_response.h:69
crow::Router::internal_add_rule_object
void internal_add_rule_object(const std::string &rule, BaseRule *ruleObject, const uint16_t &BP_index, std::vector< Blueprint * > &blueprints)
Definition: routing.h:1191
crow::Blueprint::operator==
bool operator==(const Blueprint &value)
Definition: routing.h:1069
crow::UTF8::context
Definition: utf-8.h:10
crow::HTTPMethod::REPORT
@ REPORT
crow::CatchallRule
Definition: routing.h:272
crow::websocket::Connection::Connection
Connection(const crow::request &req, Adaptor &&adaptor, std::function< void(crow::websocket::connection &)> open_handler, std::function< void(crow::websocket::connection &, const std::string &, bool)> message_handler, std::function< void(crow::websocket::connection &, const std::string &)> close_handler, std::function< void(crow::websocket::connection &)> error_handler, std::function< bool(const crow::request &)> accept_handler)
Constructor for a connection.
Definition: websocket.h:72
crow::INTERNAL_SERVER_ERROR
@ INTERNAL_SERVER_ERROR
Definition: common.h:204
crow::Blueprint::operator=
Blueprint & operator=(Blueprint &&value) noexcept
Definition: routing.h:1061
crow::json::rvalue::t_
type t_
Definition: json.h:714
crow::query_string::pop_list
std::vector< char * > pop_list(const std::string &name, bool use_brackets=true)
Similar to get_list() but it removes the.
Definition: query_string.h:416
crow::json::wvalue::operator[]
wvalue & operator[](unsigned index)
Definition: json.h:1653
crow::DynamicRule::handle
void handle(request &req, response &res, const routing_params &params) override
Definition: routing.h:495
crow::websocket::Connection::sending_buffers_
std::vector< std::string > sending_buffers_
Definition: websocket.h:613
crow::Trie::Node::blueprint_index
uint16_t blueprint_index
Definition: routing.h:635
crow::Crow::server_name_
std::string server_name_
Definition: app.h:439
crow::Connection::do_write
void do_write()
Definition: http_connection.h:521
crow::TaggedRule::TaggedRule
TaggedRule(std::string rule)
Definition: routing.h:562
crow::Server::get_cached_date_str_pool_
std::vector< std::function< std::string()> > get_cached_date_str_pool_
Definition: http_server.h:229
crow::HTTPMethod::Checkout
@ Checkout
crow::HTTPMethod::MKACTIVITY
@ MKACTIVITY
crow::websocket::Connection::start
void start(std::string &&hello)
Send the HTTP upgrade response.
Definition: websocket.h:227
crow::json::wvalue::wvalue
wvalue(wvalue &&r)
Definition: json.h:1416
crow::ParamType::UINT
@ UINT
crow::json::rvalue::operator[]
const rvalue & operator[](size_t index) const
Definition: json.h:570
crow::response::is_completed
bool is_completed() const noexcept
Check if the response has completed (whether response.end() has been called)
Definition: http_response.h:118
crow::multipart::header::value
std::string value
The first part of the header, usually Content-Type or Content-Disposition
Definition: multipart.h:23
crow::logger::setHandler
static void setHandler(ILogHandler *handler)
Definition: logging.h:125
crow::BaseRule::handle_upgrade
virtual void handle_upgrade(const request &, response &res, SocketAdaptor &&)
Definition: routing.h:49
crow::json::wvalue::list
std::vector< wvalue > list
Definition: json.h:1245
crow::SocketAdaptor::is_open
bool is_open()
Definition: socket_adaptors.h:47
crow::websocket::Connection::dispatch
void dispatch(CompletionHandler handler)
Send data through the socket.
Definition: websocket.h:110
crow::mustache::compile
template_t compile(const std::string &body)
Definition: mustache.h:623
crow::ParamType::DOUBLE
@ DOUBLE
crow::WebSocketRule::accept_handler_
std::function< bool(const crow::request &)> accept_handler_
Definition: routing.h:440
crow::NOT_FOUND
@ NOT_FOUND
Definition: common.h:191
crow::CORSRules::ignore
void ignore()
Ignore CORS and don't send any headers.
Definition: cors.h:69
crow::multipart::message::dump
std::string dump() const override
Represent all parts as a string (does not include message headers)
Definition: multipart.h:92
crow::detail::routing_handler_call_helper::Wrapped::req_handler_wrapper::operator()
void operator()(const request &req, response &res, Args... args)
Definition: routing.h:199
crow::json::detail::r_string::r_string
r_string(const r_string &r)
Definition: json.h:131
crow::SocketAdaptor::socket_
tcp::socket socket_
Definition: socket_adaptors.h:82
crow::returnable::dump
virtual std::string dump() const =0
crow::Server::tick_function_
std::function< void()> tick_function_
Definition: http_server.h:243
crow::Crow::handle_upgrade
void handle_upgrade(const request &req, response &res, Adaptor &&adaptor)
Process an Upgrade request.
Definition: app.h:66
crow::HTTPParser::clear
void clear()
Definition: parser.h:129
crow::json::wvalue::wvalue
wvalue(std::uint32_t value)
Definition: json.h:1287
crow::BaseRule::methods_
uint32_t methods_
Definition: routing.h:83
crow::BaseRule::rule_
std::string rule_
Definition: routing.h:85
crow::detail::routing_handler_call_helper::call_pair::type
T type
Definition: routing.h:104
crow::mustache::ActionType::OpenBlock
@ OpenBlock
crow::mustache::load
template_t load(const std::string &filename)
Definition: mustache.h:706
crow::request::add_header
void add_header(std::string key, std::string value)
Definition: http_request.h:50
crow::response
HTTP response.
Definition: http_response.h:29
crow::HTTPMethod::MSEARCH
@ MSEARCH
crow::mustache::template_t::body_
std::string body_
Definition: mustache.h:620
crow::HTTPMethod::HEAD
@ HEAD
crow::Connection::Connection
Connection(boost::asio::io_service &io_service, Handler *handler, const std::string &server_name, std::tuple< Middlewares... > *middlewares, std::function< std::string()> &get_cached_date_str_f, detail::task_timer &task_timer, typename Adaptor::context *adaptor_ctx_, std::atomic< unsigned int > &queue_length)
Definition: http_connection.h:39
crow::detail::context< Middlewares... >
crow::detail::check_after_handle_arity_3
Definition: middleware.h:48
crow::mustache::template_t::render_internal
void render_internal(int actionBegin, int actionEnd, std::vector< context * > &stack, std::string &out, int indent) const
Definition: mustache.h:199
crow::HTTPMethod::PROPPATCH
@ PROPPATCH
crow::json::rvalue::option_
uint8_t option_
Definition: json.h:716
crow::multipart::message::boundary
std::string boundary
The text boundary that separates different parts
Definition: multipart.h:77
crow::Crow::server_t
Server< Crow, SocketAdaptor, Middlewares... > server_t
The HTTP server.
Definition: app.h:53
crow::returnable::~returnable
virtual ~returnable()
Definition: returnable.h:17
crow::detail::routing_handler_call_helper::Wrapped::operator()
void operator()(request &req, response &res, const routing_params &params)
Definition: routing.h:255
crow::CONTINUE
@ CONTINUE
Definition: common.h:169
crow::CatchallRule::handler_
std::function< void(const crow::request &, crow::response &)> handler_
Definition: routing.h:363
crow::Crow::port_
uint16_t port_
Definition: app.h:436
crow::Server::Server
Server(Handler *handler, std::string bindaddr, uint16_t port, std::string server_name=std::string("Crow/")+VERSION, std::tuple< Middlewares... > *middlewares=nullptr, uint16_t concurrency=1, uint8_t timeout=5, typename Adaptor::context *adaptor_ctx=nullptr)
Definition: http_server.h:29
crow::request::raw_url
std::string raw_url
The full URL containing the ? and URL parameters.
Definition: http_request.h:27
crow::json::wvalue::operator=
wvalue & operator=(std::nullptr_t)
Definition: json.h:1445
crow::method_strings
constexpr const char * method_strings[]
Definition: common.h:110
crow::CookieParser::context::get_cookie
std::string get_cookie(const std::string &key) const
Definition: cookie_parser.h:38
crow::detail::partial_context
Definition: middleware_context.h:14
crow::json::wvalue
JSON write value.
Definition: json.h:1233
crow::json::num_type
num_type
Definition: json.h:106
crow::Crow::self_t
Crow self_t
This crow application.
Definition: app.h:51
crow::Router::new_rule_dynamic
DynamicRule & new_rule_dynamic(const std::string &rule)
Definition: routing.h:1167
crow::json::detail::operator<
bool operator<(const r_string &l, const r_string &r)
Definition: json.h:191
crow::Trie::Node::IsSimpleNode
bool IsSimpleNode() const
Definition: routing.h:640
crow::HTTPMethod::Lock
@ Lock
crow::json::rvalue::set_error
void set_error()
Definition: json.h:623
crow::Connection::check_destroy
void check_destroy()
Definition: http_connection.h:567
crow::HTTPParser::on_header_field
static int on_header_field(http_parser *self_, const char *at, size_t length)
Definition: parser.h:32
crow::BaseRule::get_methods
uint32_t get_methods()
Definition: routing.h:62
crow::websocket::WebSocketReadState::Mask
@ Mask
crow::detail::task_timer::schedule
identifier_type schedule(const task_type &task, std::uint8_t timeout)
Schedule the given task to be executed after the given time.
Definition: task_timer.h:71
crow::json::rvalue::key_
detail::r_string key_
Definition: json.h:710
crow::detail::partial_context< Middlewares... >::parent_context
typename black_magic::pop_back< Middlewares... >::template rebind<::crow::detail::partial_context > parent_context
Definition: middleware_context.h:16
crow::json::wvalue::f
std::function< std::string(std::string &)> f
Value if type is a function (C++ lambda)
Definition: json.h:1271
crow::CORSHandler::global
CORSRules & global()
Get the global CORS policy.
Definition: cors.h:161
crow::detail::task_timer::default_timeout_
std::uint8_t default_timeout_
Definition: task_timer.h:123
crow::BaseRule
A base class for all rules.
Definition: routing.h:30
crow::multipart::part::headers
mph_map headers
(optional) The first part before the data, Contains information regarding the type of data and encodi...
Definition: multipart.h:58
crow::mustache::rendered_template::body_
std::string body_
Definition: mustache.h:41
crow::query_string::clear
void clear()
Definition: query_string.h:346
crow::HTTPMethod::MKCOL
@ MKCOL
crow::detail::task_timer::time_type
clock_type::time_point time_type
Definition: task_timer.h:25
crow::UTF8::after_handle
void after_handle(request &, response &res, context &)
Definition: utf-8.h:16
crow::json::wvalue::count
int count(const std::string &str)
Definition: json.h:1665
crow::mustache::set_global_base
void set_global_base(const std::string &path)
Definition: mustache.h:678
crow::mustache::template_t::isTagInsideObjectBlock
bool isTagInsideObjectBlock(const int &current, const std::vector< context * > &stack) const
Definition: mustache.h:173
crow::PRECONDITION_REQUIRED
@ PRECONDITION_REQUIRED
Definition: common.h:200
crow::mustache::load_text
std::string load_text(const std::string &filename)
Definition: mustache.h:694
crow::HTTPMethod::Proppatch
@ Proppatch
crow::ParamType
ParamType
Definition: common.h:214
crow::Server::tick_timer_
boost::asio::deadline_timer tick_timer_
Definition: http_server.h:232
crow::Router::get_recursive_child_methods
void get_recursive_child_methods(Blueprint *blueprint, std::vector< HTTPMethod > &methods)
Definition: routing.h:1225
crow::logger
Definition: logging.h:93
crow::mustache::template_t::find_context
auto find_context(const std::string &name, const std::vector< context * > &stack, bool shouldUseOnlyFirstStackValue=false) const -> std::pair< bool, context & >
Definition: mustache.h:88
crow::HTTPMethod::BIND
@ BIND
crow::json::wvalue::dump
std::string dump() const
Definition: json.h:1890
crow::json::wvalue::estimate_length
size_t estimate_length() const
Returns an estimated size of the value in bytes.
Definition: json.h:1712
crow::json::wvalue::wvalue
wvalue(float value)
Definition: json.h:1301
crow::websocket::Connection::open_handler_
std::function< void(crow::websocket::connection &)> open_handler_
Definition: websocket.h:634
crow::detail::routing_handler_call_helper::Wrapped::handler_type_helper< ArgsWrapped... >::type
std::function< void(const crow::request &, crow::response &, Args...)> type
Definition: routing.h:235
crow::multipart::part
One part of the multipart message.
Definition: multipart.h:56
crow::CORSRules
Used for tuning CORS policies.
Definition: cors.h:11
crow::HTTPMethod::PATCH
@ PATCH
crow::json::wvalue::wvalue
wvalue(char const *value)
Definition: json.h:1306
crow::mustache::ActionType::Ignore
@ Ignore
crow::HTTPParser::HTTPParser
HTTPParser(Handler *handler)
Definition: parser.h:96
crow::WebSocketRule::open_handler_
std::function< void(crow::websocket::connection &)> open_handler_
Definition: routing.h:436
crow::json::wvalue::wvalue
wvalue()
Definition: json.h:1274
crow::json::rvalue::lremain_
uint16_t lremain_
Definition: json.h:713
crow::mustache::ActionType::CloseBlock
@ CloseBlock
crow::websocket::Connection::do_write
void do_write()
Send the buffers' data through the socket.
Definition: websocket.h:568
crow::response::write
void write(const std::string &body_part)
Definition: http_response.h:172
crow::Server::run
void run()
Definition: http_server.h:61
crow::json::wvalue::operator=
wvalue & operator=(unsigned long long value)
Definition: json.h:1514
crow::CORSRules::apply
void apply(crow::response &res)
Set response headers.
Definition: cors.h:105
crow::WebSocketRule::onopen
self_t & onopen(Func f)
Definition: routing.h:401
crow::CORSRules::global
CORSRules & global()
Global CORS policy.
Definition: cors.h:195
crow::DynamicRule::DynamicRule
DynamicRule(std::string rule)
Definition: routing.h:483
crow::ParamType::MAX
@ MAX
crow::HTTPMethod::Move
@ Move
crow::returnable::returnable
returnable(std::string ctype)
Definition: returnable.h:13
crow::Trie::debug_node_print
void debug_node_print(Node *node, int level)
Definition: routing.h:695
crow::json::detail::r_string::r_string
r_string()
Definition: json.h:122
crow::detail::task_timer::~task_timer
~task_timer()
Definition: task_timer.h:36
crow::query_string::get
char * get(const std::string &name) const
Get a value from a name, used for ?name=value.
Definition: query_string.h:369
crow::NON_AUTHORITATIVE_INFORMATION
@ NON_AUTHORITATIVE_INFORMATION
Definition: common.h:175
crow::Router
Handles matching requests to existing rules and upgrade requests.
Definition: routing.h:1161
crow::response::moved
void moved(const std::string &location)
Return a "Found (Moved Temporarily)" response.
Definition: http_response.h:156
crow::HTTPMethod::CONNECT
@ CONNECT
crow::multipart::part::get_header_object
const header & get_header_object(const std::string &key) const
Definition: multipart.h:64
crow::response::redirect_perm
void redirect_perm(const std::string &location)
Return a "Permanent Redirect" response.
Definition: http_response.h:146
crow::response::response
response(int code, std::string contentType, std::string body)
Definition: http_response.h:99
crow::HTTPMethod::REBIND
@ REBIND
crow::detail::routing_handler_call_helper::Wrapped::handler_type_helper< const request &, response &, Args... >::args_type
black_magic::S< typename black_magic::promote_t< Args >... > args_type
Definition: routing.h:250
crow::Router::validate
void validate()
Definition: routing.h:1277
crow::WebSocketRule::close_handler_
std::function< void(crow::websocket::connection &, const std::string &)> close_handler_
Definition: routing.h:438
crow::HTTPMethod::Post
@ Post
crow::request::middleware_context
void * middleware_context
Definition: http_request.h:36
crow::json::wvalue::number::number
constexpr number() noexcept
Definition: json.h:1259
crow::Router::all_rules_
std::vector< std::unique_ptr< BaseRule > > all_rules_
Definition: routing.h:1602
crow::Trie::head_
Node head_
Definition: routing.h:1021
crow::json::wvalue::operator=
wvalue & operator=(unsigned long value)
Definition: json.h:1523
crow::mustache::default_loader
std::string default_loader(const std::string &filename)
Definition: mustache.h:643
crow::CORSRules::headers_
std::string headers_
Definition: cors.h:119
crow::json::operator==
bool operator==(const rvalue &l, const std::string &r)
Definition: json.h:778
crow::CORSRules::ignore_
bool ignore_
Definition: cors.h:115
crow::mustache::load_unsafe
template_t load_unsafe(const std::string &filename)
Definition: mustache.h:713
crow::detail::handler_middleware_wrapper::middleware_call_criteria::value
static constexpr bool value
Definition: middleware.h:263
crow::mustache::rendered_template::dump
std::string dump() const override
Definition: mustache.h:43
crow::json::rvalue::l_
std::unique_ptr< rvalue[]> l_
Definition: json.h:711
crow::request::dispatch
void dispatch(CompletionHandler handler)
Send data to whoever made this request with a completion handler.
Definition: http_request.h:74
crow::json::wvalue::number::d
double d
Definition: json.h:1254
crow::detail::routing_handler_call_helper::Wrapped::set_
void set_(Func f, typename std::enable_if<!std::is_same< typename std::tuple_element< 0, std::tuple< Args..., void >>::type, const request & >::value, int >::type=0)
Definition: routing.h:177
crow::Crow::res_stream_threshold_
size_t res_stream_threshold_
Definition: app.h:441
crow::multipart::message::dump
std::string dump(int part_) const
Represent an individual part as a string.
Definition: multipart.h:107
crow::query_string::MAX_KEY_VALUE_PAIRS_COUNT
static const int MAX_KEY_VALUE_PAIRS_COUNT
Definition: query_string.h:294
crow::websocket::Connection::buffer_
boost::array< char, 4096 > buffer_
Definition: websocket.h:616
crow::detail::task_timer::io_service_
boost::asio::io_service & io_service_
Definition: task_timer.h:124
crow::json::rvalue::cached_bit
static const int cached_bit
Definition: json.h:224
crow::json::type::String
@ String
crow::Trie::Node
Definition: routing.h:631
crow::Crow::context_t
detail::context< Middlewares... > context_t
Definition: app.h:409
crow::websocket::Connection::remaining_length16_
uint16_t remaining_length16_
Definition: websocket.h:621
crow::json::wvalue::wvalue
wvalue(object &&value)
Definition: json.h:1319
crow::CerrLogHandler::timestamp
static std::string timestamp()
Definition: logging.h:67
crow::HTTPParser::header_value
std::string header_value
Definition: parser.h:182
crow::CORSHandler::prefix
CORSRules & prefix(const std::string &prefix)
Handle CORS on a specific prefix path.
Definition: cors.h:147
crow::HTTPMethod::COPY
@ COPY
crow::websocket::connection::~connection
virtual ~connection()
Definition: websocket.h:30
crow::Crow::port
self_t & port(std::uint16_t port)
Set the port that Crow will handle requests on.
Definition: app.h:118
crow::HTTPMethod::TRACE
@ TRACE
crow::Server::signal_add
void signal_add(int signal_number)
Definition: http_server.h:174
crow::CORSHandler::before_handle
void before_handle(crow::request &, crow::response &, context &)
Definition: cors.h:137
crow::LogLevel::Debug
@ Debug
crow::SocketAdaptor::remote_endpoint
tcp::endpoint remote_endpoint()
Definition: socket_adaptors.h:42
crow::Connection::start_deadline
void start_deadline()
Definition: http_connection.h:584
crow::websocket::connection::send_binary
virtual void send_binary(const std::string &msg)=0
crow::json::rvalue::begin
rvalue * begin() const
Definition: json.h:526
crow::NO_CONTENT
@ NO_CONTENT
Definition: common.h:176
crow::detail::task_timer
A class for scheduling functions to be called after a specific amount of ticks. A tick is equal to 1 ...
Definition: task_timer.h:17
crow::response::clear
void clear()
Definition: http_response.h:123
crow::Crow::get_middleware
T & get_middleware()
Definition: app.h:420
crow::response::static_file_info::statResult
int statResult
Definition: http_response.h:223
crow::mustache::load_text_unsafe
std::string load_text_unsafe(const std::string &filename)
Definition: mustache.h:701
crow::json::type::List
@ List
crow::HTTPParser::on_url
static int on_url(http_parser *self_, const char *at, size_t length)
Definition: parser.h:26
crow::HTTPMethod::SUBSCRIBE
@ SUBSCRIBE
crow::json::detail::r_string::s_
char * s_
Start.
Definition: json.h:172
crow::CONFLICT
@ CONFLICT
Definition: common.h:194
crow::RESET_CONTENT
@ RESET_CONTENT
Definition: common.h:177
crow::Crow::start_mutex_
std::mutex start_mutex_
Definition: app.h:466
crow::websocket::Connection::remaining_length_
uint64_t remaining_length_
Definition: websocket.h:622
crow::response::moved_perm
void moved_perm(const std::string &location)
Return a "Moved Permanently" response.
Definition: http_response.h:166
crow::response::complete_request_handler_
std::function< void()> complete_request_handler_
Definition: http_response.h:268
crow::HTTPMethod::Search
@ Search
crow::websocket::Connection::mini_header_
uint16_t mini_header_
Definition: websocket.h:627
crow::websocket::Connection::is_FIN
bool is_FIN()
Check if the FIN bit is set.
Definition: websocket.h:467
crow::Connection::complete_request
void complete_request()
Call the after handle middleware and send the write the response to the connection.
Definition: http_connection.h:203
crow::HTTPMethod::Notify
@ Notify
crow::mustache::template_t
A mustache template object.
Definition: mustache.h:73
crow::CookieParser::context::set_cookie
void set_cookie(const std::string &key, const std::string &value)
Definition: cookie_parser.h:46
crow::json::rvalue::rvalue
rvalue(type t) noexcept
Definition: json.h:232
crow::detail::routing_handler_call_helper::Wrapped::handler_type_helper< const request &, Args... >::type
std::function< void(const crow::request &, crow::response &, Args...)> type
Definition: routing.h:242
crow::json::rvalue::error
bool error() const
Definition: json.h:628
crow::detail::routing_handler_call_helper::Wrapped::handler_type_helper< ArgsWrapped... >::args_type
black_magic::S< typename black_magic::promote_t< Args >... > args_type
Definition: routing.h:236
crow::json::wvalue::operator=
wvalue & operator=(const char *str)
Definition: json.h:1541
crow::json::wvalue::operator=
wvalue & operator=(bool value)
Definition: json.h:1450
crow::HTTPMethod::SOURCE
@ SOURCE
crow::websocket::Connection::is_reading
bool is_reading
Definition: websocket.h:624
crow::HTTPMethod::SEARCH
@ SEARCH
crow::LogLevel
LogLevel
Definition: logging.h:14
crow::websocket::Connection::error_handler_
std::function< void(crow::websocket::connection &)> error_handler_
Definition: websocket.h:637
crow::multipart::mp_map
std::unordered_multimap< std::string, part, ci_hash, ci_key_eq > mp_map
Multipart map (key is the name parameter).
Definition: multipart.h:71
crow::TEMPORARY_REDIRECT
@ TEMPORARY_REDIRECT
Definition: common.h:185
crow::mustache::detail::get_global_template_base_directory_ref
std::string & get_global_template_base_directory_ref()
A base directory not related to any blueprint.
Definition: mustache.h:636
crow::json::rvalue::emplace_back
void emplace_back(rvalue &&v)
Definition: json.h:667
crow::tcp
asio::ip::tcp tcp
Definition: http_connection.h:25
crow::Crow::get_context
T::context & get_context(const request &req)
Definition: app.h:412
crow::Crow::run
void run()
Run the server.
Definition: app.h:277
crow::json::wvalue::operator=
wvalue & operator=(object &&value)
Definition: json.h:1630
crow::request::post
void post(CompletionHandler handler)
Send data to whoever made this request with a completion handler and return immediately.
Definition: http_request.h:67
crow::json::rvalue::rvalue
rvalue(type t, char *s, char *e) noexcept
Definition: json.h:236
crow::Crow::mw_container_t
std::tuple< Middlewares... > mw_container_t
Definition: app.h:410
crow::Trie::Node::children
std::vector< Node * > children
Definition: routing.h:638
crow::json::wvalue::operator=
wvalue & operator=(short value)
Definition: json.h:1478
crow::request::http_ver_minor
unsigned char http_ver_minor
Definition: http_request.h:33
crow::json::num_type::Signed_integer
@ Signed_integer
crow::Blueprint::static_dir_
std::string static_dir_
Definition: routing.h:1151
crow::BaseRule::validate
virtual void validate()=0
crow::websocket::Connection::do_read
void do_read()
Read a websocket message.
Definition: websocket.h:250
crow::websocket::Connection::get_remote_ip
std::string get_remote_ip() override
Definition: websocket.h:193
crow::detail::partial_context< Middlewares... >::partial
typename std::conditional< N==sizeof...(Middlewares) - 1, partial_context, typename parent_context::template partial< N > >::type partial
Definition: middleware_context.h:18
crow::RuleParameterTraits::methods
self_t & methods(HTTPMethod method, MethodArgs... args_method)
Definition: routing.h:471
crow::Crow::Crow
Crow()
Definition: app.h:58
crow::websocket::connection::userdata
void * userdata()
Definition: websocket.h:33
crow::Trie::debug_print
void debug_print()
Definition: routing.h:731
crow::CORSRules::methods
CORSRules & methods(crow::HTTPMethod method, Methods... method_list)
Set Access-Control-Allow-Methods. Default is "*".
Definition: cors.h:31
crow::detail::routing_handler_call_helper::call_pair::pos
static const int pos
Definition: routing.h:105
crow::json::wvalue::dump_string
void dump_string(const std::string &str, std::string &out) const
Definition: json.h:1755
crow::detail::wrapped_handler_call
std::enable_if< black_magic::is_callable< F, const crow::request, crow::response &, Args... >::value >::type wrapped_handler_call(crow::request &req, crow::response &res, const F &f, Args &&... args)
Definition: middleware.h:206
crow::Blueprint::operator=
Blueprint & operator=(const Blueprint &value)=delete
crow::BaseRule::custom_templates_base
std::string custom_templates_base
Definition: routing.h:78
crow::detail::middleware_call_helper
std::enable_if<(N< std::tuple_size< typename std::remove_reference< Container >::type >::value), bool >::type middleware_call_helper(Container &middlewares, request &req, response &res, Context &ctx)
Definition: middleware.h:127
crow::Connection::start
void start()
Definition: http_connection.h:80
crow::SocketAdaptor::raw_socket
tcp::socket & raw_socket()
Get the TCP socket handling data trasfers, regardless of what layer is handling transfers on top of t...
Definition: socket_adaptors.h:31
crow::Connection::~Connection
~Connection()
Definition: http_connection.h:64
crow::websocket::Connection::send_ping
void send_ping(const std::string &msg) override
Send a "Ping" message.
Definition: websocket.h:126
crow::detail::middleware_call_criteria_only_global
Definition: middleware.h:192
crow::HTTPMethod::Options
@ Options
crow::Router::validate_bp
void validate_bp(std::vector< Blueprint * > blueprints)
Definition: routing.h:1247
crow::websocket::connection::send_text
virtual void send_text(const std::string &msg)=0
crow::websocket::WebSocketReadState::Len64
@ Len64
crow::Crow::server_
std::unique_ptr< server_t > server_
Definition: app.h:460
crow::HTTPMethod::UNSUBSCRIBE
@ UNSUBSCRIBE
crow::HTTPMethod::Copy
@ Copy
crow::Router::Router
Router()
Definition: routing.h:1164
crow::websocket::Connection::close
void close(const std::string &msg) override
Send a close signal.
Definition: websocket.h:176
crow::multipart::get_header_value_object
const O & get_header_value_object(const T &headers, const std::string &key)
Find and return the value object associated with the key. (returns an empty class if nothing is found...
Definition: multipart.h:35
crow::TaggedRule::handle
void handle(request &req, response &res, const routing_params &params) override
Definition: routing.h:595
crow::response::response
response(std::string body)
Definition: http_response.h:68
crow::CORSRules::allow_credentials_
bool allow_credentials_
Definition: cors.h:121
crow::json::detail::r_string::size
size_t size() const
Definition: json.h:167
crow::response::response
response()
Definition: http_response.h:66
crow::returnable::content_type
std::string content_type
Definition: returnable.h:10
crow::multipart::message::headers
ci_map headers
The request/response headers.
Definition: multipart.h:76
crow::response::add_header
void add_header(std::string key, std::string value)
Add a new header to the response.
Definition: http_response.h:55
crow::detail::is_before_handle_arity_3_impl::value
static const bool value
Definition: middleware.h:76
crow::mustache::template_t::render_fragment
void render_fragment(const std::pair< int, int > fragment, int indent, std::string &out) const
Definition: mustache.h:343
crow::returnable
An abstract class that allows any other class to be returned by a handler.
Definition: returnable.h:8
crow::json::operator!=
bool operator!=(const rvalue &l, const std::string &r)
Definition: json.h:788
crow::multipart::message::parse_body
void parse_body(std::string body, std::vector< part > &sections, mp_map &part_map)
Definition: multipart.h:167
crow::BAD_REQUEST
@ BAD_REQUEST
Definition: common.h:188
crow::HTTPMethod::Connect
@ Connect
crow::Crow::ssl
self_t & ssl(T &&)
Definition: app.h:392
crow::Blueprint::new_rule_tagged
black_magic::arguments< N >::type::template rebind< TaggedRule > & new_rule_tagged(std::string &&rule)
Definition: routing.h:1101
crow::HTTPParser::headers
ci_map headers
Definition: parser.h:183
crow::json::rvalue::operator=
rvalue & operator=(const rvalue &r)
Definition: json.h:253
crow::websocket::WebSocketReadState::Len16
@ Len16
crow::response::manual_length_header
bool manual_length_header
Whether Crow should automatically add a "Content-Length" header.
Definition: http_response.h:45
crow::detail::routing_handler_call_helper::call_pair
Definition: routing.h:102
crow::json::get_type_str
const char * get_type_str(type t)
Definition: json.h:91
crow::json::rvalue::b
bool b() const
The boolean value.
Definition: json.h:388
crow::json::wvalue::wvalue
wvalue(std::uint8_t value)
Definition: json.h:1283
crow::crlf
const std::string crlf("\r\n")
crow::HTTPMethod::MERGE
@ MERGE
crow::request::method
HTTPMethod method
Definition: http_request.h:26
crow::Crow::route
auto route(std::string &&rule) -> typename std::result_of< decltype(&Router::new_rule_tagged< Tag >)(Router, std::string &&)>::type
Create a route using a rule (Use CROW_ROUTE instead)
Definition: app.h:88
crow::Blueprint::register_blueprint
void register_blueprint(Blueprint &blueprint)
Definition: routing.h:1114
crow::HTTPMethod::InternalMethodCount
@ InternalMethodCount
crow::Router::PerMethod::rules
std::vector< BaseRule * > rules
Definition: routing.h:1594
crow::CORSRules::methods
CORSRules & methods(crow::HTTPMethod method)
Set Access-Control-Allow-Methods. Default is "*".
Definition: cors.h:23
crow::json::rvalue::t
type t() const
The type of the JSON value.
Definition: json.h:321
crow::HTTPMethod::CHECKOUT
@ CHECKOUT
crow::CORSRules::origin_
std::string origin_
Definition: cors.h:117
crow::json::wvalue::operator=
wvalue & operator=(long long value)
Definition: json.h:1487
crow::ParamType::STRING
@ STRING
crow::Connection::res_body_copy_
std::string res_body_copy_
Definition: http_connection.h:616
crow::qs_strncmp
int qs_strncmp(const char *s, const char *qs, size_t n)
Definition: query_string.h:51
crow::json::wvalue::wvalue
wvalue(std::nullptr_t)
Definition: json.h:1277
crow::detail::task_timer::tasks_
std::map< identifier_type, std::pair< time_type, task_type > > tasks_
Definition: task_timer.h:126
crow::HTTPParser::on_header_value
static int on_header_value(http_parser *self_, const char *at, size_t length)
Definition: parser.h:51
crow::CookieParser::context
Definition: cookie_parser.h:33
crow::CORSRules::headers
CORSRules & headers(const std::string &header, Headers... header_list)
Set Access-Control-Allow-Headers. Default is "*".
Definition: cors.h:47
crow::json::wvalue::wvalue
wvalue(object const &value)
Definition: json.h:1317
crow::ci_hash
Hashing function for ci_map (unordered_multimap).
Definition: ci_map.h:10
crow::CORSHandler::find_rule
CORSRules & find_rule(const std::string &path)
Definition: cors.h:167
crow::json::rvalue::size
size_t size() const
Definition: json.h:548
crow::json::wvalue::dump_internal
void dump_internal(const wvalue &v, std::string &out) const
Definition: json.h:1762
crow::Router::PerMethod
Definition: routing.h:1592
crow::json::wvalue::wvalue
wvalue(std::int16_t value)
Definition: json.h:1294
crow::WebSocketRule::WebSocketRule
WebSocketRule(std::string rule)
Definition: routing.h:376
crow::detail::partial_context::get
T::context & get()
Definition: middleware_context.h:21
crow::HTTPParser::on_message_complete
static int on_message_complete(http_parser *self_)
Definition: parser.h:85
crow::Server::signals_
boost::asio::signal_set signals_
Definition: http_server.h:231
crow::Connection::task_id_
detail::task_timer::identifier_type task_id_
Definition: http_connection.h:618
crow::BaseRule::~BaseRule
virtual ~BaseRule()
Definition: routing.h:37
crow::Router::new_rule_tagged
black_magic::arguments< N >::type::template rebind< TaggedRule > & new_rule_tagged(const std::string &rule)
Definition: routing.h:1176
crow::UNAVAILABLE_FOR_LEGAL_REASONS
@ UNAVAILABLE_FOR_LEGAL_REASONS
Definition: common.h:202
crow::mustache::template_t::fragments_
std::vector< std::pair< int, int > > fragments_
Definition: mustache.h:618
crow::detail::task_timer::get_default_timeout
std::uint8_t get_default_timeout() const
Get the default timeout. (Default: 5)
Definition: task_timer.h:86
crow::response::operator=
response & operator=(response &&r) noexcept
Definition: http_response.h:107
crow::json::wvalue::keys
std::vector< std::string > keys() const
Definition: json.h:1684
crow::mustache::ActionType::ElseBlock
@ ElseBlock
crow::multipart::message::trim
std::string trim(std::string &string, const char &excess='"') const
Definition: multipart.h:251
crow::Router::catchall_rule_
CatchallRule catchall_rule_
Definition: routing.h:1590
crow::UNAUTHORIZED
@ UNAUTHORIZED
Definition: common.h:189
crow::Crow::debug_print
void debug_print()
Print the routing paths defined for each HTTP method.
Definition: app.h:334
crow::Server::timeout_
std::uint8_t timeout_
Definition: http_server.h:236
crow::CORSRules::allow_credentials
CORSRules & allow_credentials()
Enable Access-Control-Allow-Credentials.
Definition: cors.h:62
crow::Connection::handle
void handle()
Definition: http_connection.h:109
crow::json::wvalue::operator=
wvalue & operator=(std::initializer_list< std::pair< std::string const, wvalue >> initializer_list)
Definition: json.h:1592
crow::json::detail::r_string::iterator
const char * iterator
Definition: json.h:169
crow::RuleParameterTraits
Allows the user to assign parameters using functions.
Definition: routing.h:448
crow::websocket::Connection::message_handler_
std::function< void(crow::websocket::connection &, const std::string &, bool)> message_handler_
Definition: websocket.h:635
crow::MULTIPLE_CHOICES
@ MULTIPLE_CHOICES
Definition: common.h:180
crow::json::wvalue::operator=
wvalue & operator=(object const &value)
Definition: json.h:1611
crow::request::upgrade
bool upgrade
Definition: http_request.h:34
crow::Blueprint::static_dir
std::string static_dir() const
Definition: routing.h:1084
crow::json::wvalue::l
std::unique_ptr< list > l
Value if type is a list.
Definition: json.h:1269
crow::WebSocketRule::onerror
self_t & onerror(Func f)
Definition: routing.h:422
crow::mustache::template_t::tag_name
std::string tag_name(const Action &action) const
Definition: mustache.h:84
crow::Router::blueprints_
std::vector< Blueprint * > blueprints_
Definition: routing.h:1603
crow::json::wvalue::size
std::size_t size() const
If the wvalue is a list, it returns the length of the list, otherwise it returns 1.
Definition: json.h:1704
crow::qs_dict_name2kv
boost::optional< std::pair< std::string, std::string > > qs_dict_name2kv(const char *dict_name, char *const *qs_kv, int qs_kv_size, int nth=0)
Definition: query_string.h:202
crow::json::rvalue::rvalue
rvalue() noexcept
Definition: json.h:228
crow::Crow::tick_interval_
std::chrono::milliseconds tick_interval_
Definition: app.h:449
crow::HTTPMethod::Trace
@ Trace
crow::Crow::run_async
std::future< void > run_async()
Non-blocking version of run()
Definition: app.h:311
crow::detail::routing_handler_call_helper::call_params::req
request & req
Definition: routing.h:113
crow::Connection::do_write_static
void do_write_static()
Definition: http_connection.h:385
crow::FORBIDDEN
@ FORBIDDEN
Definition: common.h:190
crow::LogLevel::WARNING
@ WARNING
crow::response::end
void end()
Set the response completion flag and call the handler (to send the response).
Definition: http_response.h:178
crow::multipart::message
The parsed multipart request/response.
Definition: multipart.h:74
crow::status
status
Definition: common.h:167
crow::websocket::connection::send_pong
virtual void send_pong(const std::string &msg)=0
crow::logger::setLogLevel
static void setLogLevel(LogLevel level)
Definition: logging.h:123
crow::Trie::optimizeNode
void optimizeNode(Node *node)
Definition: routing.h:672
crow::mustache::invalid_template_exception
Definition: mustache.h:20
crow::qs_scanvalue
char * qs_scanvalue(const char *key, const char *qs, char *val, size_t val_len)
Definition: query_string.h:245
crow::OK
@ OK
Definition: common.h:172
crow::Blueprint
A blueprint can be considered a smaller section of a Crow app, specifically where the router is conec...
Definition: routing.h:1029
crow::json::wvalue::number::number
constexpr number(std::uint64_t value) noexcept
Definition: json.h:1261
crow::json::rvalue::u
uint64_t u() const
The unsigned integer value.
Definition: json.h:362
crow::json::wvalue::wvalue
wvalue(const list &r)
Definition: json.h:1322
crow::CORSRules::prefix
CORSRules & prefix(const std::string &prefix)
Handle CORS on specific prefix path.
Definition: cors.h:185
crow::json::rvalue::nt
num_type nt() const
The number type of the JSON value.
Definition: json.h:333
crow::query_string::operator<<
friend std::ostream & operator<<(std::ostream &os, const query_string &qs)
Definition: query_string.h:352
crow::multipart::part::body
std::string body
The actual data in the part.
Definition: multipart.h:59
crow::Server::handler_
Handler * handler_
Definition: http_server.h:234
crow::HTTPMethod::Bind
@ Bind
crow::json::wvalue::wvalue
wvalue(std::initializer_list< std::pair< std::string const, wvalue >> initializer_list)
Definition: json.h:1314
crow::json::detail::r_string
A read string implementation with comparison functionality.
Definition: json.h:120
crow::HTTPMethod::LOCK
@ LOCK
crow::BaseRule::rule_to_upgrade_
std::unique_ptr< BaseRule > rule_to_upgrade_
Definition: routing.h:88
crow::HTTPMethod
HTTPMethod
Definition: common.h:15
crow::websocket::Connection::send_pong
void send_pong(const std::string &msg) override
Send a "Pong" message.
Definition: websocket.h:140
crow::HTTPMethod::Delete
@ Delete
crow::HTTPParser::process_header
void process_header()
Definition: parser.h:146
crow::json::detail::r_string::operator=
r_string & operator=(const r_string &r)
Definition: json.h:151
crow::detail::routing_handler_call_helper::Wrapped::set_
void set_(Func f, typename std::enable_if< std::is_same< typename std::tuple_element< 0, std::tuple< Args..., void >>::type, const request & >::value &&std::is_same< typename std::tuple_element< 1, std::tuple< Args..., void, void >>::type, response & >::value, int >::type=0)
Definition: routing.h:224
crow::ACCEPTED
@ ACCEPTED
Definition: common.h:174
crow::mustache::ActionType::Tag
@ Tag
crow::multipart::message::part_map
mp_map part_map
The individual parts of the message, organized in a map with the name header parameter being the key.
Definition: multipart.h:79
crow::detail::routing_handler_call_helper::call< F, NInt, NUint, NDouble, NString, black_magic::S<>, black_magic::S< Args1... > >::operator()
void operator()(F cparams)
Definition: routing.h:164
crow::detail::routing_handler_call_helper::Wrapped::handler_type_helper
Definition: routing.h:233
crow::request::check_version
bool check_version(unsigned char major, unsigned char minor) const
Definition: http_request.h:60
crow::Server::tick_interval_
std::chrono::milliseconds tick_interval_
Definition: http_server.h:242
crow::CORSHandler::context
Definition: cors.h:134
crow::multipart::message::get_header_value
const std::string & get_header_value(const std::string &key) const
Definition: multipart.h:81
crow::BaseRule::handle
virtual void handle(request &, response &, const routing_params &)=0
crow::websocket::Connection::send_binary
void send_binary(const std::string &msg) override
Send a binary encoded message.
Definition: websocket.h:151
crow::CORSRules::origin
CORSRules & origin(const std::string &origin)
Set Access-Control-Allow-Origin. Default is "*".
Definition: cors.h:16
crow::Crow::port
std::uint16_t port()
Get the port that Crow will handle requests on.
Definition: app.h:125
crow::VERSION
constexpr const char VERSION[]
Definition: version.h:5
crow::Blueprint::prefix
std::string prefix() const
Definition: routing.h:1079
crow::json::wvalue::wvalue
wvalue(const rvalue &r)
Create a write value from a read value (useful for editing JSON strings).
Definition: json.h:1342
crow::Router::blueprints
std::vector< Blueprint * > & blueprints()
Definition: routing.h:1584
crow::method_name
std::string method_name(HTTPMethod method)
Definition: common.h:156
crow::detail::routing_handler_call_helper::Wrapped::req_handler_wrapper::req_handler_wrapper
req_handler_wrapper(Func f)
Definition: routing.h:194
crow::MOVED_PERMANENTLY
@ MOVED_PERMANENTLY
Definition: common.h:181
crow::Router::get_error
std::string get_error(unsigned short code, std::tuple< uint16_t, std::vector< uint16_t >, routing_params > &found, const request &req, response &res)
Is used to handle errors, you insert the error code, found route, request, and response....
Definition: routing.h:1415
crow::query_string::operator=
query_string & operator=(const query_string &qs)
Definition: query_string.h:310
crow::Crow::concurrency
self_t & concurrency(std::uint16_t concurrency)
Run the server on multiple threads using a specific number.
Definition: app.h:159
crow::TaggedRule::middlewares
crow::detail::handler_call_bridge< TaggedRule< Args... >, App, Middlewares... > middlewares()
Enable local middleware for this handler.
Definition: routing.h:613
crow::LogLevel::Warning
@ Warning
crow::mustache::detail::get_template_base_directory_ref
std::string & get_template_base_directory_ref()
Definition: mustache.h:629
crow::BaseRule::upgrade
std::unique_ptr< BaseRule > upgrade()
Definition: routing.h:41
crow::Connection::task_timer_
detail::task_timer & task_timer_
Definition: http_connection.h:630
crow::json::num_type::Null
@ Null
crow::Crow::register_blueprint
self_t & register_blueprint(Blueprint &blueprint)
Definition: app.h:198
crow::Blueprint::new_rule_dynamic
DynamicRule & new_rule_dynamic(std::string &&rule)
Definition: routing.h:1089
crow::HTTPMethod::Subscribe
@ Subscribe
crow::json::rvalue::lsize_
uint32_t lsize_
Definition: json.h:712
crow::METHOD_NOT_ALLOWED
@ METHOD_NOT_ALLOWED
Definition: common.h:192
crow::Blueprint::apply_blueprint
void apply_blueprint(Blueprint &blueprint)
Definition: routing.h:1132
crow::json::wvalue::operator=
wvalue & operator=(const std::vector< T > &v)
Definition: json.h:1575
crow::Server::stop
void stop()
Definition: http_server.h:162
crow::json::rvalue::operator[]
const rvalue & operator[](const char *str) const
Definition: json.h:581
crow::json::rvalue
JSON read value.
Definition: json.h:222
crow::TaggedRule
Default rule created when CROW_ROUTE is called.
Definition: routing.h:557
crow::json::wvalue::wvalue
wvalue(const wvalue &r)
Definition: json.h:1379
crow::Crow::tick_function_
std::function< void()> tick_function_
Definition: app.h:450
crow::Blueprint::operator!=
bool operator!=(const Blueprint &value)
Definition: routing.h:1074
crow::mustache::template_t::actions_
std::vector< Action > actions_
Definition: mustache.h:619
crow::detail::after_handlers_call_helper
std::enable_if<(N< 0)>::type after_handlers_call_helper(Container &, Context &, request &, response &)
Definition: middleware.h:163
crow::HTTPParser::on_message_begin
static int on_message_begin(http_parser *self_)
Definition: parser.h:20
crow::detail::middleware_call_criteria_only_global::f
static std::false_type f(typename check_global_call_false< MW >::template get< C > *)
crow::TaggedRule::handler_
std::function< void(crow::request &, crow::response &, Args...)> handler_
Definition: routing.h:621
crow::websocket::Connection::opcode
int opcode()
Extract the opcode from the header.
Definition: websocket.h:473
crow::LogLevel::DEBUG
@ DEBUG
crow::detail::routing_handler_call_helper::call
Definition: routing.h:118
crow::query_string::keys
std::vector< std::string > keys() const
Definition: query_string.h:472
crow::detail::routing_handler_call_helper::Wrapped::req_handler_wrapper
Definition: routing.h:192
crow::Crow::ssl_file
self_t & ssl_file(T &&, Remain &&...)
Definition: app.h:381
crow::Blueprint::catchall_rule
CatchallRule & catchall_rule()
Definition: routing.h:1126
crow::CORSHandler::after_handle
void after_handle(crow::request &req, crow::response &res, context &)
Definition: cors.h:140
crow::Trie::new_node
Node * new_node(Node *parent)
Definition: routing.h:1012
crow::PAYLOAD_TOO_LARGE
@ PAYLOAD_TOO_LARGE
Definition: common.h:196
crow::response::set_header
void set_header(std::string key, std::string value)
Set the value of an existing header in the response.
Definition: http_response.h:48
crow::detail::after_handler_call
std::enable_if<!is_after_handle_arity_3_impl< MW >::value >::type after_handler_call(MW &mw, request &req, response &res, Context &ctx, ParentContext &)
Definition: middleware.h:111
crow::logger::~logger
~logger()
Definition: logging.h:99
crow::HTTPParser::raw_url
std::string raw_url
Definition: parser.h:177
crow::detail::check_before_handle_arity_3_const
Definition: middleware.h:24
crow::CORSRules::max_age_
std::string max_age_
Definition: cors.h:120
crow::response::body
std::string body
The actual payload containing the response data.
Definition: http_response.h:38
crow::Connection::handler_
Handler * handler_
Definition: http_connection.h:601
crow::Crow::signals_
std::vector< int > signals_
Definition: app.h:462