Version 20 of Wibble news

Updated 2011-02-04 01:09:57 by AMG

AMG: This page is for Wibble news and announcements. Discussion is welcome, but if it gets lengthy it should be moved to the Wibble discussion page. Announcements prior to the 2010-11-06 are embedded in Wibble discussion and Wibble discussion archive. Detailed change reports are at Wibble change log.

Fetching backrefs...

2011-02-03 - Inter-coroutine communication, text/xml POST, cleanup scripts, contentchan

Change log: -

AMG: Lots of new features!

The biggest change is that I replaced the [suspend] and [resume] commands with a much more sophisticated inter-coroutine communication system, accessed using [icc get], [icc put], and [icc configure]. (I developed the [icc] commands for a chat application I hope to publish soon.) Here's the basic outline of ICC:

Coroutines send events to other coroutines via feeds. [icc put] sends events, [icc get] receives events, and [icc configure] configures a feed. Feeds filter which events they will accept, and [icc get] can apply additional filters. Filtering is done by applying [string match] to event names. Events can carry arbitrary data in addition to their names. [icc get] can monitor multiple feeds simultaneously, and [icc put] can send to multiple feeds. A feed can be configured to "lapse" if no [icc configure] or [icc get] is done on it within a timeout; upon lapse, the feed is destroyed and a custom script is executed, e.g. to announce that the feed has lapsed. A feed is automatically created for each client connection coroutine, and additional feeds can be created using [icc configure]. [icc get] accepts an optional timeout argument, and it can also monitor the current coroutine's input socket for readability.

Another important change is the addition of text/xml POSTs, which are needed by WebServices. Whenever data is POSTed using the text/xml enctype, it decodes the full POST into a single "xml" element of the post dictionary. (I'm still waiting for word on whether I should use [deurl] or [dehex] to do the decoding. The difference is that [deurl] treats + as space.)

Also there's now a way to register cleanup scripts that will be run whenever the current connection coroutine terminates, even if it's terminating due to an error.

Zone handlers can now send the client data from an open channel, in addition to on-disk files or in-memory strings. One day this may be useful for sending from an SQLite [incrblob]; however, this functionality currently doesn't work due to what I believe is an oversight in the implementation of [incrblob].

By request, I changed "wibble" to "::wibble".

This new version contains an example of one zone handler chaining to another. I think it was JBR who was asking about this. The [dirslash] zone handler chains to the new [redirect] zone handler. Because of the way I implemented [sendresponse] (also [nexthandler]), [redirect] does not return to [dirslash].

2010-12-22 - Empty query and post dicts

Change log: [L1 ]

AMG: I removed the query and post dicts when no query or post was made. Also, I fixed a bug that only strikes when the zone handlers fail to produce a response.

2010-12-20 - Remove ineffective code

Change log: [L2 ]

AMG: JBR pointed out that most uses of [nexthandler] are really no-ops and can be removed. I have now removed them from Wibble and the examples on this wiki. When a zone handler returns, that's the same as if it did [nexthandler $state] without modifying $state. I updated Wibble detailed description to say this.

2010-12-18 - State dicts, AJAX improvements

Change log: [L3 ]

AMG: Along with several bug fixes, I tightened up the way zone handlers work. Now they take a single, unified state dict instead of two request and response dicts. This is cool for (at least) three reasons: One, it rarely made sense to receive a response dict, so why require it? Two, this way custom options don't have to be inserted into and removed from the request dict. Three, zone handlers can create custom dicts inside the argument(s) to [nexthandler], which will be picked up by later handlers.

Of course, custom zone handlers need to be updated in order to work with the new version of Wibble. I've updated all the examples on this wiki.

I also changed the way coroutines are suspended and resumed. Now there's a [suspend] command that takes arguments naming the events that it should wait for. The coroutine will stay sleeping until one of those events happen. The original version of Wibble didn't need this, since there was only one thing that could wake up the coroutine (chan readable). Later I added asynchronous [chan copy], which constituted another event. In discussions with JCW, I found that AJAX can have other events as well. To support AJAX, I unified the interface to suspending and resuming. The [resume] command constructs a command prefix that will resume the coroutine.

I put up a basic AJAX example here: [L4 ].

I updated Wibble detailed description somewhat, incorporating some stuff from Wibble discussion. Also I moved the older stuff from Wibble discussion to a new page, Wibble discussion archive.

2010-11-13 - Non-blocking file transfers

Change log: [L5 ]

AMG: I can't believe I didn't notice this problem before. The [chan copy] invocation blocks until it's complete. I changed it to use the -command option, instructing it to resume the connection's coroutine when it's done. Then I [yield]. The [llength] of [yield]'s return value shows why the coroutine was resumed:

  • llength = 0: Socket became readable. Yield again.
  • llength = 1: Copy completed. Break out of loop and go on to the next request.
  • llength = 2: Copy failed. Error.

Also I put in workarounds for the two bugs currently posted on the Wibble bugs page. I'll back these out again when they're no longer needed.


2010-11-07 - Another new version, already!

Change log: [L6 ]

AMG: I guess I'm making up for lost time; it's been well over a year since my last big update. This update isn't nearly as big as yesterday's, but it's still progress.

I added another zone handler called script that's meant as a companion to template. Previously they were combined into a single template zone handler.

I made the vars zone handler much nicer, and error reporting is nicer too. They now share a common library routine to format the request data.

I added a few more keys to the request dictionary (time, rawtime, port).

PUT is gone.


2010-11-06 - Reorganization, new version

Change log: [L7 ]

AMG: Tired of having one giant page for everything Wibble, I reorganized into several pages.

This level of content shuffling would make RA2 happy, but I figured I'd avoid one of his major mistakes and let the Wiki do the indexing work for me. All Wibble-related pages link to Category Wibble, whose backrefs are conveniently repeated on the main Wibble page. But I can't have everything. Page history suffers, since it obviously doesn't carry over to the new pages. For history prior to today, see [L8 ].

I took this opportunity to publish the latest version of Wibble, found at Wibble implementation. You may notice that I turned off syntax highlighting for that page. Trust me, the syntax highlighting made the code far less readable (scroll through [L9 ] to see what I mean). We need to fix that. :^(

The new version digs deeper into the headers, breaking them into lists and dicts. Among other things, this made POST file uploads possible. That's another new feature I've added. I don't know if I'll ever support PUT; does anyone even use PUT? If no one speaks up, I'll drop it entirely.

I think I have more writing to do: updated documentation, new examples, etc.