| http_context.h | | http_context.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| // | | // | |
| ///////////////////////////////////////////////////////////////////////////
//// | | ///////////////////////////////////////////////////////////////////////////
//// | |
| #ifndef CPPCMS_HTTP_CONTEXT_H | | #ifndef CPPCMS_HTTP_CONTEXT_H | |
| #define CPPCMS_HTTP_CONTEXT_H | | #define CPPCMS_HTTP_CONTEXT_H | |
| | | | |
| #include <cppcms/defs.h> | | #include <cppcms/defs.h> | |
| #include <booster/hold_ptr.h> | | #include <booster/hold_ptr.h> | |
| #include <booster/intrusive_ptr.h> | | #include <booster/intrusive_ptr.h> | |
| #include <booster/shared_ptr.h> | | #include <booster/shared_ptr.h> | |
| #include <booster/enable_shared_from_this.h> | | #include <booster/enable_shared_from_this.h> | |
|
| #include <booster/function.h> | | #include <booster/callback.h> | |
| #include <locale> | | #include <locale> | |
| | | | |
| namespace cppcms { | | namespace cppcms { | |
| | | | |
| class service; | | class service; | |
| class application; | | class application; | |
| class cache_interface; | | class cache_interface; | |
| class session_interface; | | class session_interface; | |
| namespace json { class value; } | | namespace json { class value; } | |
| namespace impl { namespace cgi { class connection; } } | | namespace impl { namespace cgi { class connection; } } | |
| | | | |
| skipping to change at line 137 | | skipping to change at line 137 | |
| /// | | /// | |
| /// Set current views skin name | | /// Set current views skin name | |
| /// | | /// | |
| void skin(std::string const &name); | | void skin(std::string const &name); | |
| | | | |
| typedef enum { | | typedef enum { | |
| operation_completed, ///< Asynchronous opera
tion completed successfully | | operation_completed, ///< Asynchronous opera
tion completed successfully | |
| operation_aborted ///< Asynchronous opera
tion was canceled | | operation_aborted ///< Asynchronous opera
tion was canceled | |
| } complition_type; | | } complition_type; | |
| | | | |
|
| typedef booster::function<void(complition_type)> han | | typedef booster::callback<void(complition_type)> han | |
| dler; | | dler; | |
| | | | |
| | | /// | |
| | | /// Send all pending output data to the client and | |
| | | /// finalize the connection. Note, you can't use thi | |
| | | s | |
| | | /// object for communication any more. | |
| | | /// | |
| | | void complete_response(); | |
| | | | |
| /// | | /// | |
| /// Send all pending output data to the client and | | /// Send all pending output data to the client and | |
| /// finalize the connection. Note, you can't use thi
s | | /// finalize the connection. Note, you can't use thi
s | |
| /// object for communication any more. | | /// object for communication any more. | |
| /// | | /// | |
| void async_complete_response(); | | void async_complete_response(); | |
| | | | |
| /// | | /// | |
| /// Send all pending data to user, when operation is
complete | | /// Send all pending data to user, when operation is
complete | |
| | | | |
| skipping to change at line 167 | | skipping to change at line 174 | |
| /// Set handler for peer reset events. It is useful
to cleanup | | /// Set handler for peer reset events. It is useful
to cleanup | |
| /// connections that had timeout or just disconnecte
d by user | | /// connections that had timeout or just disconnecte
d by user | |
| /// | | /// | |
| /// Notes: | | /// Notes: | |
| /// | | /// | |
| /// -# if async_complete_response was called, handle
r would not | | /// -# if async_complete_response was called, handle
r would not | |
| /// be called any more. | | /// be called any more. | |
| /// -# If async_flush_output fails, this does not me
an that | | /// -# If async_flush_output fails, this does not me
an that | |
| /// this handler would be called as well, so you
need to check both | | /// this handler would be called as well, so you
need to check both | |
| /// | | /// | |
|
| void async_on_peer_reset(booster::function<void()> c
onst &h); | | void async_on_peer_reset(booster::callback<void()> c
onst &h); | |
| private: | | private: | |
| void on_request_ready(bool error); | | void on_request_ready(bool error); | |
| static void dispatch(booster::intrusive_ptr<applicat
ion> app,std::string url,bool syncronous); | | static void dispatch(booster::intrusive_ptr<applicat
ion> app,std::string url,bool syncronous); | |
| void try_restart(bool e); | | void try_restart(bool e); | |
| booster::shared_ptr<context> self(); | | booster::shared_ptr<context> self(); | |
| | | | |
| struct _data; | | struct _data; | |
| booster::hold_ptr<_data> d; | | booster::hold_ptr<_data> d; | |
| booster::shared_ptr<impl::cgi::connection> conn_; | | booster::shared_ptr<impl::cgi::connection> conn_; | |
| }; | | }; | |
| | | | |
End of changes. 3 change blocks. |
| 4 lines changed or deleted | | 12 lines changed or added | |
|
| io_service.h | | io_service.h | |
| | | | |
| skipping to change at line 17 | | skipping to change at line 17 | |
| // | | // | |
| #ifndef BOOSTER_AIO_IO_SERVICE_H | | #ifndef BOOSTER_AIO_IO_SERVICE_H | |
| #define BOOSTER_AIO_IO_SERVICE_H | | #define BOOSTER_AIO_IO_SERVICE_H | |
| | | | |
| #include <booster/config.h> | | #include <booster/config.h> | |
| #include <booster/aio/aio_config.h> | | #include <booster/aio/aio_config.h> | |
| #include <booster/aio/types.h> | | #include <booster/aio/types.h> | |
| #include <booster/thread.h> | | #include <booster/thread.h> | |
| #include <booster/system_error.h> | | #include <booster/system_error.h> | |
| #include <booster/aio/aio_category.h> | | #include <booster/aio/aio_category.h> | |
|
| #include <booster/function.h> | | #include <booster/callback.h> | |
| #include <booster/noncopyable.h> | | #include <booster/noncopyable.h> | |
| #include <string> | | #include <string> | |
| #include <memory> | | #include <memory> | |
| | | | |
| namespace booster { | | namespace booster { | |
| class ptime; | | class ptime; | |
| namespace aio { | | namespace aio { | |
| | | | |
|
| typedef function<void(system::error_code const &e,int fd)> accept_ha
ndler; | | typedef callback<void(system::error_code const &e,int fd)> accept_ha
ndler; | |
| class event_loop_impl; | | class event_loop_impl; | |
| class BOOSTER_API io_service : public noncopyable { | | class BOOSTER_API io_service : public noncopyable { | |
| public: | | public: | |
| | | | |
| static const int in = 1 << 0; | | static const int in = 1 << 0; | |
| static const int out = 1 << 1; | | static const int out = 1 << 1; | |
| | | | |
| io_service(int reactor_type); | | io_service(int reactor_type); | |
| io_service(); | | io_service(); | |
| ~io_service(); | | ~io_service(); | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| json.h | | json.h | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| #define CPPCMS_JSON_H | | #define CPPCMS_JSON_H | |
| | | | |
| #include <cppcms/defs.h> | | #include <cppcms/defs.h> | |
| #include <booster/copy_ptr.h> | | #include <booster/copy_ptr.h> | |
| | | | |
| #include <vector> | | #include <vector> | |
| #include <map> | | #include <map> | |
| #include <string> | | #include <string> | |
| #include <iostream> | | #include <iostream> | |
| #include <typeinfo> | | #include <typeinfo> | |
|
| | | #include <limits> | |
| | | | |
| namespace cppcms { | | namespace cppcms { | |
| /// | | /// | |
| /// \brief This namespace includes all JSON parsing and formatting related
classes and functions | | /// \brief This namespace includes all JSON parsing and formatting related
classes and functions | |
| /// | | /// | |
| namespace json { | | namespace json { | |
| | | | |
| class value; | | class value; | |
| | | | |
| /// | | /// | |
| | | | |
| skipping to change at line 541 | | skipping to change at line 542 | |
| }; | | }; | |
| | | | |
| CPPCMS_JSON_SPECIALIZE(bool,boolean); | | CPPCMS_JSON_SPECIALIZE(bool,boolean); | |
| CPPCMS_JSON_SPECIALIZE(double,number); | | CPPCMS_JSON_SPECIALIZE(double,number); | |
| CPPCMS_JSON_SPECIALIZE(std::string,str); | | CPPCMS_JSON_SPECIALIZE(std::string,str); | |
| CPPCMS_JSON_SPECIALIZE(json::object,object); | | CPPCMS_JSON_SPECIALIZE(json::object,object); | |
| CPPCMS_JSON_SPECIALIZE(json::array,array); | | CPPCMS_JSON_SPECIALIZE(json::array,array); | |
| | | | |
| #undef CPPCMS_JSON_SPECIALIZE | | #undef CPPCMS_JSON_SPECIALIZE | |
| | | | |
|
| | | #define CPPCMS_JSON_SPECIALIZE_INT(type) \ | |
| | | template<> \ | |
| | | struct traits<type> { \ | |
| | | static type get(value const &v) \ | |
| | | { \ | |
| | | type res=static_cast<type>(v.number()); \ | |
| | | if(res!=v.number()) \ | |
| | | throw bad_value_cast(); \ | |
| | | return res; \ | |
| | | } \ | |
| | | static void set(value &v,type const &in) \ | |
| | | { \ | |
| | | if(std::numeric_limits<type>::digits > \ | |
| | | std::numeric_limits<double>::digits \ | |
| | | && static_cast<double>(in)!=in) \ | |
| | | { \ | |
| | | throw bad_value_cast(); \ | |
| | | } \ | |
| | | v.number(static_cast<double>(in)); \ | |
| | | } \ | |
| | | }; | |
| | | | |
| | | CPPCMS_JSON_SPECIALIZE_INT(char) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(unsigned char) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(signed char) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(wchar_t) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(short) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(unsigned short) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(int) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(unsigned int) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(long) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(unsigned long) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(long long) | |
| | | CPPCMS_JSON_SPECIALIZE_INT(unsigned long long) | |
| | | | |
| | | #undef CPPCMS_JSON_SPECIALIZE_INT | |
| | | | |
| template<> | | template<> | |
|
| struct traits<int> { | | struct traits<float> { | |
| static int get(value const &v) | | static float get(value const &v) | |
| { | | { | |
|
| return static_cast<int>(v.number()); | | double r=v.number(); | |
| | | if( r < std::numeric_limits<float>::min() | |
| | | || std::numeric_limits<float>::max() < r ) | |
| | | { | |
| | | throw bad_value_cast(); | |
| | | } | |
| | | return static_cast<float>(r); | |
| } | | } | |
|
| static void set(value &v,int const &in) | | static void set(value &v,float const &in) | |
| { | | { | |
| v.number(in); | | v.number(in); | |
| } | | } | |
| }; | | }; | |
|
| | | | |
| | | template<> | |
| | | struct traits<long double> { | |
| | | static long double get(value const &v) | |
| | | { | |
| | | return v.number(); | |
| | | } | |
| | | static void set(value &v,long double const &in) | |
| | | { | |
| | | if( in < std::numeric_limits<double>::min() | |
| | | || std::numeric_limits<double>::max() < in ) | |
| | | { | |
| | | throw bad_value_cast(); | |
| | | } | |
| | | v.number(static_cast<double>(in)); | |
| | | } | |
| | | }; | |
| | | | |
| template<> | | template<> | |
| struct traits<json::null> { | | struct traits<json::null> { | |
| static void set(value &v,json::null const &in) | | static void set(value &v,json::null const &in) | |
| { | | { | |
| v.null(); | | v.null(); | |
| } | | } | |
| }; | | }; | |
| | | | |
| template<int n> | | template<int n> | |
| struct traits<char[n]> { | | struct traits<char[n]> { | |
| | | | |
End of changes. 6 change blocks. |
| 4 lines changed or deleted | | 66 lines changed or added | |
|
| service.h | | service.h | |
| | | | |
| skipping to change at line 41 | | skipping to change at line 41 | |
| namespace aio { | | namespace aio { | |
| class io_service; | | class io_service; | |
| } | | } | |
| } | | } | |
| | | | |
| /// | | /// | |
| /// \brief This is the namespace where all CppCMS functionality is placed | | /// \brief This is the namespace where all CppCMS functionality is placed | |
| /// | | /// | |
| namespace cppcms { | | namespace cppcms { | |
| namespace impl { | | namespace impl { | |
|
| | | struct cached_settings; | |
| class service; | | class service; | |
| namespace cgi { | | namespace cgi { | |
| class acceptor; | | class acceptor; | |
| } | | } | |
| } | | } | |
| | | | |
| class applications_pool; | | class applications_pool; | |
| class thread_pool; | | class thread_pool; | |
| class session_pool; | | class session_pool; | |
| class cache_pool; | | class cache_pool; | |
| | | | |
| skipping to change at line 190 | | skipping to change at line 191 | |
| /// | | /// | |
| /// So if an application want to run certain activity that c
an't be executed in multiple processes it can setup an after_fork | | /// So if an application want to run certain activity that c
an't be executed in multiple processes it can setup an after_fork | |
| /// handle that would check the process id and start this ac
tivity. | | /// handle that would check the process id and start this ac
tivity. | |
| /// | | /// | |
| /// Under Windows and Cygwin it is always 0. | | /// Under Windows and Cygwin it is always 0. | |
| /// | | /// | |
| int process_id(); | | int process_id(); | |
| | | | |
| /// \cond INTERNAL | | /// \cond INTERNAL | |
| cppcms::impl::service &impl(); | | cppcms::impl::service &impl(); | |
|
| | | | |
| | | impl::cached_settings const &cached_settings(); | |
| /// \endcond | | /// \endcond | |
| | | | |
| private: | | private: | |
| void setup(); | | void setup(); | |
| void setup_logging(); | | void setup_logging(); | |
| std::auto_ptr<cppcms::impl::cgi::acceptor> setup_acceptor(js
on::value const &,int,int shift=0); | | std::auto_ptr<cppcms::impl::cgi::acceptor> setup_acceptor(js
on::value const &,int,int shift=0); | |
| void load_settings(int argc,char *argv[]); | | void load_settings(int argc,char *argv[]); | |
| void stop(); | | void stop(); | |
| void start_acceptor(bool after_fork=false); | | void start_acceptor(bool after_fork=false); | |
| void setup_exit_handling(); | | void setup_exit_handling(); | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 3 lines changed or added | |
|
| socket.h | | socket.h | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| // Copyright (c) 2010 Artyom Beilis (Tonkikh) | | // Copyright (c) 2010 Artyom Beilis (Tonkikh) | |
| // | | // | |
| // Distributed under the Boost Software License, Version 1.0. (See | | // Distributed under the Boost Software License, Version 1.0. (See | |
| // accompanying file LICENSE_1_0.txt or copy at | | // accompanying file LICENSE_1_0.txt or copy at | |
| // http://www.boost.org/LICENSE_1_0.txt) | | // http://www.boost.org/LICENSE_1_0.txt) | |
| // | | // | |
| #ifndef BOOSTER_AIO_SOCKET_H | | #ifndef BOOSTER_AIO_SOCKET_H | |
| #define BOOSTER_AIO_SOCKET_H | | #define BOOSTER_AIO_SOCKET_H | |
| | | | |
| #include <booster/aio/types.h> | | #include <booster/aio/types.h> | |
|
| #include <booster/function.h> | | #include <booster/callback.h> | |
| #include <booster/hold_ptr.h> | | #include <booster/hold_ptr.h> | |
| #include <booster/noncopyable.h> | | #include <booster/noncopyable.h> | |
| #include <booster/aio/endpoint.h> | | #include <booster/aio/endpoint.h> | |
| | | | |
| namespace booster { | | namespace booster { | |
| namespace aio { | | namespace aio { | |
| class mutable_buffer; | | class mutable_buffer; | |
| class const_buffer; | | class const_buffer; | |
| class io_service; | | class io_service; | |
| class endpoint; | | class endpoint; | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| types.h | | types.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| // http://www.boost.org/LICENSE_1_0.txt) | | // http://www.boost.org/LICENSE_1_0.txt) | |
| // | | // | |
| #ifndef BOOSTER_AIO_TYPES_H | | #ifndef BOOSTER_AIO_TYPES_H | |
| #define BOOSTER_AIO_TYPES_H | | #define BOOSTER_AIO_TYPES_H | |
| | | | |
| #include <booster/config.h> | | #include <booster/config.h> | |
| #include <string.h> | | #include <string.h> | |
| | | | |
| namespace booster { | | namespace booster { | |
| template<typename F> | | template<typename F> | |
|
| class function; | | class callback; | |
| | | | |
| namespace system { | | namespace system { | |
| class error_code; | | class error_code; | |
| } | | } | |
| | | | |
| /// | | /// | |
| /// \brief This namespace povides and API to asynchronous sockets AP
I | | /// \brief This namespace povides and API to asynchronous sockets AP
I | |
| /// | | /// | |
| namespace aio { | | namespace aio { | |
| class endpoint; | | class endpoint; | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| class io_service; | | class io_service; | |
| | | | |
| #ifdef BOOSTER_WIN32 | | #ifdef BOOSTER_WIN32 | |
| typedef unsigned native_type; | | typedef unsigned native_type; | |
| static const unsigned invalid_socket = (unsigned)(-1); | | static const unsigned invalid_socket = (unsigned)(-1); | |
| #else | | #else | |
| typedef int native_type; | | typedef int native_type; | |
| static const int invalid_socket = -1; | | static const int invalid_socket = -1; | |
| #endif | | #endif | |
| | | | |
|
| typedef function<void(system::error_code const &)> event_han | | typedef callback<void(system::error_code const &)> event_han | |
| dler; | | dler; | |
| typedef function<void()> handler; | | typedef callback<void()> handler; | |
| typedef function<void(system::error_code const &,size_t)> io | | typedef callback<void(system::error_code const &,size_t)> io | |
| _handler; | | _handler; | |
| | | | |
| typedef enum { | | typedef enum { | |
| pf_unix, | | pf_unix, | |
| pf_inet, | | pf_inet, | |
| pf_inet6 | | pf_inet6 | |
| } family_type; | | } family_type; | |
| | | | |
| typedef enum { | | typedef enum { | |
| sock_stream, | | sock_stream, | |
| sock_datagram | | sock_datagram | |
| | | | |
End of changes. 2 change blocks. |
| 6 lines changed or deleted | | 6 lines changed or added | |
|