Commit Graph

410 Commits

Author SHA1 Message Date
Tomasz Sowa f54df8d600 updated: to the new EZC api (ezc functions can be methods of some special objects)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1012 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-06-14 18:24:08 +00:00
Tomasz Sowa d8451ceaa0 fixed: checking for ssl redirect
we should take into account cur.request->function->need_ssl too



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1010 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-05-29 09:46:29 +00:00
Tomasz Sowa 62f178c2ee fixed: in App::CheckIfNeedSSLredirect()
winix made an incorrect redirect from/to SSL



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1009 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-05-29 09:24:43 +00:00
Tomasz Sowa eb4e7343e7 changed: now 'emacs' winix function uses CodeMirror editor
currently only htmlmixed mode is implemented


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1008 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-04-18 18:50:39 +00:00
Tomasz Sowa 5274e8e8ff added: "server_mode" config option (std::wstring)
you can assign any string to it such as "production" "dev"
       this value is not used by winix itself
       you can refer to it from [server_mode] and [server_mode_is] ezc functions





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1007 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-04-16 14:43:52 +00:00
Tomasz Sowa ae2a885d6c fixed: rm winix function returned incorrectly formated json when using jquery upload (delete file button)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1006 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-03-20 11:00:22 +00:00
Tomasz Sowa 901663b145 updated: to the new ezc api
added:   following ezc functions: ezc_and_not, ezc_any_not, ezc_or_not, ezc_one_not, is, is_not, is_empty, is_not_empty





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1005 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-03-08 23:22:05 +00:00
Tomasz Sowa dc301d4c50 changed: editors (emacs, ckeditor...) doesn't set an item's title now (if it was empty)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1003 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-03-02 21:23:29 +00:00
Tomasz Sowa 34f0535a26 added: some ezc functions for displaying current date
current_sec, current_min, current_hour, current_year, ...



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1002 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-02-22 10:23:52 +00:00
Tomasz Sowa af0e2a778d changed: some refactoring in System: in IsMemberOfGroup method
changed: some log messages at startup (about non existing empty group for uploads directory)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1001 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-01-02 08:18:06 +00:00
Tomasz Sowa 904f1e70f2 fixed: compiling on Debian (it has no MSG_EOF flag)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1000 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-01-02 07:15:22 +00:00
Tomasz Sowa ddf7ef30ad fixed: compiling od Debian
sockaddr_un has no sun_len member



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@999 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-01-02 07:14:15 +00:00
Tomasz Sowa 0a43870e76 fixed: the way how winix is closing
beforehand we made a http connection from the special thread
       now we just send a fastcgi packet to the unix socket

       the old way was broken because it requires the http server to work
       and if the operating system is going to shutdown/reboot then the http server
       can be first closed and consequently the winix cannot wake up from
       the main thread (and will be terminated SIGKILL by the os)
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@998 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-01-02 07:01:08 +00:00
Tomasz Sowa f875bd2944 changed: when a client doesn't send a session cookie we can instead of ban just use a temporary session
added: config option:
	// the way we behave when no_session_cookie_treshold limit is exceeded
 	// 0 - if a client doesn't send a session cookie again then use a temporary session
 	//     (other sessions from this IP address are not affected)
 	// 1 - add this IP address to ban list and create a temporary session
 	//     (this will block other sessions from this IP address too)
 	// default: 0
 	int no_session_cookie_ban_mode;




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@996 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-25 12:02:22 +00:00
Tomasz Sowa c9bf20201b added: possibility to ban if a session cookie is incorrect (when we are using encoded cookies)
added:   possibility to ban if a client tries to hijack the session cookie
added:   possibility to ban if a client did not send a session cookie
renamed: ezc functions:
         login_cannot_login -> ipban_is_login_allowed_from_this_ip  (and the return value was changed)
         login_when_available_login -> ipban_current_ip_expires_time
added: config options:
       // after how many broken encoded cookie we should ban the current IP
       // default: 2 (value in the range <0 - 65535>)
       size_t broken_encoded_cookie_treshold;

       // after how many incorrect session identifiers (or session indices) we should ban the current IP
       // do not set this value too low, as people connecting from the same IP address (from behind a NAT)
       // would be banned if they have an old session cookie remembered in the browser
       // default: 128 (value in the range <0 - 65535>)
       size_t session_hijacking_treshold;

       // after how many times a client will be banned if it did not send a session cookie
       // default: 1000 (value in the range <0 - 65535>)
       size_t no_session_cookie_treshold;








git-svn-id: svn://ttmath.org/publicrep/winix/trunk@995 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-24 20:22:30 +00:00
Tomasz Sowa 76314aab10 added: possibility to encode the session cookie (added files core/sessionidmanager.h and core/sessionidmanager.cpp)
added: config options:
       // whether or not we should encode the session cookie
       // (we have a special algorithm)
       // default: false
       bool session_cookie_encode;

       // if session_cookie_encode is true then you should provide
       // a file where AES keys will be stored
       std::wstring session_keys_file;

       // each session has an index -- an unsigned int value
       // this value is sent in the cookie string (is encoded)
       // and is incremented when session_index_time_increment time is passed since the last incrementing
       // if a client sent the cookie back the difference between
       // current index and the index in the cookie should be less than or equal to session_allow_index_difference
       // default: 8
       size_t session_allow_index_difference;

       // the time which should pass after the session index is incremented
       // default: 30
       // (session_allow_index_difference + 1) * session_index_time_increment should be less than a time
       // load of a page and all elements on it such as images (of course it depends on client's download too)
       time_t session_index_time_increment;

       // time in seconds after a new AES key pair should be generated
       // we have 256 pairs of keys so this time multiplied by 256 should not be less than
       // the max time of a session (session_remember_max_idle),
       // by default: 256 * 2 days = 512 days = 1.4 year > 3 months (session_remember_max_idle)
       // default: 172800 = 2 days (max: 2678400 = 1 month, min: 10)
       size_t session_key_renew_time;

changed: when printing the time of a request we print only two non-zero digits






git-svn-id: svn://ttmath.org/publicrep/winix/trunk@994 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-22 15:30:56 +00:00
Tomasz Sowa 3547d326b8 define AR macro in the main Makefile
this is for pikotools and tito libraries



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@993 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-12 04:14:16 +00:00
Tomasz Sowa 0ecb2ac70e added: to HtmlTextStream: Escape(bool) method
now the output html streams can be turn into no-escaping mode
       default true (set when a request is clearing)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@990 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-06 21:17:41 +00:00
Tomasz Sowa 8f8defe0de updated: to the new Ezc API
removed statements: [if-index ...] [is ...] [is-no ...]
added:   generic ezc functions:
         and, any (the same as and), or, one (the same as or), not, cmp, trim
         to_lower, to_upper, index
changed: in misc:
         added treat_new_line_as_white flag to IsWhite() SkipWhite() and TrimWhite()
         TrimWhite(), TrimFirst(), TrimLast(), Trim() are using only wide characters now
         (they were templates before)
         added: IsInt(), IsSize(), IsFloat()
changed: version to 0.6.4






git-svn-id: svn://ttmath.org/publicrep/winix/trunk@989 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-02 17:47:34 +00:00
Tomasz Sowa db5572e864 removed: svn:executable attribute from files
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@984 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-01 17:05:20 +00:00
Tomasz Sowa 1100cf75d7 updated: to the new Ezc API
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@983 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-28 19:14:46 +00:00
Tomasz Sowa 4fda06b547 fixed: PatternCacher incorrectly rebuilt the cache
some new Ezc::Pattern objects were inserted
       the storage container is std::map<long,...>
       but we traverse it as a std::vector e.g.:
       for(size_t i=0 ; i<pattern_tab.size() ; ++i)
           RebuildCache(pattern_tab[i].pattern);
       so eventually new patterns were added to the map
       (operator [])




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@980 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-21 07:27:21 +00:00
Tomasz Sowa fb18b2238e added: two options to the config:
ezc_error_prefix (string)
        ezc_error_postfix (string)
        // prefix and postfix used when there is an error in Ezc patterns
        // default:
        // prefix:  "<!-- "
        // postfix: " -->"
added:  Ezc::Blocks to templates
added:  although patterns have pointers to functions and blocks cached
        the Ezc::Generator should use SetFunctions() and SetBlocks() method
        in order to correctly recognize variables (aliases)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@978 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-19 21:20:09 +00:00
Tomasz Sowa 5266a7e4e5 updated: to the new Ezc API
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@974 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-18 18:12:04 +00:00
Tomasz Sowa 8196fb77d1 changed: now we do not use std::string and char* in the Winix API
everywhere we are using std::wstring and wchar_t*
         (std::string and char* is used only locally in some places
         especially when creating a path to OS file system etc.)
added:   to the special thread when winix closes:
         a write function for curl: FetchPageOnExitCurlCallback()
         without this function the curl library will print
         the page's content to the standart output
changed: TextStream<> class from core can make
         UTF8<->wide strings conversions
removed: from config: utf8 option
         now winix expects UTF8 from the user's input (html forms, url-es)
         and outputs strings in the UTF8 format




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@965 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-09 20:44:56 +00:00
Tomasz Sowa 4abf6642f7 setting a Winix Licence: 2 Clause BSD Licence
changed: version to 0.6.2



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@963 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-04 18:04:03 +00:00
Tomasz Sowa e3284dcfbc fixed: winix incorrectly used config options: upload_dirs_chmod and upload_files_chmod
added: to config: upload_group
       a group name for newly uploaded files (and created necessary directories in the file system)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@961 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-09-28 17:30:05 +00:00
Tomasz Sowa f064ff6b3d added: htmltextstream escapes more characters now:
added characters:
          "  -> &#quot;
          '  -> &#39; (&apos; but IE8 has a problem with &apos;)
          10 -> &#10;
          13 -> &#13;
added: two ezc filters:
       fil_html_quote
          "  -> &#quot;
          '  -> &#39; (&apos; but IE8 has a problem with &apos;)
       fil_html_newline
          10 -> &#10;
          13 -> &#13;
changed: fun_subject.html uses <div class="winix_input_a"> now





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@959 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-09-22 23:54:24 +00:00
Tomasz Sowa bfa5d8cc05 changed: plugin jQuery File Upload has been updated to version 9.7.0
(changed 'upload' and 'rm' winix functions)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@958 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-08-06 20:14:10 +00:00
Tomasz Sowa 6614919c13 added: possibility to save a pid file
new config option: pid_file (a full path to a pid file)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@957 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-08-04 21:11:14 +00:00
Tomasz Sowa 8379acdb7f fixed: item content should not be escaped in 'raw' mode
(it was not escaped only when execute bits were set)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@956 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-08-03 18:33:07 +00:00
Tomasz Sowa 160ddc258d added: to htmlfilter: the filter is able to recognize a special tag, default called: <nofilter>
content between <nofilter>...</nofilter> will not be filtered



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@955 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-06-18 23:18:28 +00:00
Tomasz Sowa 01892d2766 added: flag has_pass to User structure
if false that means the user has not set a password yet 
       (this can be used by a plugins to create a new account without a password set)
       in order to login the user first has to set a new password
       (this can be done from a some kind of activation link send via email etc)
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@954 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-06-07 11:20:44 +00:00
Tomasz Sowa 222955a2e7 fixed: in Synchro: we should have a table (map) of reference counters
each one for each thread
fixed: on Linux: pthread mutexes by default behaves differently than on FreeBSD
       we have to set PTHREAD_MUTEX_ERRORCHECK attribute 
       when creating a mutex
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@953 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-14 11:20:22 +00:00
Tomasz Sowa 37b22c3559 added: some debug logs to export plugin
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@952 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-12 22:32:06 +00:00
Tomasz Sowa afbd522362 fixed: in Makefile: 'cp' in Linux behaves differently
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@951 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-12 20:49:50 +00:00
Tomasz Sowa a4bed3ab14 fixed: compiling on Debian with GCC 4.8
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@950 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-12 17:21:42 +00:00
Tomasz Sowa 7468e7a36c added: namespace Winix over all *.h/*.cpp files
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@948 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-12 16:30:49 +00:00
Tomasz Sowa 145445c713 changed: now we use curl to fetch a page from the special thread when winix quits
(before we were using BSD's fetch)
fixed:   we didn't use FCGX_Finish_r() on the request made from the special thread
         so the thread hangs (now we can use pthread_join correctly from the main thread)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@947 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-11 21:00:32 +00:00
Tomasz Sowa 7fa9314c6b changed: in ClearOutputStreams() referencing 'config' only if not null
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@946 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-23 03:29:33 +00:00
Tomasz Sowa 5d37b6c6ae fixed: winix incorrectly sent the binary stream
headers and cookies were not sent
       (instead of headers the content was sent, so the client's browser was unable to open it correctly)
added: standard http headers are added by winix only if there are not such headers already
       e.g. if a plugin adds "Content-Type" header then winix will not overwrite it 
       (headers names are case sensitive)


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@945 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-19 17:19:47 +00:00
Tomasz Sowa fe1f84e29d added: -O0 -g for CXXFLAGS for temporarily debugging
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@944 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-18 12:13:28 +00:00
Tomasz Sowa 83e27a6653 fixed: problem with building
added #include <utility> to App (for std::move)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@943 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-09 16:03:45 +00:00
Tomasz Sowa ee9c68b04e added: generating Content-Length header when text answer is sent to the client
added:   now we are able to use the html filter for the whole out_streams (when ajax is used the output is filtered too)
         splitted FilterCompressSend() function -- first we are making the filtering
         (after filtering we know the size of the content to send)
added:   to Compress:
         Compressing(const char * source, size_t source_len, BinaryPage & out_stream, int encoding);
changed: some refactoring in App




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@942 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-04 01:21:57 +00:00
Tomasz Sowa c04874397b fixed: security vulnerability in 'ln' winix function
a user could create a hardlink to any file and the new link 
       had user_id, group_id and permissions the same as for new generated files,
       this allowes to overwrite any existing file in the filesystem,
       now user_id, group_id, permissions are the same as from the oryginal file



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@941 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-03 12:33:41 +00:00
Tomasz Sowa 375604edd6 removed: Request::debug all stream used for debugging info
some environment variables were put there
removed: config variable: debug_info
removed: Request::role (responder, authorizer)
         now we have only one role: responder
added:   new config variables:
         log_env_variables (default false) - when true then fastcgi environment
         variables are logged to the log file
         log_http_answer_headers (default false) - when true all http headers
         created by winix ale logged (note that the www server can add/adjust other headers)
changed: some refactoring in Request struct
changed: CookieTab to std::map<std::wstring, std::wstring>
         beforehand std::string was used
         (changed CookieParser as well)
changed: Request::SetCookie() to AddCookie()
added:   Request::out_headers (a PT::Space struct)
         http headers (without cookies) send back to the client
added:   Request::out_cookies (a PT::Space struct)
         cookies send to the client
changed: App class to use Request::out_headers and Request::out_cookies
         some SendHeaders...() methods were renamed to PrepareHeaders...()
         and they create output in Request::out_headers first (and out_cookies)
         and later it is sent
added:   two plugin messages:
         // http headers (without cookies) were created and are ready to send
         // here you can make some changes to them
         // in p1 you have a pointer to the PT::Space (Request::out_headers)
         #define WINIX_PREPARE_TO_SEND_HTTP_HEADERS		31070

         // http cookies were created and are ready to send
         // here you can make some changes to them
         // in p1 you have a pointer to the PT::Space (Request::out_cookies)
         #define WINIX_PREPARE_TO_SEND_HTTP_COOKIES		31080
added:   config variable:
         // how many output streams do we have in Request class
         // default: 16 (64 maximum)
         size_t ezc_out_streams_size;




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@940 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-29 21:39:23 +00:00
Tomasz Sowa 3e32f3784f removed: -O0 -g from production Makefile
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@939 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-25 23:44:01 +00:00
Tomasz Sowa 5c4a54d998 added: -O0 -g to the production Makefile
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@938 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-25 23:37:52 +00:00
Tomasz Sowa 3af3ac3f6f removed: ezn patterns for rawcontent and ajaxcontent:
index_rawcontent.html, index_ajaxcontent.html
         now we have out_streams in Request and some special
         keyword in ezc templates for sending content to the 
         specified streams
changed: the way how winix answers to the client's browsers:
         info from Request class:
	                                   winix answer send to the client's browser
	                                                       |
	                                                       |
	                                          depending on send_bin_stream
	                               -------------------------------------------------
	                               |                                               |
	                          text answer                                     binary answer
	                               |                                               |
	                   depending on return_json                          sending out_bin_stream
	             ------------------------------------
	             |                                  |
	       normal request                     ajax request
	             |                                  |
	   sending out_streams[0]           depending on return_info_only
	                              ------------------------------------------------------
	                              |                                                    |
	                 generating JSON object from:                   generating JSON object only from info
	                 out_streams and info, e.g.:                    e.g.:
	                 {                                              { info object serialized here }
	                  "stream_1": "some html content",
	                  "stream_2": "some other html content",
	                  "info": { info object serialized here }
	                 }
	                 note that out_streams[0] is not sent
	                 in JSON answers
	
	




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@937 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-14 20:59:23 +00:00
Tomasz Sowa d801f53154 changed: now we are using the C++ 11 language (-std=c++11) and we are using
the clang compiler by default
changed: Makefile files have been a little cleaned
         the main Makefile now will not compile winix and winix.so if there
         were not any changes to source files (it's faster)
         (added Makefile.dep in the global directory with list of all source/header files)
changed: winix version to 0.5.5




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@933 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-10-15 21:57:51 +00:00