It's not the size of the dog in the fight, it's the size of the fight in the dog. Mark Twain

To Upgrade G-WAN: (a) overwrite your ./include files and the gwan executable with archive files and then (b) run G-WAN once without -d (daemon mode) to make sure that all your servlets and handlers compile without modifications.

Year 2011
Year 2010
Year 2009

Scripts in C#, Go, JS, Lua, Perl, PHP, Python, Ruby, Scala, Throttling, etc.



  • The 15 programming languages run without handlers: they are loaded if a file using the appropriate extension (*.c, *.cs, *.cpp, *.d, *.go, *.java, *.js, *.lua, *.m, *.mm, *.php, *.pl, *.py, *.rb, *.scala) exists in the /csp directory.
  • Read the /csp/served_from.c example; http_t has changed (pointers have been replaced by offsets).
  • Read /csp/entity.c and /www/csp_entity.html to see how to handle POST/PUT/DELETE requests with entities of arbitrary sizes and encoding (without handlers).

    For the sake of history: G-WAN's development has started exactly 4 years ago, on December 25th 2008.

G-WAN v3.12.25/Linux: Major Development Release


  • added throttle_reply() to shape bandwidth (thanks Daniel)
  • fixed a kv_get() issue missing similar keys (thanks to Rob Martinelli)
  • fixed a NUMA affinity mask issue (thanks to Eryong for the report)
  • fixed a bug on the XFS file system (thanks to Victor Mierla's heads-up)
  • return 0; now closes a connection from servlets (thanks K. K. Lou)
  • now following symbolic links used for listeners (thanks K. K. Lou)
  • fixed a sendfile() exclusion due to a too large file size threshold
  • added more efficient Javascript and HTML <script>minification
  • added automatic daemon deadlock detection, logging and recovery
  • added support for G-WAN .NET C# servlets, G-WAN's 7th language
  • added the SRP-6 password-based authentication and key-exchange
  • fixed Java GC/threading references issues (thanks George)
  • for third-party code, enlarged the G-WAN workers stack size to 10 MB
  • added md5(script) footprints and signatures to the gwan.log file
  • renamed Web beacon from !op.gif to nop.gif for third-party tools
  • fixed a connect() timeout issue, the function will now use any delay
  • fixed an error when the root logs folder was not there (thanks Ersun!)
  • changed "%llk" units from "KB" to "KiB" ("MiB", "GiB"...)
  • fixed folder dates in directory listings (thank Kiswono's report)
  • added directory listing sorted columns (name / type / date / size)
  • fixed an sha2() glitch breaking the feature, thanks Richard for the report
  • added gc_init() to better pick allocation strategies (garbage collection)
  • added gc_malloc() previously not exported, thanks Richard for his email
  • added mp_malloc/mp_free() for on-demand user-defined memory pools
  • changed ptrs into offsets in the http_t struct to cope with READ_XBUF resizes
  • added: "%H" escape_html(), "%R" url_encode(), "%T" html2txt()
    (like for "%s", you can specify the length: "%.10H", str or "%*H", 10, str)
  • allowed POST/PUT/DELETE to report both URI params and an entity (thanks Paulo)
  • fixed a typo breaking the "text/cache-manifest" MIME type (thanks to Charlie)
  • even when setup by a handler, the query_char code was not used (thanks Christian)
  • rewrote various server internals, making it 100k requests/sec faster and more scalable
  • Cookies have an ending null and http_header(HEAD_ADD) stacks data (thanks Christian)
  • added a get_env(REQUEST_LEN) value to ease request pipelining verification in handlers
  • added a get_env(SERVER_BIN_ADDR) value for when someone needs the integer version
  • added a get_env(REQUEST_TIME) value in micro-sec to check request processing latency
  • added a get_env(MAX_ENTITY_SIZE) value to let people change the POST entity size limit
  • the xbuf_frurl() call inverted the POST and PUT methods (thanks Warren for the heads-up)
  • rewrote the G-WAN memory allocator to get more options and to avoid the glibc kill-swiches
  • a couple of typos have been fixed in the kv.c example: <table> tag not closed (thanks Volodymyr)
  • handlers can now use #pragma debug to dump symbols/line numbers in crash reports (thanks Terance)
  • jsn_add_real()/jsn_add_integer() replace jsn_add_number() to fix u64 rounding (thanks Terance)

glibc and Kernel Compatibility

If your system supports epoll (kernel 2.6, glibc 2.3.2) then G-WAN should run. To use multicore systems G-WAN needs kernel 2.5.8 and glibc 2.3.4 (the no-longer buggy version). To do more advanced things like bandwidth shaping glibc 2.7+ is required (no longer in G-WAN v4). Feedback is welcome.

After almost all glibc was rewritten, many things were broken because of two reasons: (1) we could not find any documentation listing which return value method each syscall is using and (b) glibc must be used almost completely or not at all: mixing its features with your tested-as-fully-compatible calls will lead to mysterious delayed glitches that resolve magically once you stop trying to "do better".

To preserve the compatibility on buggy glibc releases (some bugs are clearly the result of politics rather than technical goals) and on different Linux kernel versions, there is a lot of value in replacing glibc syscall wrappers – but, to say the least, everything is made to discourage the practice. More time will be needed to find how this can be done (help from experienced kernel programmers is welcome).

Coming Next

Many newly implemented features will be documented in the next releases published in 2013, including:

  • Protocol Handlers (SSL...)
  • Servlet/Handler Streaming
  • a Caching Reverse-Proxy
  • an Elastic Load-Balancer
  • a Layer-5 (TCP/IP) Firewall

The timeline was 3 times larger with the details about the 5 features above, so you can measure the amount of work to document them and to publish relevant examples. Many requests came for an 'intermediate' release, and this is what v3.12.25 is.

On our TODO list: KV persitence working on distributed topologies to let G-WAN manage Big Data jobs from A to Z.

Sincere thanks to all the people who reported bugs or provided ideas and great insights: that's what allows G-WAN to better match your needs.

Fixed broken daemon mode syntax (sudo ./gwan d:www-data)


G-WAN v3.3.28/Linux: Development Release

  • on systems where PHP was installed, G-WAN was blocking because of a PHP detection glitch
  • the daemon mode was broken in v3.3.27 due to a rewrite of the command-line options parsing.

Thanks to Ferhat for the "-d" heads-up.

RESTFUL reloaded (RESTFUL URIs without rewrite)


G-WAN v3.3.27/Linux: Development Release

  • fixed a variable initialization involved in very large file transfers (thanks to Helgi for the feedback)
  • added two get_env() values QUERY_CHAR and DEFAULT_LANG for G-WAN handlers to produce RESTFUL URIs.

In addition, by moving the query character from "/?folder/argv.c" to "/folder/?argv.c", the newly adopted script path mapping makes it possible for dynamic-contents URIs using sub-directories to be RESTFUL.

On a per-listener basis, you can use get_env() to have RESTFUL paths like "/~hello" instead of "/?hello.c" and even "/folder/~argv/first=1/second=2" instead of "/folder/?argv.c&first=1&second=2".

The QUERY_CHAR, chosen among  - _ . ! ~ * ' ( ) , lets you replace the  ?  query character (see the examples above) while the DEFAULT_LANG value lets you ditch the script file extension (*.c, *.cpp, *.java, etc.) for the programming language of your choice (the default DEFAULT_LANG is the C language):

int init(int argc, char *argv[])
   // the QUERY_CHAR character can be chosen from the following set: 
   //  - _ . ! ~ * ' ( ) 
   // (see RFC 2396, section "2.3. Unreserved Characters")
   u8 *query_char = (u8*)get_env(argv, QUERY_CHAR);
   *query_char = '!'; // use "/!hello.c" instead of "/?hello.c"
   // by default, DEFAULT_LANG = LG_C (ANSI C)
   // LG_C, LG_CPP, LG_JAVA, etc. are defined in /gwan/include/gwan.h
   // and in
   u8 *lang = (u8*)get_env(argv, DEFAULT_LANG);
   *lang = LG_CPP; // use "/!hello" instead of "/!hello.cpp"
   return 0;

// if, like above, init() does not define notification states with
// get_env(argv, US_HANDLER_STATES), then the main() and clean() 
// handler calls defined below will never be invoked
// (URL rewriting can't be done faster)
void clean(int argc, char *argv[]) { }
int  main (int argc, char *argv[]) { return 255; }

Now you can have RESTFUL URIs like /blog/~user/thom and /blog/~articles/2012/3/26#class+members without having to do any rewrite in a G-WAN handler.

But if really want to rewrite URIs to remove the query character, then use a handler this way:

int main(int argc, char *argv[])
   const long state = (long)argv[0];
   if(state == HDL_AFTER_READ)
      xbuf_t *read_xbuf = (xbuf_t*)get_env(argv, READ_XBUF);
      xbuf_replfrto(read_xbuf, read_xbuf->ptr, read_xbuf->ptr + 16, "/blog", "/?blog");

      // Note: you may have to look for the ending double-CRLF to check
      //       if there is another pipelined request to rewrite
   return 255; // execute next connection step

Thanks to Richard for the DEFAULT_LANG idea.

JSON precision fix, enlarged workers' stack size (2 MB)


G-WAN v3.3.23/Linux: Development Release

  • fixed a JSON precision numeric issue with parsing and rendering
  • enlarged the G-WAN worker threads' stack size for third-party code.

Thanks to Alex, Paul and Terence for the feedback.

The /csp/json.c example has been updated to use the new internal format: node->number is now either node->integer (signed 64-bit) or node->real (a 'double'). Because of this, you have to update the ./include/gwan.h file.
The public API remains unchanged.

Comet push_list(), getns(), woff/eot MIME types, Gzip caching


G-WAN v3.3.21/Linux: Development Release

  • added 'Comet' streams push_list_add()
  • corrected a getns() offset (thanks Thomas)
  • added the woff/eot MIME types (thanks Paul)
  • cacheadd()/cacheget() now set/get MIME type
  • added Gzip caching in /gwan/gzip (thanks Ersun)
  • fixed If-None_Match/Last-Modified (thanks Ersun)
  • reversed Java env. variables and paths (thanks Oleg)
  • fixed a typo breaking http_headers() (thanks Christian)
  • added a new gwan -w switch (nb of workers, thanks Ferhart).

For Comet, see the /csp/comet.c example. Memory usage could be reduced to handle hundreds of thousands of Comet clients (but it makes sense to work on this only if people need this feature to scale that much – feedback is welcome). Besides using the /www/csp_comet.html form, you can also use: wget ""

Gzip'ed static files are now cached on disk under the /# (root or virtual) host folder to save CPU resources.

For the new cacheadd()/cacheget() MIME type argument, see the cache.c or the /handlers/main_redirect_404.c upated examples. Storing the MIME type lets you skip building custom HTTP headers when the resource path does not contain a known file extension.

/csp? prefix, index.html in sub-folders, Intel CPU Cores detection


G-WAN v3.3.7/Linux: Development Release

The way to invoke scripts has changed: the http://localhost/csp?hello.c prefix has been removed. You must use http://localhost/?hello.c from now.

  • removed the /csp? prefix (removing the need for handlers dedicated to this task)
  • added http_header(HEAD_ADD) support for servlets (not only for handlers)
  • fixed incorrect rendering when serving small index.html files in sub-directories
  • restored the previously disabled gzip compression during high concurrency loads
  • relaxed the stack frame protections for 32-bit crash reports (allowing more details)
  • fixed an incorrect case when detecting the number of Cores of some Intel CPUs.

Thanks to Ersun, Christian and Thomas for the feedback.

Many users were using custom handlers to remove the /csp? prefix used to invoke G-WAN scripts and this was often creating problems (both in terms of performance and reliability). These circonvolutions will no longer be needed.

If you absolutely need to get rid of the '?' query character then your handler will merely have to overwrite one single character:
(in the example below, a * is used instead of the ?)

  client request : /*hello.c   (make sure that a slash precedes the star: "/*")
  handler rewrite: /?hello.c   (G-WAN returns 404 if the script does not exist)

The RESTFUL substitute character can safely be chosen from the unescaped URI character set: - _ . ! ~ * ' ( )
(see rfc_2396 section "2.3. Unreserved Characters").

The PDF manual, the examples and the Web site have been updated to reflect those changes.

Content-type handlers, allocations, /folder/index.html, cacheget()


G-WAN v3.3.3/Linux: Development Release

  • removed timestamp constraints from the internal malloc() implementation (faster, less RAM overhead)
  • fixed an unfortunate "If-Modified" test returning 304 HTTP codes disabling /folder/index.html
  • modified cacheget() to return the expire delay in seconds (not ms), like the cacheadd() argument
  • allowed content-type handlers to be triggered for all the kinds of traffic, whatever the file sizes
  • logged more details about the Java VM detection and made sure that symbolic links are followed.

Thanks to Christian, Ersun, and Thomas.

System counter, better crash reports for older systems, code cleaning


G-WAN v3.3.2/Linux: Development Release

  • replaced a system counter by an internal counter (resolving a rare and erratic crash/freeze condition)
  • added more Java VM selection/loading/usage errors to gwan.log for troubleshooting (thanks Thomas)
  • removed the (pointless now) www directory traversal used to count files and sum sizes (thanks Ersun)
  • fixed the HTTP header detection for servlets defining their own headers (avoiding duplicated headers)
  • adapted and enhanced crash reports for older Linux system versions (thank you Christian for the report)
  • more code restructuring – leading to a lower memory usage and more speed & scalability (thanks Tom).

Thanks to Christian, Ersun, Tom, Thomas and Peter.

Maintenance release, code cleaning, automatic helpers


G-WAN v3.2.24/Linux: Development Release

  • various changes intended to open a wider range of compatibility with third-party tools (Java VM, FastCGI, etc.).

Java environment variables, Java G-WAN API class


G-WAN v3.2.23/Linux: Development Release

  • added suport for the $JAVA_HOME, $JDK_HOME and $CLASSPATH environment variables (now G-WAN uses them):
  • $JAVA_HOME or $JDK_HOME are used to locate the JVM if it is not under /usr/lib/jvm
  • $CLASSPATH is used to load external classes and JAR archives with import (see below)
  • added a dedicated class for the G-WAN Java API, making native calls look more Java-like (see rewritten examples):
  • 1
    import api.Gwan;
    public class hello 
       public static int jmain(long env, String[] args) 
          Gwan.xbufCat(Gwan.getReply(env), "Hello World");
          return 200; // HTTP status (200:'OK')

To load external classes with import, add their path to the $CLASSPATH environment variable:

 export CLASSPATH=$CLASSPATH:/.../myclasses

You can clear the environment variable with: unset CLASSPATH.

To load JAR archives with import, add them to the $CLASSPATH environment variable:

 export CLASSPATH=$CLASSPATH:/.../myclasses.jar

Now you can extend G-WAN Java servlets with external libraries!

Change of Java VM, compliance, smaller JVM footprint, better crash reports


G-WAN v3.2.22/Linux: Development Release

  • changed the JVM and Java compiler used for G-WAN native Java scripts (and reduced the JVM memory footprint)
  • added the module name (/lib/,, gwan, etc.) for each stack frame in crash reports.

Thank you Oleg and Thomas.

Note: GCJ has been left for the OpenJDK or the SUN/Oracle JVM because its library does support basic things like formating float/double variables.

On Linux Debian 6.0 64-bit, the G-WAN + Java VM memory footprint (with all the archive scripts loaded) is:

  • G-WAN + OpenJDK ..... 20 MB RAM
  • G-WAN + SUN Java .... 21 MB RAM

The Java VM is loaded only if a /csp folder contains *.java scripts.

Java native scripts, init.d script and AMD CPU count glitches


G-WAN v3.2.20/Linux: Development Release

  • added support for the Java programming language (G-WAN native Java scripts)
  • no longer listing HTTP errors 304 in error.log (still listed in access.log)
  • fixed a 'service gwan start' issue when not using the init.d script manually
  • fixed a 64-bit crash with recent versions of Ubuntu (v11.x or v10.10 fully-patched)
  • fixed the number of AMD CPUs for packages supporting a low cpuid feature set.

Thank you Brian, Ersun, David and Jason for the helpful reports.

Note: G-WAN serves Java very quickly (just test /csp? with weighttp -t 4 on a 4-Core CPU) but it made little sense to expose most of G-WAN's C API (like xbuffers) to Java servlets because Java does the job without the overhead of C/Java string and array (back and forth) conversions. Java must be used to generate the dynamic contents, and then G-WAN must be involved for the task of serving those contents. This is why the G-WAN API made available for Java is much smaller than for the other languages: working together to raise the bar is much better than trying to do it all for Java.

G-WAN + GCJ JVM has a 42 MB memory footprint on Linux Debian 6.0 64-bit.

Log files, Formatting, Memory recollection, C99 and C++0x scripts


G-WAN v3.2.11/Linux: Development Release

  • fixed an erratic bug happening when log files are enabled (introduced with version 3.1.18)
  • added space-padding ("%12d" instead of "%012d") and left-aligned ("%-12d") capabilities
  • added more pertinent information in the 'pretty' crash reports to make them even more relevant
  • added yet another way to release memory to the system every 5 minutes when traffic is low
  • added compiler flags to enable C99 and C++0x in all scripts (both servlets and handlers).

Thank you Thomas, Arek and Ersun for the discussions.

Full-crash reports in /gwan/trace file


G-WAN v3.2.9/Linux: Development Release

  • added to the trace file (logging handler faults) the same pretty crash reports that we have for scripts.


An electricity company power-outage combined to a data-center UPS failure has made the Web site unavailable from 8:57am to 11:40am (local time, GMT+1).

Memory address in /gwan/trace file, crash reports


G-WAN v3.2.8/Linux: Development Release

  • added the memory address pointer to the /gwan/trace file crash reports
  • fixed a typo in the /csp/curl.c example (thank you Volodymyr for the tip)
  • fixed the new signal handler which was triggered only once for crash reports.

JSON rendering, unhandled Ctrl-c from Terminal


G-WAN v3.2.7/Linux: Development Release

  • handled Ctrl-c to exit cleanly, going as far as to document the exit types in the trace file
  • fixed the JSON rendering of some real values (a bit less space is saved, but all numbers work).

Thanks Thomas!

AMD Physical CPUs, Signal handler


G-WAN v3.2.6/Linux: Development Release

  • fixed the signal handler to log scripts/gwan faults in gwan/trace and logs/error.log
  • fixed the detection for AMD physical CPUs (here also, the problem was with CPUs, not CPU Cores):
 1 AMD Phenom(tm) II X6 1100T Processor (6 Cores/CPU, 1 threads/Core)
 Using 6 worker threads

Thanks to Michael for the feedback.

Updated detection of the number of CPUs and CPU Cores


G-WAN v3.2.5/Linux: Development Release

  • fixed the detection for recent Intel CPUs (the problem was with CPUs, not CPU Cores).

Please let me know what you get with AMD CPUs (I don't have any so I can't test them). You can see what G-WAN has detected in the gwan.log file:

 1 Intel(R) Xeon(R) CPU W3680 @ 3.33GHz (6 Cores/CPU, 2 threads/Core)
 Using 6 worker threads

G-WAN's by-default policy is to use one worker thread by CPU Core.

Thank you Thomas for the heads-up.

Ubuntu 11 (beta), get_env() values for G-WAN scripts threading


G-WAN v3.2.3/Linux: Development Release

  • added support for Ubuntu 11 (this Ubuntu version is still in beta, the long-term release is 10.04)
  • added the following get_env() values for G-WAN scripts:
  •  NBR_CPUS,    // int NBR_CPUS;    // total of available CPUs
     NBR_CORES,   // int NBR_CORES;   // total of available CPU Cores
     NBR_WORKERS, // int NBR_WORKERS; // total of server workers
     CUR_WORKER,  // int CUR_WORKER;  // current worker thread: 1,2,3...

    NBR_CORES = (number of Cores per CPU) * (number of CPUs).

    NBR_WORKERS = number of worker threads created (by default this is NBR_CORES, but it can be changed by renaming the gwan executable to gwan_2 for 2 worker threads, hence the NBR_WORKERS value which lets G-WAN scripts know it).

    CUR_WORKERS lets scripts get the number of the current worker thread. This is useful to make thread-safe code.

Thank you Philippe and Thomas.

Very large files download fix


G-WAN v3.2.2/Linux: Development Release

  • fixed the download of very large files.

Thank you Carlos for the tests!

Minor bug fixes, G-WAN scripts speedup, smaller memory footprint


G-WAN v3.2.1/Linux: Development Release

  • added the VHOST_ROOT definition to gwan.h and made sure that it works as expected
  • tested various strategies to achieve better performance in the G-WAN server and its scripts
  • added remarks in the hello.d example and the related FAQ for the 'D' programming language
  • reduced the pollution of the scripts namespace for better performance and memory footprint.

Thanks to Thomas and Ersun!

Philippe, a long time BASIC fan, has suggested that G-WAN should let us all use this venerable programming language (30 years ago I wrote "STYLED" a GUI coded in asm for the BASIC language). His efforts and the help of people who worked hard at reviving the joys of BASIC will make his dream come true!

This BASIC being compiled (and used from G-WAN), it will smoke many 'modern' Web development languages.

Speedup, VHOST_ROOT, FONT_ROOT, and the 'D' programming language


G-WAN v3.1.31/Linux: Development Release

  • Re-organized portions of the 64-bit code to get the same performance than in the 32-bit release
  • added a VHOST_ROOT value for get_env() for even quicker access to this G-WAN-relative path
  • this new release fixes a recent glitch which made the angel process (-d) fail to restart the child
  • added (experimental*) support for the 'D' programming language (see the hello.d example)
  • made the path returned by get_env(argv, FONT_ROOT) be absolute instead of relative.

Thanks to Thomas and Ersun!

[*] The D programming language requires you to write "extern (C)" before all (translated in D) gwan.h prototypes (see the hello.d example). The D import replacement for the C include directive could probably be used – if only its file-system mapping was documented). Any help in this matter is appreciated.

libcurl, flv.c, Async. [client] calls, warning, Obj-C, get_env(), etc.


G-WAN v3.1.27/Linux: Development Release

  • added a new servlet example /csp/curl.c for libcurl (which supports many protocols)
  • fixed an flv.c handler crash when a large video was heavily seeked in a random manner
  • removed a compiler flag which prevented the async. BSD socket [client] calls from working
  • made it possible to disable a listener by just adding an underscore ("_") at its beginning
  • added an explicit warning for those directories locked by file permissions, SELinux, etc.
  • added a new entry in the server report() function to report the name of the Unix OS
  • added a new procedure for Obj-C/C++ on Linux distributions which use different paths
  • the get_env() function has been simplied and all the servlets/handlers updated:
  • 1
    // that was for prior versions
    u32 *states = (u32*)get_env(argv, US_HANDLER_STATES, 0);
    // note the missing parameter at the end
    u32 *states = (u32*)get_env(argv, US_HANDLER_STATES);

    Far too many users were confused by the two ways to use pointers with this function.

Thanks to Carlos, Eric, Fifi, Tim and Bob!

The real async. BSD socket [client] calls magic has been recoded in asm and will be released once fully tested.

The D, COBOL and Scheme programming languages are on their way to be used from G-WAN!

gwan.log first timestamp entry typo, Listener's Handler initialization


G-WAN v3.1.24/Linux: Development Release

  • fixed the initialization of the init() states with several Listeners (only the first listener was initialized)
  • fixed a rounding error which sometimes added garbage at the end of Gzip-compressed HTML pages
  • fixed the first gwan.log timestamp typo introduced in v3.1.23, making it difficult to open/read the file.

Thanks to Philippe and Volodymyr for the tips!

Handlers freeing at G-WAN shutdown, sendemail() typo fixed


G-WAN v3.1.23/Linux: Development Release

  • fixed G-WAN Connection Handlers that were not properly freed at program shutdown
  • fixed a typo introduced in v3.1.22 and which was breaking the sendemail() command.

Thanks Tim, Steven, Rick and Thomas!

Better error for empty script file, or script without main()


G-WAN v3.1.22/Linux: Development Release

  • now G-WAN reports why an empty script or a script without main() failed to run
  • added whether the G-WAN process is 32-bit or 64-bit in the server_report() function
  • added prettier warning / error formatting for the compilation / linking phases
  • since I was asked the question, the best terminal settings to use are:
    • Built-in Scheme: "White on Black"
    • Text color / Bold Color: Same as text color
    • Palette: "Linux Console"
    Error: test.c
    /opt/gwan/ In function 'main':
    /csp/test.c:16: error: 'i' undeclared (first use in this function)
    12| int main(int argc, char *argv[])
    13| {
    14|    xbuf_cat(get_reply(argv), "Hello World");
    16!    return i;
    17| }

Thanks to Ersun, Eli, Thomas and Tim!

G-WAN Connection Handlers can now use C++, Objective-C/C++


G-WAN v3.1.21/Linux: Development Release

  • G-WAN Connection Handlers can now use C++, Objective-C/C++ (not only C).

Thanks to Thomas for the suggestion!

Note that G-WAN Content Handlers (like flv.c) still must use C (extending them will be done later).

Static requests' Query string for Handlers


G-WAN v3.1.20/Linux: Development Release

  • allowed handlers to use get_env(QUERY_STRING) for static requests like:
      ----   ------------- -- ---------------- --- --------
        |           |       |         |         |      |
      protocol   hostname  port      path     query  fragment (section within document)
                   /        /         |         |          \

Thanks Arek!

Compilation Warnings, 32-bit crash reports


G-WAN v3.1.19/Linux: Development Release

  • allowed G-WAN 32-bit to issue full crash reports (I am now using G-WAN 64-bit)
  • filtered system replies containing UNICODE characters (what a stupid idea, really)
  • fixed a typo preventing any setup $TMPDIR substitute from being used by G-WAN
  • fixed a JSON glitch which prevented large data sets parsing/rendering to work
  • allowed compilation warnings even when no compilation error takes place.

Thanks to Paul and David for the heads-up!

HTML minifying, MIME types, JSON rendering, Linux translations, "%v" trick


G-WAN v3.1.18/Linux: Development Release

  • fixed a JSON printing glitch ("10.0" was stored as "10." and is now stored as "10")
  • fixed HTML minifying eating spaces because of an undetected HTML "</script>" tag
  • fixed "./gwan -r argv.c a b c" to let the "-r" switch use argv[] command-line arguments
  • added get_env()'s REQUEST_TMO and MIN_SEND_SPEED to tune the DoS shield
  • added support for $TMPDIR on those systems where the /tmp directory may be locked
  • added new MIME types (*.m, *.mm, etc.) to cope with the newly supported languages
  • added localization checks to make all the system replies make sense for G-WAN
  • added a filter to remove repetitions in s_snprintf()/xbuf_xcat()'s "%v" outputs:
  •      0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 | ................
        16: *              (we skip 250 lines here)
     4,032: 00 00 00                                         | ...

    This is useful to stip-down KBs-long junk requests before logging. "%v" lets G-WAN keep relevant data (binary contents or obvious junk requests) in a readable form – without the bloat.

Thanks to Aris, Ersun, Thom, Andy, Ferhat, Emmanuel and Mike!

Minor enhancements and 32-bit bug fix


G-WAN v3.1.9/Linux: Development Release

  • allowed CSS and Javascript files to use extended character sets (UTF-8)
  • gzip compression will now work in all the cases as long as files are < 2 MB.

Thanks to Michael and Manuel for their feedback!

Minor enhancements and 32-bit bug fix


G-WAN v3.1.8/Linux: Development Release

  • fixed a 32-bit issue with v3.1.6/7 which prevented the compilation of scripts
  • added a test to prevent two scripts from conflicting while using the same name
  • added more checks to allow G-WAN to run with artistic folder and file names.

Thanks to Stefan, Arek and Slavomir for their tests!

Much faster compilation, faster log files, AMD CPUs boost, bug fixes


G-WAN v3.1.7/Linux: Development Release

  • fixed a glitch with virtualization layers which require full path to work
  • fixed a glitch with virtualization layers which rename the CPU ID string
  • added a missing test to let gwan run without access/error log files enabled
  • allowed the compilation of scripts which have exotic filenames (like spaces).

Thanks to Ersun, Slavomir, Stefan and DeepInit (Arek) to point those issues!

Much faster compilation, faster log files, AMD CPUs boost, bug fixes


G-WAN v3.1.6/Linux: Development Release

  • optimized the compilation of scripts (whatever the language) by a factor three
  • optimized the log file rotation security (see previous release) for less overhead
  • removed an Intel-specific test which disabled an optimization for AMD processors
  • fixed the daemon mode which did not start due to a workaround needed for 64-bit
  • fixed bmp_t accidentally not updated in gwan.h (it was correctly documented here)
  • fixed an xbuf_insert() 'universal' interface typo which was breaking the feature
  • replaced the C/C++-like Objective-C/C++ examples by Thomas Meitz's code
  • added a G-WAN Objective-C + GnuStep example written by Thomas Meitz.

Thanks to Eric, Lucas and Thomas for the feedback!

A maintenance downtime is scheduled for today's afternoon (~4-6pm) to upgrade the version of the Linux distribution (no longer supported by its vendor). Since G-WAN v3 requires glibc 2.11+, supported by this new Linux version, the migration will also let use G-WAN v3.

Better compilation warning/error reporting, bug fixes


G-WAN v3.1.3/Linux: Development Release

  • added cleaner warning and error descriptions during compilation of C scripts
  • fixed the 'graceful kill' (sudo ./gwan -k) which crashed with the 64-bit release
  • fixed disabled gzip compression depending on internal state and file size
  • fixed a narrow case where log files would not be rotated at gwan's startup
  • tried to further secure log files rotation at 0:00am (feedback is welcome).

In chronologic order, thanks to Eric, Tim, Alex, Michael and Tomas for their useful reports!

64-bit, C++, Objective-C/C++, scripts optimizations, bug fixes


G-WAN v3.1.1/Linux: Development Release

As G-WAN now supports C, C++ and Objective-C the URI format to use is no longer "/csp/hello" but rather "/csp/hello.c" or "/csp/hello.cpp" (just like with other application servers which use suffixes like jsp, php, py, or rb). Clients can now query "/csp/hello.c" or "/csp/hello.cpp" – and get different results by running different programs.

  • added a 64-bit release (no memory limit, no more system or third-party library issues, etc.)
  • added much more detailled warning and error descriptions during compilation of C scripts
  • added multi-pass optimization and native CPU intrinsics for the local CPU type in C scripts
  • added a 'universal' interface for G-WAN scripts to support more compiled languages:
    • asm ............... *.asm
    • Ada ............... *.ada
    • BASIC ............. *.bas
    • C ................. *.c
    • C++ ............... *.cpp
    • COBOL ............. *.cob
    • D ................. *.d
    • Fortran ........... *.for
    • Google Go ......... *.go
    • Java .............. *.java
    • Modula ............ *.mod
    • Objective-C ....... *.m
    • Objective-C++ ..... *.mm
    • Pascal ............ *.pas
    • Scheme ............ *.scm

    Today, G-WAN natively supports Assembly, ANSI C, C++ and Objective-C/C++ while Javascript, Lua, Google Go, and Python are supported by G-WAN handlers which call a library that implements the language (click the links for each handler). Native support is more convenient to use and executes faster, hence the native implementation of languages already supported by handlers.

    PHP will gladly be added to the list above the day a thread-safe PHP-embed library (or even better, an up-to-date PHP compiler) is made publicly available.

  • fixed the first first line of comment minified in JS files (minification only works in "sudo ./gwan -d" mode)
  • fixed a bug in the floodfill algorithm used for pie and ring charts (the charts still need a bit of love)
  • fixed a bug happening when Gzip is supported but the payload content-type can't be compressed
  • fixed a bug happening during a maintenance process aimed at defragmenting the application memory
  • fixed the close() BSD async. call that blocked further connections in client mode after a first call.

More 'Hello World' examples using the new 'universal' interface to natively use new programming languages will come soon (see hello.c, hello.cpp, hello.m and

All the old examples have been rewritten to compile without errors and warnings. You will probably have to work a bit to polish your code too – that's all the value of extended compiler diagnostics.

If you were using Linux 32-bit to get better G-WAN crash reports, it is advised to switch to Linux 64-bit (much faster than Linux 32-bit) as the G-WAN 64-bit release is now on par with the 32-bit release in this matter.