applications_pool.h   applications_pool.h 
skipping to change at line 101 skipping to change at line 101
/// Mount an asynchronous application \a app by mount_point \a point application matching and /// Mount an asynchronous application \a app by mount_point \a point application matching and
/// URL selection rules /// URL selection rules
/// ///
/// This member function is thread safe. /// This member function is thread safe.
/// ///
void mount(booster::intrusive_ptr<application> app,mount_poi nt const &point); void mount(booster::intrusive_ptr<application> app,mount_poi nt const &point);
/// \cond INTERNAL /// \cond INTERNAL
booster::intrusive_ptr<application> booster::intrusive_ptr<application>
get(std::string const &h,std::string const &s,std::string co nst &path_info,std::string &match); get(char const *h,char const *s,char const *path_info,std::s tring &match);
void put(application *app); void put(application *app);
applications_pool(service &srv,int pool_size_limit); applications_pool(service &srv,int pool_size_limit);
~applications_pool(); ~applications_pool();
/// \endcond /// \endcond
private: private:
struct basic_app_data; struct basic_app_data;
struct app_data; struct app_data;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 base64.h   base64.h 
skipping to change at line 24 skipping to change at line 24
// //
// You should have received a copy of the GNU Lesser General Public Licens e // You should have received a copy of the GNU Lesser General Public Licens e
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
/////////////////////////////////////////////////////////////////////////// //// /////////////////////////////////////////////////////////////////////////// ////
#ifndef CPPCMS_BASE64_H #ifndef CPPCMS_BASE64_H
#define CPPCMS_BASE64_H #define CPPCMS_BASE64_H
#include <cppcms/defs.h> #include <cppcms/defs.h>
#include <string> #include <string>
#include <iosfwd>
namespace cppcms { namespace cppcms {
/// ///
/// \brief this namespace provides functions useful for modified Bas e64 encoding for URL. /// \brief this namespace provides functions useful for modified Bas e64 encoding for URL.
/// This encoding does not insert newline characters, do not pad the text with = character and /// This encoding does not insert newline characters, do not pad the text with = character and
/// use "_" and "-" instead of "+" and "/" characters reserved by UR L format for special purposes. /// use "_" and "-" instead of "+" and "/" characters reserved by UR L format for special purposes.
/// ///
namespace b64url { namespace b64url {
/// ///
skipping to change at line 51 skipping to change at line 52
/// ///
int CPPCMS_API decoded_size(size_t s); int CPPCMS_API decoded_size(size_t s);
/// ///
/// Perform base64 URL encoding of the binary data in range [\a begi n,\a end), and store it to output buffer /// Perform base64 URL encoding of the binary data in range [\a begi n,\a end), and store it to output buffer
/// \a target. The size of target storage should have a capacity cal culated with encoded_size(end-begin). /// \a target. The size of target storage should have a capacity cal culated with encoded_size(end-begin).
/// ///
/// Pointer to the first character directly after text string ends i s returned. /// Pointer to the first character directly after text string ends i s returned.
/// ///
unsigned char CPPCMS_API *encode(unsigned char const *begin,unsigned char const *end,unsigned char *target); unsigned char CPPCMS_API *encode(unsigned char const *begin,unsigned char const *end,unsigned char *target);
///
/// Perform base64 URL encoding of the binary data in range [\a begi
n,\a end), and write it to output stream
///
void encode(unsigned char const *begin,unsigned char const *end,std:
:ostream &output);
/// ///
/// Perform base64 URL decoding of the binary data in range [\a begi n,\a end), and store it to output buffer /// Perform base64 URL decoding of the binary data in range [\a begi n,\a end), and store it to output buffer
/// \a target. The size of target storage should have a capacity cal culated with encoded_size(end-begin). /// \a target. The size of target storage should have a capacity cal culated with encoded_size(end-begin).
/// ///
/// Pointer to the first character directly after text string ends i s returned. Invalid codes are substituted /// Pointer to the first character directly after text string ends i s returned. Invalid codes are substituted
/// by 0 values. /// by 0 values.
/// ///
/// ///
unsigned char CPPCMS_API *decode(unsigned char const *begin,unsigned char const *end,unsigned char *target); unsigned char CPPCMS_API *decode(unsigned char const *begin,unsigned char const *end,unsigned char *target);
 End of changes. 2 change blocks. 
0 lines changed or deleted 7 lines changed or added


 cache_pool.h   cache_pool.h 
skipping to change at line 26 skipping to change at line 26
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
/////////////////////////////////////////////////////////////////////////// //// /////////////////////////////////////////////////////////////////////////// ////
#ifndef CPPCMS_CACHE_POOL_H #ifndef CPPCMS_CACHE_POOL_H
#define CPPCMS_CACHE_POOL_H #define CPPCMS_CACHE_POOL_H
#include <cppcms/defs.h> #include <cppcms/defs.h>
#include <booster/noncopyable.h> #include <booster/noncopyable.h>
#include <booster/intrusive_ptr.h> #include <booster/intrusive_ptr.h>
#include <booster/hold_ptr.h> #include <booster/hold_ptr.h>
#include <cppcms/base_cache_fwd.h>
namespace cppcms { namespace cppcms {
namespace json { class value; } namespace json { class value; }
namespace impl { class base_cache; } namespace impl { class base_cache; }
/// \cond INTERNAL /// \cond INTERNAL
class CPPCMS_API cache_pool { class CPPCMS_API cache_pool {
public: public:
cache_pool(json::value const &settings); cache_pool(json::value const &settings);
~cache_pool(); ~cache_pool();
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 filters.h   filters.h 
skipping to change at line 187 skipping to change at line 187
struct _data; struct _data;
booster::copy_ptr<_data> d; booster::copy_ptr<_data> d;
}; };
inline std::ostream &operator<<(std::ostream &out,to_lower c onst &obj) inline std::ostream &operator<<(std::ostream &out,to_lower c onst &obj)
{ {
obj(out); obj(out);
return out; return out;
} }
#ifndef CPPCMS_DISABLE_ICU_LOCALIZATION
/// ///
/// \brief Output filter to_title /// \brief Output filter to_title
/// ///
/// Convert text to title case according to locale /// Convert text to title case according to locale
/// ///
class CPPCMS_API to_title { class CPPCMS_API to_title {
public: public:
to_title(); to_title();
~to_title(); ~to_title();
skipping to change at line 216 skipping to change at line 214
struct _data; struct _data;
booster::copy_ptr<_data> d; booster::copy_ptr<_data> d;
}; };
inline std::ostream &operator<<(std::ostream &out,to_title c onst &obj) inline std::ostream &operator<<(std::ostream &out,to_title c onst &obj)
{ {
obj(out); obj(out);
return out; return out;
} }
#endif
/// ///
/// \brief Output filter escape /// \brief Output filter escape
/// ///
/// Escape text for HTML -- make text safe /// Escape text for HTML -- make text safe
/// ///
class CPPCMS_API escape { class CPPCMS_API escape {
public: public:
escape(); escape();
~escape(); ~escape();
 End of changes. 2 change blocks. 
4 lines changed or deleted 0 lines changed or added


 forwarder.h   forwarder.h 
skipping to change at line 32 skipping to change at line 32
/// like single server responsible for Comet processing /// like single server responsible for Comet processing
/// ///
class CPPCMS_API forwarder { class CPPCMS_API forwarder {
public: public:
/// \cond INTERNAL /// \cond INTERNAL
forwarder(); forwarder();
~forwarder(); ~forwarder();
typedef std::pair<std::string,int> address_type; typedef std::pair<std::string,int> address_type;
address_type check_forwading_rules(std::string const &h,std: :string const &s,std::string const &p); address_type check_forwading_rules(std::string const &h,std: :string const &s,std::string const &p);
address_type check_forwading_rules(char const *h,char const *s,char const *p);
/// \endcond /// \endcond
/// ///
/// Add forwarding of request that match a mount_point \a p over SCGI \a ip and \a port. /// Add forwarding of request that match a mount_point \a p over SCGI \a ip and \a port.
/// ///
void add_forwarding_rule(booster::shared_ptr<mount_point> p, std::string const &ip,int port); void add_forwarding_rule(booster::shared_ptr<mount_point> p, std::string const &ip,int port);
/// ///
/// Remove the forwarding request, you need to use smake poi nter you used in add_forwarding_rule /// Remove the forwarding request, you need to use smake poi nter you used in add_forwarding_rule
/// ///
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 http_content_type.h   http_content_type.h 
skipping to change at line 70 skipping to change at line 70
/// ///
/// Check if the parameter is set using key (should be in lowercase) /// Check if the parameter is set using key (should be in lowercase)
/// ///
bool parameter_is_set(std::string const &key) const; bool parameter_is_set(std::string const &key) const;
/// ///
/// Parse content type \a ct and create the class /// Parse content type \a ct and create the class
/// ///
content_type(std::string const &ct); content_type(std::string const &ct);
/// ///
/// Parse content type \a ct and create the class
///
content_type(char const *ct);
///
/// Parse content type in range [begin,end) and create the class
///
content_type(char const *begin,char const *end);
///
/// Empty one... /// Empty one...
/// ///
content_type(); content_type();
/// ///
/// Copy constructor /// Copy constructor
/// ///
content_type(content_type const &); content_type(content_type const &);
/// ///
/// Assignment operator /// Assignment operator
/// ///
content_type const &operator=(content_type const &); content_type const &operator=(content_type const &);
/// ///
/// Destructor /// Destructor
/// ///
~content_type(); ~content_type();
private: private:
struct data; struct data;
void parse(char const *b,char const *e);
booster::shared_ptr<data> d; booster::shared_ptr<data> d;
}; };
} } //::cppcms::http } } //::cppcms::http
#endif #endif
 End of changes. 2 change blocks. 
0 lines changed or deleted 9 lines changed or added


 http_request.h   http_request.h 
skipping to change at line 229 skipping to change at line 229
std::string http_via(); std::string http_via();
/// ///
/// CGI HTTP_WARN variable representing Warn HTTP header /// CGI HTTP_WARN variable representing Warn HTTP header
/// ///
std::string http_warn(); std::string http_warn();
/// ///
/// Get CGI environment variable by name. Returns empty stri ng if the variable is not set /// Get CGI environment variable by name. Returns empty stri ng if the variable is not set
/// ///
std::string getenv(std::string const &); std::string getenv(std::string const &);
///
/// Get CGI environment variable by name. Returns empty stri
ng if the variable is not set
///
std::string getenv(char const *);
///
/// Get CGI environment variable by name. Returns empty stri
ng if the variable is not set
///
char const *cgetenv(char const *);
/// ///
/// Get map of all CGI environment variable as key-value pai rs. /// Get map of all CGI environment variable as key-value pai rs.
/// ///
std::map<std::string,std::string> getenv(); std::map<std::string,std::string> getenv();
/// ///
/// Type that represents from-data key-value pairs /// Type that represents from-data key-value pairs
/// ///
typedef std::multimap<std::string,std::string> form_type; typedef std::multimap<std::string,std::string> form_type;
/// ///
 End of changes. 1 change blocks. 
1 lines changed or deleted 10 lines changed or added


 json.h   json.h 
skipping to change at line 23 skipping to change at line 23
// GNU Lesser General Public License for more details. // GNU Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public Licens e // You should have received a copy of the GNU Lesser General Public Licens e
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
/////////////////////////////////////////////////////////////////////////// //// /////////////////////////////////////////////////////////////////////////// ////
#ifndef CPPCMS_JSON_H #ifndef CPPCMS_JSON_H
#define CPPCMS_JSON_H #define CPPCMS_JSON_H
#include <cppcms/defs.h> #include <cppcms/defs.h>
#include <cppcms/string_key.h>
#include <booster/copy_ptr.h> #include <booster/copy_ptr.h>
#include <booster/backtrace.h> #include <booster/backtrace.h>
#include <vector> #include <vector>
#include <map> #include <map>
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
namespace cppcms { namespace cppcms {
/// ///
skipping to change at line 60 skipping to change at line 61
inline bool operator==(null const &/*l*/,null const &/*r*/) {return true;} inline bool operator==(null const &/*l*/,null const &/*r*/) {return true;}
inline bool operator!=(null const &/*l*/,null const &/*r*/) {return false;} inline bool operator!=(null const &/*l*/,null const &/*r*/) {return false;}
/// ///
/// The json::array - std::vector of json::value's /// The json::array - std::vector of json::value's
/// ///
typedef std::vector<value> array; typedef std::vector<value> array;
/// ///
/// The json::object - std::map of json::value's /// The json::object - std::map of json::value's
/// ///
typedef std::map<std::string,value> object; typedef std::map<string_key,value> object;
#ifdef CPPCMS_DOXYGEN_DOCS #ifdef CPPCMS_DOXYGEN_DOCS
/// ///
/// The type traits schema for converting json values to/from orinar y objects /// The type traits schema for converting json values to/from orinar y objects
/// i.e. serialization from JSON to C++ object /// i.e. serialization from JSON to C++ object
/// ///
template<typename T> template<typename T>
struct traits { struct traits {
/// ///
skipping to change at line 260 skipping to change at line 261
} }
/// ///
/// Searches a value in the path \a path /// Searches a value in the path \a path
/// ///
/// For example if the json::value represents { "x" : { "y" : 10 } }, then find("x.y") would return /// For example if the json::value represents { "x" : { "y" : 10 } }, then find("x.y") would return
/// a reference to value that hold a number 10, find("x") re turns a reference to a value /// a reference to value that hold a number 10, find("x") re turns a reference to a value
/// that holds an object { "y" : 10 } and find("foo") would return value of undefined type. /// that holds an object { "y" : 10 } and find("foo") would return value of undefined type.
/// ///
value const &find(std::string const &path) const; value const &find(std::string const &path) const;
///
/// Searches a value in the path \a path
///
/// For example if the json::value represents { "x" : { "y"
: 10 } }, then find("x.y") would return
/// a reference to value that hold a number 10, find("x") re
turns a reference to a value
/// that holds an object { "y" : 10 } and find("foo") would
return value of undefined type.
///
value const &find(char const *path) const;
/// ///
/// Searches a value in the path \a path, if not found throw bad_value_cast. /// Searches a value in the path \a path, if not found throw bad_value_cast.
/// ///
/// For example if the json::value represents { "x" : { "y" : 10 } }, then find("x.y") would return /// For example if the json::value represents { "x" : { "y" : 10 } }, then find("x.y") would return
/// a reference to value that hold a number 10, find("x") re turns a reference to a value /// a reference to value that hold a number 10, find("x") re turns a reference to a value
/// that holds an object { "y" : 10 } and find("foo") throws /// that holds an object { "y" : 10 } and find("foo") throws
/// ///
value const &at(std::string const &path) const; value const &at(std::string const &path) const;
/// ///
/// Searches a value in the path \a path, if not found throw bad_value_cast. /// Searches a value in the path \a path, if not found throw bad_value_cast.
/// ///
/// For example if the json::value represents { "x" : { "y" : 10 } }, then find("x.y") would return /// For example if the json::value represents { "x" : { "y" : 10 } }, then find("x.y") would return
/// a reference to value that hold a number 10, find("x") re turns a reference to a value /// a reference to value that hold a number 10, find("x") re turns a reference to a value
/// that holds an object { "y" : 10 } and find("foo") throws /// that holds an object { "y" : 10 } and find("foo") throws
/// ///
value const &at(char const *path) const;
///
/// Searches a value in the path \a path, if not found throw
bad_value_cast.
///
/// For example if the json::value represents { "x" : { "y"
: 10 } }, then find("x.y") would return
/// a reference to value that hold a number 10, find("x") re
turns a reference to a value
/// that holds an object { "y" : 10 } and find("foo") throws
///
value &at(std::string const &path); value &at(std::string const &path);
///
/// Searches a value in the path \a path, if not found throw
bad_value_cast.
///
/// For example if the json::value represents { "x" : { "y"
: 10 } }, then find("x.y") would return
/// a reference to value that hold a number 10, find("x") re
turns a reference to a value
/// that holds an object { "y" : 10 } and find("foo") throws
///
value &at(char const *path);
/// ///
/// Sets the value \a v at the path \a path, if the path inv alid, creates it. /// Sets the value \a v at the path \a path, if the path inv alid, creates it.
/// ///
void at(std::string const &path,value const &v); void at(std::string const &path,value const &v);
///
/// Sets the value \a v at the path \a path, if the path inv
alid, creates it.
///
void at(char const *path,value const &v);
/// ///
/// Creates a value from and object \a v of type T /// Creates a value from and object \a v of type T
/// ///
template<typename T> template<typename T>
value(T const &v) value(T const &v)
{ {
set_value(v); set_value(v);
} }
/// ///
/// Returns the type of variable in path, if not found retur ns undefined /// Returns the type of variable in path, if not found retur ns undefined
/// ///
/// Same as find(path).type() /// Same as find(path).type()
/// ///
json_type type(std::string const &path) const json_type type(std::string const &path) const
{ {
return find(path).type(); return find(path).type();
} }
///
/// Returns the type of variable in path, if not found retur
ns undefined
///
/// Same as find(path).type()
///
json_type type(char const *path) const
{
return find(path).type();
}
/// ///
/// Convert an object \a v of type T to a value at specific path, same as at(path,value(v)) /// Convert an object \a v of type T to a value at specific path, same as at(path,value(v))
/// ///
template<typename T> template<typename T>
void set(std::string const &path,T const &v) void set(std::string const &path,T const &v)
{ {
at(path,value(v)); at(path,value(v));
} }
///
/// Convert an object \a v of type T to a value at specific
path, same as at(path,value(v))
///
template<typename T>
void set(char const *path,T const &v)
{
at(path,value(v));
}
/// ///
/// Get a string value from a path \a path. If the path is n ot invalid or the object /// Get a string value from a path \a path. If the path is n ot invalid or the object
/// is not of type string at this path, returns \a def inste ad /// is not of type string at this path, returns \a def inste ad
/// ///
std::string get(std::string const &path,char const *def) con st std::string get(std::string const &path,char const *def) con st
{ {
value const &v=find(path); value const &v=find(path);
if(v.is_undefined()) if(v.is_undefined())
return def; return def;
try { try {
return v.get_value<std::string>(); return v.get_value<std::string>();
} }
catch(std::bad_cast const &e) { catch(std::bad_cast const &e) {
return def; return def;
} }
} }
///
/// Get a string value from a path \a path. If the path is n
ot invalid or the object
/// is not of type string at this path, returns \a def inste
ad
///
std::string get(char const *path,char const *def) const
{
value const &v=find(path);
if(v.is_undefined())
return def;
try {
return v.get_value<std::string>();
}
catch(std::bad_cast const &e) {
return def;
}
}
/// ///
/// Get an object of type T from the path \a path. Throws ba d_value_cast if such path does not /// Get an object of type T from the path \a path. Throws ba d_value_cast if such path does not
/// exists of conversion can't be done /// exists of conversion can't be done
/// ///
template<typename T> template<typename T>
T get(std::string const &path) const T get(std::string const &path) const
{ {
return at(path).get_value<T>(); return at(path).get_value<T>();
} }
///
/// Get an object of type T from the path \a path. Throws ba
d_value_cast if such path does not
/// exists of conversion can't be done
///
template<typename T>
T get(char const *path) const
{
return at(path).get_value<T>();
}
/// ///
/// Get an object of type T from the path \a path. Returns \ a def if such path does not /// Get an object of type T from the path \a path. Returns \ a def if such path does not
/// exists of conversion can't be done /// exists of conversion can't be done
/// ///
template<typename T> template<typename T>
T get(char const *path,T const &def) const
{
value const &v=find(path);
if(v.is_undefined())
return def;
try {
return v.get_value<T>();
}
catch(std::bad_cast const &e) {
return def;
}
}
///
/// Get an object of type T from the path \a path. Returns \
a def if such path does not
/// exists of conversion can't be done
///
template<typename T>
T get(std::string const &path,T const &def) const T get(std::string const &path,T const &def) const
{ {
value const &v=find(path); value const &v=find(path);
if(v.is_undefined()) if(v.is_undefined())
return def; return def;
try { try {
return v.get_value<T>(); return v.get_value<T>();
} }
catch(std::bad_cast const &e) { catch(std::bad_cast const &e) {
return def; return def;
 End of changes. 11 change blocks. 
1 lines changed or deleted 105 lines changed or added


 mount_point.h   mount_point.h 
skipping to change at line 108 skipping to change at line 108
/// Get SCRIPT_NAME/PATH_INFO selection /// Get SCRIPT_NAME/PATH_INFO selection
/// ///
void selection(selection_type); void selection(selection_type);
/// ///
/// Match \a h - HTTP_HOST, \a s - SCRIPT_NAME, \a p - PATH_ INFO against mount point and return /// Match \a h - HTTP_HOST, \a s - SCRIPT_NAME, \a p - PATH_ INFO against mount point and return
/// true and selected URL path for application /// true and selected URL path for application
/// Otherwise return false and empty string /// Otherwise return false and empty string
/// ///
std::pair<bool,std::string> match(std::string const &h,std:: string const &s,std::string const &p) const; std::pair<bool,std::string> match(std::string const &h,std:: string const &s,std::string const &p) const;
///
/// Match \a h - HTTP_HOST, \a s - SCRIPT_NAME, \a p - PATH_
INFO against mount point and return
/// true and selected URL path for application
/// Otherwise return false and empty string
///
std::pair<bool,std::string> match(char const *h,char const *
s,char const *p) const;
/// ///
/// Create default mount point, it uses PATH_INFO for url-di spatching and gives no restriction on URL /// Create default mount point, it uses PATH_INFO for url-di spatching and gives no restriction on URL
/// ///
mount_point(); mount_point();
/// ///
/// Destructor /// Destructor
~mount_point(); ~mount_point();
/// ///
/// Copy constructor /// Copy constructor
 End of changes. 1 change blocks. 
0 lines changed or deleted 8 lines changed or added


 url_mapper.h   url_mapper.h 
skipping to change at line 23 skipping to change at line 23
// GNU Lesser General Public License for more details. // GNU Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public Licens e // You should have received a copy of the GNU Lesser General Public Licens e
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
/////////////////////////////////////////////////////////////////////////// //// /////////////////////////////////////////////////////////////////////////// ////
#ifndef CPPCMS_URL_MAPPER_H #ifndef CPPCMS_URL_MAPPER_H
#define CPPCMS_URL_MAPPER_H #define CPPCMS_URL_MAPPER_H
#include <cppcms/defs.h> #include <cppcms/defs.h>
#include <cppcms/string_key.h>
#include <booster/noncopyable.h> #include <booster/noncopyable.h>
#include <booster/hold_ptr.h> #include <booster/hold_ptr.h>
#include <cppcms/filters.h> #include <cppcms/filters.h>
#include <string> #include <string>
#include <vector> #include <vector>
namespace cppcms { namespace cppcms {
class application; class application;
/// ///
skipping to change at line 235 skipping to change at line 236
/// ///
/// Note: this value is cleared globally for all application s hierarchy and not only /// Note: this value is cleared globally for all application s hierarchy and not only
/// for this specific application /// for this specific application
/// ///
void clear_value(std::string const &key); void clear_value(std::string const &key);
/// ///
/// Write the URL to output stream \a out for the URL \a pat h with 0 parameters /// Write the URL to output stream \a out for the URL \a pat h with 0 parameters
/// ///
void map( std::ostream &out, void map( std::ostream &out,
char const *path);
///
/// Write the URL to output stream \a out for the URL \a pat
h with 1 parameters
///
void map( std::ostream &out,
char const *path,
filters::streamable const &p1);
///
/// Write the URL to output stream \a out for the URL \a pat
h with 2 parameters
///
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2);
///
/// Write the URL to output stream \a out for the URL \a pat
h with 3 parameters
///
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3);
///
/// Write the URL to output stream \a out for the URL \a pat
h with 4 parameters
///
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4);
///
/// Write the URL to output stream \a out for the URL \a pat
h with 5 parameters
///
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4,
filters::streamable const &p5);
///
/// Write the URL to output stream \a out for the URL \a pat
h with 6 parameters
///
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4,
filters::streamable const &p5,
filters::streamable const &p6);
///
/// Write the URL to output stream \a out for the URL \a pat
h with 0 parameters
///
void map( std::ostream &out,
std::string const &path); std::string const &path);
/// ///
/// Write the URL to output stream \a out for the URL \a pat h with 1 parameters /// Write the URL to output stream \a out for the URL \a pat h with 1 parameters
/// ///
void map( std::ostream &out, void map( std::ostream &out,
std::string const &path, std::string const &path,
filters::streamable const &p1); filters::streamable const &p1);
/// ///
skipping to change at line 316 skipping to change at line 377
/// Get a parent mapper, if not exists throws cppcms_error /// Get a parent mapper, if not exists throws cppcms_error
/// ///
url_mapper &parent(); url_mapper &parent();
/// ///
/// Get a topmost mapper, if have no parents returns referen ce to \c this. /// Get a topmost mapper, if have no parents returns referen ce to \c this.
/// ///
url_mapper &topmost(); url_mapper &topmost();
private: private:
void real_assign(std::string const &key,std::string const &u rl,application *child = 0); void real_assign(std::string const &key,std::string const &u rl,application *child = 0);
url_mapper &get_mapper_for_key(std::string const &key,std::s tring &real_key,std::vector<std::string> &direct); url_mapper &get_mapper_for_key(string_key const &key,string_ key &real_key,std::vector<string_key> &direct);
url_mapper *root_mapper(); url_mapper *root_mapper();
void real_map( std::string const &key, void real_map( char const *key,
filters::streamable const *const *params, filters::streamable const *const *params,
size_t params_no, size_t params_no,
std::ostream &output); std::ostream &output);
struct data; struct data;
booster::hold_ptr<data> d; booster::hold_ptr<data> d;
}; };
}; };
 End of changes. 4 change blocks. 
2 lines changed or deleted 70 lines changed or added


 xss.h   xss.h 
skipping to change at line 24 skipping to change at line 24
// //
// You should have received a copy of the GNU Lesser General Public Licens e // You should have received a copy of the GNU Lesser General Public Licens e
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
/////////////////////////////////////////////////////////////////////////// //// /////////////////////////////////////////////////////////////////////////// ////
#ifndef CPPCMS_XSS_H #ifndef CPPCMS_XSS_H
#define CPPCMS_XSS_H #define CPPCMS_XSS_H
#include <booster/copy_ptr.h> #include <booster/copy_ptr.h>
#include <booster/regex.h> #include <booster/regex.h>
#include <booster/function.h>
#include <cppcms/defs.h> #include <cppcms/defs.h>
#include <string.h> #include <string.h>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
namespace cppcms { namespace cppcms {
/// ///
/// \brief Namespace that holds Anti-Cross Site Scripting Filter sup port /// \brief Namespace that holds Anti-Cross Site Scripting Filter sup port
/// ///
/// The classes in this namespace created to provide a filtering for a save /// The classes in this namespace created to provide a filtering for a save
/// handing of HTML and preventing XSS attacks /// handing of HTML and preventing XSS attacks
/// ///
namespace xss { namespace xss {
/// \cond INTERNAL /// \cond INTERNAL
namespace details { namespace details {
class c_string;
class c_string { }
public:
typedef char const *const_iterator;
char const *begin() const
{
return begin_;
}
char const *end() const
{
return end_;
}
c_string(char const *s)
{
begin_=s;
end_=s+strlen(s);
}
c_string(char const *b,char const *e) : begi
n_(b), end_(e) {}
c_string() : begin_(0),end_(0) {}
bool compare(c_string const &other) const
{
return std::lexicographical_compare(
begin_,end_,other.begin_,other.end_,std::char_traits<char>::lt);
}
bool icompare(c_string const &other) const
{
return std::lexicographical_compare(
begin_,end_,other.begin_,other.end_,ilt);
}
explicit c_string(std::string const &other)
{
container_ = other;
begin_ = container_.c_str();
end_ = begin_ + container_.size();
}
c_string(c_string const &other)
{
if(other.begin_ == other.end_) {
begin_ = end_ = 0;
}
else if(other.container_.empty()) {
begin_ = other.begin_;
end_ = other.end_;
}
else {
container_ = other.container
_;
begin_ = container_.c_str();
end_ = begin_ + container_.s
ize();
}
}
c_string const &operator=(c_string const &ot
her)
{
if(other.begin_ == other.end_) {
begin_ = end_ = 0;
}
else if(other.container_.empty()) {
begin_ = other.begin_;
end_ = other.end_;
}
else {
container_ = other.container
_;
begin_ = container_.c_str();
end_ = begin_ + container_.s
ize();
}
return *this;
}
private:
static bool ilt(char left,char right)
{
unsigned char l = tolower(left);
unsigned char r = tolower(right);
return l < r;
}
static char tolower(char c)
{
if('A' <= c && c<='Z')
return c-'A' + 'a';
return c;
}
char const *begin_;
char const *end_;
std::string container_;
};
} // details
struct basic_rules_holder; struct basic_rules_holder;
/// \endcond /// \endcond
/// ///
/// \brief The class that holds XSS filter rules /// \brief The class that holds XSS filter rules
/// ///
/// This is the major class the defines the white list rules to handle the /// This is the major class the defines the white list rules to handle the
/// Correct HTML input. /// Correct HTML input.
/// ///
skipping to change at line 248 skipping to change at line 157
/// Get if numeric entities are allowed, default is false /// Get if numeric entities are allowed, default is false
/// ///
bool numeric_entities_allowed() const; bool numeric_entities_allowed() const;
/// ///
/// Set if numeric entities are allowed /// Set if numeric entities are allowed
/// ///
void numeric_entities_allowed(bool v); void numeric_entities_allowed(bool v);
/// ///
/// Functor that allows to provide custom validation
s for different properties
///
typedef booster::function<bool(char const *begin,cha
r const *end)> validator_type;
///
/// Add the property that should be allowed to appea r for specific tag as boolean property like /// Add the property that should be allowed to appea r for specific tag as boolean property like
/// checked="checked", when the type /// checked="checked", when the type
/// is HTML it is case insensitive. /// is HTML it is case insensitive.
/// ///
/// The \a property should be ASCII only /// The \a property should be ASCII only
/// ///
void add_boolean_property(std::string const &tag_nam e,std::string const &property); void add_boolean_property(std::string const &tag_nam e,std::string const &property);
/// ///
/// Add the property that should be checked using cu
stom functor
///
void add_property(std::string const &tag_name,std::s
tring const &property,validator_type const &val);
///
/// Add the property that should be checked using re gular expression. /// Add the property that should be checked using re gular expression.
/// ///
void add_property(std::string const &tag_name,std::s tring const &property,booster::regex const &r); void add_property(std::string const &tag_name,std::s tring const &property,booster::regex const &r);
/// ///
/// Add numeric property, same as add_property(tag_n /// Add numeric property, same as add_property(tag_n
ame,property,booster::regex("-?[0-9]+") ame,property,booster::regex("-?[0-9]+") but
/// little bit more efficient
/// ///
void add_integer_property(std::string const &tag_nam e,std::string const &property); void add_integer_property(std::string const &tag_nam e,std::string const &property);
/// ///
/// Add URI property. /// Add URI property.
/// It should be used for properties like like "href " or "src". /// It should be used for properties like like "href " or "src".
/// It is very good idea to use it in order to preve nt urls like javascript:alert('XSS') /// It is very good idea to use it in order to preve nt urls like javascript:alert('XSS')
/// ///
/// It's behavior is same as add_property(tag_name,p roperty,rules::uri_matcher()); /// It's behavior is same as add_property(tag_name,p roperty,rules::uri_validator());
/// ///
void add_uri_property(std::string const &tag_name,st d::string const &property); void add_uri_property(std::string const &tag_name,st d::string const &property);
/// ///
/// Add URI property, using regular expression that matches allowed schemas. /// Add URI property, using regular expression that matches allowed schemas.
/// It should be used for properties like like "href " or "src". /// It should be used for properties like like "href " or "src".
/// It is very good idea to use it in order to preve nt urls like javascript:alert('XSS') /// It is very good idea to use it in order to preve nt urls like javascript:alert('XSS')
/// ///
/// It's behavior is same as add_property(tag_name,p roperty,rules::uri_matcher(schema)); /// It's behavior is same as add_property(tag_name,p roperty,rules::uri_validator(schema));
/// ///
void add_uri_property(std::string const &tag_name,st d::string const &property,std::string const &schema); void add_uri_property(std::string const &tag_name,st d::string const &property,std::string const &schema);
/// ///
/// \deprecated use uri_validator
///
/// Create a regular expression that checks URI for safe inclusion in the property. /// Create a regular expression that checks URI for safe inclusion in the property.
/// By default it allows only: http, https, ftp, mai lto, news, nntp. /// By default it allows only: http, https, ftp, mai lto, news, nntp.
/// ///
/// If you need finer control over allowed schemas, use uri_matcher(std::string const&). /// If you need finer control over allowed schemas, use uri_matcher(std::string const&).
/// ///
static booster::regex uri_matcher(); static booster::regex uri_matcher();
/// ///
/// \deprecated use uri_validator
///
/// Create a regular expression that checks URI for safe inclusion in the text, where /// Create a regular expression that checks URI for safe inclusion in the text, where
/// schema is a regular expression that matches spec ific protocols that can be used. /// schema is a regular expression that matches spec ific protocols that can be used.
/// ///
/// \note Don't add "^" or "$" tags as this expressi on would be used in construction of regular /// \note Don't add "^" or "$" tags as this expressi on would be used in construction of regular
/// other expression. /// other expression.
/// ///
/// For example: /// For example:
/// \code /// \code
/// booster::regex uri = uri_matcher("(http|https)") ; /// booster::regex uri = uri_matcher("(http|https)") ;
/// \endcode /// \endcode
/// ///
static booster::regex uri_matcher(std::string const &schema); static booster::regex uri_matcher(std::string const &schema);
////
/// Create a validator that checks URI for safe incl
usion in the property.
/// By default it allows only: http, https, ftp, mai
lto, news, nntp.
///
/// If you need finer control over allowed schemas,
use uri_validator(std::string const&).
///
static validator_type uri_validator();
////
/// Create a validator that checks URI for safe incl
usion in the property.
/// - schema is a regular expression that matches sp
ecific protocols that can be used.
/// - absolute_only - set to true to prevent accepti
ng relative URIs like "/files/img.png" or "test.html"
///
/// \note You don't need to add "^" or "$" tags to \
a scheme
///
/// For example:
/// \code
/// uri_validator("(http|https)");
/// \endcode
///
///
/// If you need finer control over allowed schemas,
use uri_validator(std::string const&).
///
static validator_type uri_validator(std::string cons
t &scheme,bool absolute_only = false);
///
/// Create a validator that checks that this URI is
relative and it is safe for inclusion
/// in URI property like href or src
///
static validator_type relative_uri_validator();
/// ///
/// Check if the comments are allowed in the text /// Check if the comments are allowed in the text
/// ///
bool comments_allowed() const; bool comments_allowed() const;
/// ///
/// Set to true if the comments are allowed in the t ext /// Set to true if the comments are allowed in the t ext
/// ///
void comments_allowed(bool comments); void comments_allowed(bool comments);
/// ///
 End of changes. 10 change blocks. 
106 lines changed or deleted 65 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/