My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
News  
Project News
Featured, news, Phase-Support
Updated May 25, 2009 by phr...@gmail.com

News

May 25, 2009 - canopyctl and the configuration format

I have been making some changes this weekend that I have been thinking about for a while, regarding the canopyctl control tool and Canopy HTTPd's configuration file format. Basically, canopyctl should use the same parsing code as the server for its configuration file. This would mean that environment variables would be supported in both (along with substitution), and for all given purposes, the control tool is just a configuration reader that reads one line at a time (albeit with a slightly augmented command set). At the same time, I am modifying the configuration code so that variables are not typed anymore, it didn't make that much sense and bloats the code anyways.

February 10, 2009 - Modifications to the startup sequence

Yesterday, I commited several modifications to the way Canopy HTTPd performs its startup sequence. First, the call to chroot() has been moved earlier in the startup, right after the configuration file has been read. This is done for two reasons:

  • we make sure that the call to daemon() does not link file descriptors 0, 1 and 2 to /dev/null outside of the chrooted directory (these descriptors could be used to break out of the jail)
  • the server's runtime files, such as the PID file and the control socket, will now always be created inside the chrooted directory, and this guarantees that the server will be able to unlink them at shutdown

The other major change is the replacement of the seteuid()/setegid() calls by their setuid()/setgid() equivalents. By dropping all privileges (including the real user and group ID), we are guaranteed that the server will not be able to regain root privileges through an exploit.

August 28, 2008 - Changes to the handler mechanism

I have made some more changes to the list of arguments passed to Canopy handlers, but this time, it's for good. Instead of adding new parameters, I decided to create a httpd_hdlr_args structure that contains all the parameters that are made available to handlers. This has one huge advantage: the handlers signatures won't change anymore, it's only the layout of the structure that will change in the future. For backwards compatibility, the fields will not be rearranged. Instead, the arguments structure will contain a version number, which will allow modules to figure out if they have been compiled with the right structure definition.

At the same time, some changes were made to add an extra void pointer parameter to handlers. This can be anything (or it can be nothing, simply NULL), because the Canopy core doesn't make any use of that field; it is meant to be used strictly by the handler. This was a requirement for mod_java, in order to have the same C handler call different Java methods based on context.

Now that this is in the tree, there are changes that a very basic mod_java will be part of the 0.3 release.

August 19, 2008 - pre-0.3 release

Well, after much testing and code review, I finally nailed down the bug that was causing the server crash. As I had presumed, it was a cnp_free() call on a static block. The bug was in the http_uri_free() function of src/lib/http/uri.c; it attempted to free the uri_scheme char array.

Now that this problem is fixed and most of my code is commited, it's time to prepare for a new release. I will be doing stress testing on the code for the next days, and version 0.3 should be tagged by the end of the week.

August 18, 2008 - Update

Tonight, I will start commiting a lot of changes to the source tree. It is likely that I will break the tree entirely for a short period of time. My goal is to bring back a tree that builds by tomorrow night.

In the meantime, I would appreciate the help of anyone interested in looking at code. Once everything is commited, the source tree will be very close to a 0.3 release, but there is currently a showstopper. The server crashes after about 20 requests have been made when it attempts to free an entity structure. Once this bug is fixed, it's a matter of turd polishing to prepare for a release.

March 23, 2008 - Modules

I've been working mostly on two things for the past couple of days: canopyctl and modules. The canopyctl(1) tool now has a "working" version in the tree. It can connect to the server and do the initial handshake (very simple for now, just a version exchange), and supports restart, shutdown and loading of modules.

The other big improvement is the addition of two modules that actually work: mod_cgi and mod_dir_index. Most of the work went into making mod_cgi work, after that mod_dir_index was relatively simple to implement, with fewer handler bugs in the way.

January 30, 2008 - Unslacking

It's been a while since my last contribution to the project, but I finally got back to coding on it again when I have spare time, so expect updates over the next couple of weeks. The first notable addition is the inclusion of the canopyctl command-line control tool. It is far from finished but it will soon be able to handle simple commands such as shutdown/restart and loading/unloading of modules at runtime. The tool can be used in two-ways: either as a single-command tool that can be used for the most basic tasks such as restarting the server:

# canopyctl restart

or it can be used to type several commands in a single session, in which case it starts a shell-like interface where you can enter commands sequentially. The interface provides several of the features that we have come to expect from shells, such as history, command completion, and basic scripting.

Back to coding...

September 12, 2007 - Canopy HTTPd 0.2 Released

After several weeks of bug fixing and testing, version 0.2 of the Canopy HTTPd server was tagged on August 31, but I only had time to create the tarball yesterday, so it is now available for download. This release is, above all, a major bug fix release, with most of the memory leaks plugged, and several potential deadlock cases removed.

There is currently no ChangeLog for Canopy releases. This should be fixed starting with version 0.3, when an autogenerated ChangeLog file will be shipped with the tar archive.

August 13, 2007 - Performance Improvement

I spent the last weekend ironing out more bugs and making the overall stability much better. I used the siege testing and benchmarking tool (found at http://www.joedog.org/JoeDog/Siege to spot most of the issues (found one race condition in the dequeueing function and two deadlocks). Last night, I could successfully run the tool with 10000 requests without the server crashing.

At that point, I started looking at memory usage and went to hunt memory leaks in the source tree. I found several (some pretty bad ones too, I wasn't even freeing the request and response structures once the cycle was done, and the connections never actually got closed because of a dangling reference), and the memory usage dropped from 32MB to 13MB for 10000 requests.

August 8, 2007 - Bug Fixes and New Features

I fixed several bugs in the trunk last night and added a couple of features that make the server a bit more responsive. Here's a short list of the changes:

  • fixed the canopy initialization problem by adding support for library constructors and destructors; now the Canopy library is automatically initialized
  • fixed an invalid pointer in a call to cnp_log() in the configuration file parser that would cause the server to crash
  • fixed a bug that would cause the server to crash on shutdown because it tried to write to a closed log channel
  • fixed a problem in the allow/deny configuration handler which would cause it to crash because it didn't check the size of the argument vector
  • added a function to generate HTML output giving a short description of the problem when the request was not OK
  • added the Server header to all responses
  • removed the Last-Modified header in responses when the content does not map to a file (i.e. dynamic content)
  • reenabled -V for version display
  • added description of -f to the usage output

Sign in to add a comment
Powered by Google Project Hosting