CppCMS Blog :: Progress http://blog.cppcms.com/ A blog on CppCMS - C++ Web Development Framework CppCMS 1.1.0 Beta was released http://blog.cppcms.com/post/119 http://blog.cppcms.com/post/119 <div style="direction:ltr"> <p>After the goals for 1.2 were completed I announce official CppCMS 1.1.0 beta (stable will be 1.2.0)</p> <p>It is available on the usual place:</p> <p><a href="https://sourceforge.net/projects/cppcms/files/cppcms/1.1.0-beta/cppcms-1.1.0.tar.bz2">https://sourceforge.net/projects/cppcms/files/cppcms/1.1.0-beta/cppcms-1.1.0.tar.bz2</a></p> <p>It includes many new and important features:</p> <p><a href="http://cppcms.com/wikipp/en/page/cppcms_1_2_whats_new">http://cppcms.com/wikipp/en/page/cppcms_1_2_whats_new</a></p> <p>Now I ask the community to fully participate in beta testing so 1.2 will be released ASAP.</p> <h3>Goals for beta testing</h3> <h4>Framework Unit Test:</h4> <ol> <li>Download the beta version, build, run tests</li> <li>Report on what platform you tested: OS, Compiler version, standard library (libstdc++/libc++)</li> <li>Have you had any tests failed and if you had please attach Testing/Temporary/LastTest.log and CMakeCache.txt from your build directory</li> </ol> <p>I specially need tests on Mac OS X various versions, various ARM platforms like raspberry pi and Windows different compilers</p> <h4>Compatibility Test:</h4> <ol> <li>Try to build your existing applications with latest version, report any problems</li> <li>If you have been using CppCMS 1.0.5 till now please try to build CppCMS 1.1.0 and run existing programs with new shared objects/dll WITHOUT rebuilding your applications - it must work as is!</li> </ol> <h4>Feature Test:</h4> <p>Go to: <a href="http://cppcms.com/wikipp/en/page/cppcms_1_2_whats_new">http://cppcms.com/wikipp/en/page/cppcms_1_2_whats_new</a></p> <p>And try some of new features, report any issues with them or any problems with API design.</p> <p>If all goes smoothly I'll release 1.2.0 - official stable version.</p> </div> CppCMS code migrated to GitHub http://blog.cppcms.com/post/118 http://blog.cppcms.com/post/118 <div style="direction:ltr"> <p>After multiple requests and my final decision the CppCMS web framework code migrated to GitHub</p> <p><a href="https://github.com/artyom-beilis/cppcms">https://github.com/artyom-beilis/cppcms</a></p> <p>Please note:</p> <ol> <li>Only CppCMS framework migrated, other subprojects like CppDB or Wikipp are still pending conversion</li> <li>The main bug tracker is still on source-forge - however I'll relate to issues opened on GitHub</li> </ol> </div> Session Sharing with Non-CppCMS technologies http://blog.cppcms.com/post/117 http://blog.cppcms.com/post/117 <div style="direction:ltr"> <p>One of the problems in integrating different technologies on same web site is sharing the data between them, in particular sharing session data.</p> <p>For example you have a huge web platform written in PHP or Java and you want to improve performance of certain subsystems poring them to CppCMS. On of the first issues you'd encounter is how to share the session between them - so every side would know who is the user, what permissions he has, etc.</p> <p>So I made <code>cppcms::session_pool</code> and <code>cppcms::session_interface</code> accessible outside the usual request/response scope and wrapped it with <a href="http://sourceforge.net/p/cppcms/code/HEAD/tree/framework/trunk/cppcms/capi/session.h">pure C API</a> - such that no C++ exceptions are thrown and every function is resolvable via <code>dlopen</code>/<code>GetProcAddress</code>- to make it more accessible for integration with different languages.</p> <p>Several modules for different programming languages were implemented allowing smooth integration with their web frameworks and APIs:</p> <ul> <li>PHP - using <a href="http://swig.org">Swig</a></li> <li>Java/Servlet - using <a href="https://jna.java.net/javadoc/overview-summary.html">JNA</a></li> <li>Python/Django - using <a href="https://docs.python.org/2/library/ctypes.html">ctypes</a> (but not limited to Django)</li> <li>Asp.Net - using <a href="https://msdn.microsoft.com/en-us/library/aa288468%28v%3Dvs.71%29.aspx">PInvoke</a></li> </ul> <p>Actually there is no particular limits regarding technology - just a question of implementing loadable module for a specific language/platform.</p> <p>In general it consists of a SessionPool object that is created from a configuration file and exists globally. It generates a special Session objects that is loaded from Http Request cookies, updated and saved to the Http Response object.</p> <p>It looks like this:</p> <p>PHP:</p> <pre><code>// pool initialization $pool=CppCMS_SessionPool::from_config('cppcms-config.js'); // per request session access $session=$pool-&gt;session(); $session-&gt;load(); $x=0; if($session-&gt;is_set('x')) { $x=$session['x']; } $x=intval($x)+1; $session['x']=$x; $session-&gt;save(); ... </code></pre> <p>Java/Servlet:</p> <pre><code>static SessionPool pool; public void init() throws ServletException { pool = SessionPool.openFromConfig("/path/to/cppcms-config.js"); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Session session = pool.getSession(); session.load(request); String x="0"; if(session.isSet("x")) x=session.get("x"); x=Integer.toString(Integer.parseInt(x)+1); session.set("x",x); session.save(response); session.close(); ... } </code></pre> <p>Python with Django:</p> <pre><code># Create global pool pool=cppcms.SessionPool('/path/to/cppcms-config.js') # Actual view def home(request): s=pool.session() s.load(django_request=request) v='0' if 'x' in s: v= s['x'] s['x']=str(int(v)+1) response = HttpResponse() s.save(django_response=response) ... </code></pre> <p>C#/ASP.Net:</p> <pre><code>static SessionPool pool; static Example() { pool = SessionPool.FromConfig("cppcms-config.js"); } protected void Page_Load(object sender,EventArgs e) { using(Session s = pool.Session()) { s.Load(Request); string v="0"; if(s.IsSet("x")) v=s["x"]; v = (int.Parse(v) + 1).ToString(); s["x"]=v; s.Save(Response); } ... } </code></pre> <p>So basically you have a full access to CppCMS session from 3rd party most popular technologies.</p> <p>Still thinking of implementing a module for Ruby on Rails but I have never written a line of code in Ruby so it is quite challenging for me. I'll probably wait till somebody contributes one.</p> </div> Serving All Israeli News Web Sites from a Single EC2 instance... http://blog.cppcms.com/post/114 http://blog.cppcms.com/post/114 <div style="direction:ltr"> <p>For the last year the development of the CppCMS project was less active. The vast majority of the work hours were spent on a customer's project that used CppCMS to create an outstanding advertisement system.</p> <p>The project is called <a href="http://linicom.co.il">Linicom</a>.</p> <p>Today, when Linicom is up, running and maintained by a larger team, so I can resume the activity on the core CppCMS project itself.</p> <p>Few words about Linicom:</p> <p>Linicom is an engine that provides content and visitor sensitive advertisements for almost all large Israeli news web sites: including Ynet, Haaretz, Jerusalem Post, Mako, Walla and other significant web sites in Israel and abroad.</p> <p>Here some interesting facts:</p> <ul> <li>Linicom is based on CppCMS technology.</li> <li>The system serves around 10,000,000 <em>custom</em> requests a day, i.e ~115 req./s.</li> <li>During peak hours, it servers around 160 requests per second.</li> <li>Its typical network output is around 11 megabit per second.</li> <li>Its total memory consumption (web server, database, applications, OS) is only around 350Mb.</li> <li>The server's average CPU load is around 5%</li> <li>The server runs on a <code>c1.medium</code> Amazon EC2 instance.</li> </ul> <p>The system runs behind Lighttpd and uses PostgreSQL for persistent data storage. Also PostgreSQL is used extensively, all real time data is stored in memory.</p> <p>Almost every request needs data processing in order to provide highly customized advertisements. In technical terms it means that almost no request can be "outsourced" to a static files - every request for every customer should be processed explicitly.</p> <p>This system is probably one of the classic applications of CppCMS technology - web based system that required to be fast and efficient, being able to handle outstanding and sometimes unexpectedly changing loads without problems and provide high QoS.</p> <p>Use of in-memory data storage, caching and efficient handing of the data that can't be cached is were CppCMS shines. Having a big growth potential with a minimal required maintenance and high reliability allows the to handle the business-end safely without worrying about performance issues.</p> </div> CppCMS 1.0.5 Released http://blog.cppcms.com/post/116 http://blog.cppcms.com/post/116 <div style="direction:ltr"> <p>Bug Fixes:</p> <ul> <li>Fixed 121, 98 - bug caused invalid year formatting/parsing by icu backend - fixed incorrect use of year of the week instead year</li> <li>Fixed 122 - memory leak in Win32 threading library</li> <li>Fixed 105 - string_key.h has a bad operator '!='</li> <li>Fixed 119 - bad html formatting.</li> <li>Fixed 106 - IPv6 support on Winows</li> <li>Fixed 129 - cppcms_make_key - invalid option name</li> <li>Fixed 97 - impossible to use upper case in namespace in <code>&lt;% include %&gt;</code></li> <li>Fixed 84 - 64K fd limit</li> <li>Fixed 108 - test_locale_boundary &amp; booster_locale_formatting failure</li> <li>Fixed various issues libc++/clang support</li> <li>Significantly improved multipart parsing closing f.r. 27</li> <li>Removed reuse_address socket option use at Windows</li> </ul> <p>Minor Security Improvements:</p> <ul> <li>Issue 117: possibility of Timing Attack Vulnerability</li> </ul> <p>Platform Support:</p> <ul> <li>NetBSD is supported platform</li> <li>FreeBSD added support of POSIX locale &amp; clang/libc++</li> </ul> <p>The code is downloadable from sourceforge. Binary RPM releases already available at The Open Build Service repository. Debian packages would be published soon.</p> <p><strong>Update:</strong> Debian and Ubuntu packages are ready at the repository.</p> </div> CppCMS 1.0.4 Released http://blog.cppcms.com/post/115 http://blog.cppcms.com/post/115 <div style="direction:ltr"> <p>This is a critical bug fix release that relates to session handing in Internet Explorer.</p> <p>Added "Expires" to cookie expiration time handling that is supported by IE.</p> <p>Prior to this release, cppcms session cookies used max-age option, that IE does not recognize. Starting from this release the session cookies would have both Expires and Max-Age options. All browsers that use Max-Age would ignore Expires if both given.</p> <p>New options that control the session cookie properties are added, see <a href="http://cppcms.com/wikipp/en/page/cppcms_1x_config#session.cookies.expiration_method">expiration_method</a> that would allow to alter the behavior and handle possible clock skew issues</p> <p>Special thanks to Saikumar Gandapodi who reported me this issue.</p> </div> CppCMS 0.999.1 - Release Candidate 2 http://blog.cppcms.com/post/100 http://blog.cppcms.com/post/100 <div style="direction:ltr"> <p>All CppCMS 1.0.0 milestone tasks had completed and thus the second release candidate was released. It contains mostly bug fixes including several security bug fixes. It is expected to be the last RC before the stable version would be delivered.</p> <p>All CppCMS users please download the RC2 and test it. If no critical problems would be found the stable version would be announced in a week or two.</p> <h2>Whats New?</h2> <p><em>Security Bug Fixes:</em></p> <ul> <li>Fixed a bug when calling <code>reset_session()</code> would not reset it when session content itself was not changed.</li> <li>Fixed a bug that could cause infinite waiting when POST data contained incomplete multi-part data potentially causing DOS.</li> </ul> <p><em>Breaking Changes:</em></p> <p>The protocol between <code>cppcms_scale</code> and <code>cppcms</code> clients had changed, you can't use old <code>cppcms_scale</code> with newer versions of <code>cppcms</code> and vise versa.</p> <p>The protocol now uses absolute 64 bit time-stamp rather then relative one.</p> <p><em>New Features:</em></p> <ul> <li>Many new unit tests implemented giving good test coverage for the CppCMS framework.</li> <li>Added support of nginx with SCGI protocol to <code>cppcms_run</code></li> <li>Many examples added: Asynchronous I/O, Serialization, Templates Inheritance. Some examples updated to use moder API.</li> </ul> <p><em>Bug Fixes:</em></p> <ul> <li>Fixed a bug that prevented "Keep-Alive" option to work with FastCGI protocol.</li> <li>Session cookie was not delete on clear session call with server side session storage.</li> <li>Fixed a bug that caused a session value to be unexposed what it was updated.</li> <li>Fixed incorrect call of <code>view_builder</code> instead of <code>unsafe_view_builder</code> when unsefe option was given</li> <li>Fixed status handling according to HTTP/CGI specifications in case of invalid POST input.</li> <li>Fixed a bug when in certain situations sockets were not shutdown properly.</li> <li>Added better error reporting when the content of invalid type was used during view rendering.</li> <li>Fixed <code>cppcms_run</code> to setup nginx's <code>PATH_INFO</code> correctly according to the options available in the latest version.</li> </ul> </div> CppCMS 0.999.0 - Release Candidate 1 http://blog.cppcms.com/post/94 http://blog.cppcms.com/post/94 <div style="direction:ltr"> <p>The first release candidate of the next version of CppCMS is available - the API can be considered stable from this point and would not be changed in backward incompatible way.</p> <p><em>New Features:</em></p> <ul> <li><p>Templates engine improvements:</p> <ul> <li><p>Added template helpers support functions <a href="http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_templates_comm#Views.Helpers"><code>&lt;% using ... %&gt;</code></a> and <a href="http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_templates_comm#Rendering.other.views"><code>&lt;% render ... %&gt;</code></a> that allow using other views directly from the code and not just templates as it was done before.</p></li> <li><p>Added new syntax</p> <pre><code>&lt;% form block foo %&gt;...&lt;% end %&gt; </code></pre> <p>as better alternative to:</p> <pre><code>&lt;% form begin foo %&gt;...&lt;% form end foo %&gt; </code></pre></li> <li><p>Improved error messages in templates compiler such that it gives more clear errors in case of syntax error.</p></li> <li><p>Changed semantics of <code>application::render</code> function such that it would not override an application that was assigned to the contend (if it was assigned at all)</p></li> </ul> </li> <li><p><code>cppcms_scale</code> improvements:</p> <ul> <li>Support of session storage in addition to cache storage now providing full scalability of CppCMS services.</li> <li>Now it uses same configuration method as CppCMS process - JSON file with optional command line parameters.</li> <li><code>cppcms_scale</code> now can run as Unix deamon and as Windows service.</li> </ul> </li> <li><p>URL Mapper does not throws by default, but rather create an invalid URL making initial programming easier.</p> <p>The behavior can be reverted back by setting <code>misk.invalid_url_throws</code> option to true.</p></li> <li><p>Added recursive <code>shared_mutex</code> support to booster.</p></li> <li><p>Provided an experimental support of STLPort 5.2.</p></li> </ul> </div> CppCMS 0.99.11 Released http://blog.cppcms.com/post/90 http://blog.cppcms.com/post/90 <div style="direction:ltr"> <p><em>New Features:</em></p> <ul> <li><p>Fully refactored views loading and unloading code. The views interface now is documented, public and clear.</p></li> <li><p>Documentation updates, now all public classes and functions have full Doxygen reference documentation.</p></li> <li><p>Added multiple examples and created examples page in Doxygen reference documentation. New examples are:</p> <ul> <li>JSON RPC</li> <li>JSON RPC Chat</li> <li>File Upload Example</li> </ul> </li> <li><p>Internal File Server Improvements:</p> <ul> <li>Added support of simple URL rewriting</li> <li>Reduced memory copying in sending files</li> </ul> </li> <li><p>Added support of dynamic session storage backend loading as plugins, implemented several session storage backends under <code>contrib</code> section:</p> <ul> <li>Berkeley DB</li> <li>Sqlite3</li> <li>CppDB with MySql and PostgreSQL servers</li> </ul> </li> <li><p>Removed dependency on pthreads-win32 under Windows 2000 and XP.</p></li> <li><p>Improved JSON-RPC handling - reduced copying of json objects.</p></li> <li><p>Added support of custom timezone for logging closing #3432220, changed default time zone in the log file to local time rather then GMT.</p></li> <li><p>Added JavaScript JSON-RPC Client implementation under <code>contrib</code> section</p></li> <li><p>Performance improvements in TCP Cahce Server.</p></li> </ul> <p><em>Bugs:</em></p> <ul> <li>Fixed use of deprecated functions in examples, closing #3404317</li> <li>Spelling improvements, closing #3206151, thanks Augustin for the contribution.</li> <li>Fixed TLS behavior such that TLS pointer destruction, still allows destruction of local objects</li> <li>Fixed issue #3441849, Typo in <code>cppcms::http::context::complition_type</code>, now it is <code>cppcms::http::context::completion_type</code>, as correct spelling requires.</li> <li>Fixed cosmetic issue #3460062</li> <li>Fix incorrect condition check in PCRE using</li> <li>Fixed bug #3386163, setting <code>REMOTE_ADDR</code> behind HTTP Proxy feature was not working.</li> <li><p>Lineup with Boost.Locale:</p> <ul> <li>fixed problems with build with clang</li> <li>fixed handing of invalid characters in <code>MultiByteToWideChar</code> API on windows</li> </ul> </li> </ul> </div> CppDB 0.3.0 Released http://blog.cppcms.com/post/91 http://blog.cppcms.com/post/91 <div style="direction:ltr"> <p><em>New Features:</em></p> <ul> <li>Added session specific storage for custom data</li> <li>Added support of one time initialization</li> <li>Added version number API</li> <li>Added an option to clear the connections pool</li> <li>Added busy_timeout option to sqlite3 backend.</li> <li><p>Changed library version format to Major.Minor.Patch</p> <ul> <li><code>Major</code> is updated when the library breaks its ABI or API, should not happen often.</li> <li><code>Minor</code> is updated when new features or new API is introduced, The library remains fully backward compatible</li> <li><code>Patch</code> - maintenance bug fix release, no changes in public API.</li> </ul> </li> </ul> <p>Bugs:</p> <ul> <li>Fixed bug #3451653 - disconnected connections are recycled to the pool</li> <li>Fixed issue #3439445 - build problem on some distributions</li> </ul> </div>