Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

50 most recent check-ins

Use [expr 1] instead of [list 1] as a minor performance optimization. Leaf check-in: c639ddbed7 user: andy tags: handler-script
Rework configuration to have handlers be a script, not a list. Move [dict getnull] into the wibble namespace. Use [info level 0] instead of trying to figure out the current command name. Add [intercept] command for use in handler script. Add [stop] command to kill servers by port. check-in: 71011d06ab user: andy tags: handler-script
Fix shebang per comment from andrewsh. Leaf check-in: 180aada6d2 user: andy tags: trunk
Correct HTTP/1.1 comparison per comment from andrewsh. check-in: 6dc367091c user: andy tags: trunk
Incorporate patch for HTTP/1.0 and connection: close from andrewsh. Reference http://wiki.tcl.tk/_/revision?N=27382&V=54#pagetoc0aa08018 for discussion. check-in: c62e5a1b5d user: andy tags: trunk
SEH: Ver 0.4.3: more unneeded code ripped out after consultation with AMG. Source: http://wiki.tcl.tk/_/revision?N=27377.code&V=34. Leaf check-in: e0addd3c71 user: andy tags: SEH-performance, version-0.4.3
SEH: Ver. 0.4.2: pulled out some unnecessary changes in how request and response vars are handled. Source: http://wiki.tcl.tk/_/revision?N=27377.code&V=33. check-in: bf836b2349 user: andy tags: SEH-performance, version-0.4.2
SEH: I take Andy up on his offer to make code changes here and humbly offer a version I've labeled 0.4.1. Details at http://wiki.tcl.tk/_/revision?N=27381&V=84. Source: http://wiki.tcl.tk/_/revision?N=27377.code&V=32. check-in: f3ed7b0923 user: andy tags: SEH-performance, version-0.4.1
Friday the Thirteenth special edition

Source, announcement.

Only two things are fixed in this version.

  • Quote ' (apostrophe) as ' in HTML attributes.
  • Automatically focus the entry widget when using the non-console Tk command interface.
  • Bump version number.
check-in: dc124f9048 user: andy tags: trunk, version-0.4
April Fool's special edition

Source, announcement.

Any bugs introduced by this release are intentional April Fool's pranks, not careless mistakes.

  • Add [dict getnull] command to simplify the common task of checking if a dict key exists before getting its value. It's very common to want to treat missing values as empty, so this new command makes sense.
  • Double the performance of [dehex].
  • Simplify [icc::catch] a tiny bit.
  • Remove some looping and [set]s in the path normalization code in [getrequest].
  • Allow for custom POST content-types such as application/json-rpc.
  • Let the application replace [socket] with a custom command, e.g. [tls::socket].
  • Add rudimentary history support to the command entry window, used when running Wibble with wish on a platform where there's no [console] command.
  • Bump version number. I should do this every time...
check-in: e8d8fa09c7 user: andy tags: trunk, version-0.3
[icc catch] fix

Source, announcement.

Just one change this time.

  • Fix [icc catch] to properly bytecode the script and to correctly handle [return], etc. inside the script.
check-in: 15a13c3ae5 user: andy tags: trunk
[icc] improvements

Source, announcement.

Some [icc] stuff...

  • Improve comments.
  • In [deheader], split if-match and if-none-match to be separate header types.
  • Always accept exception and timeout events.
  • Remove unnecessary ifs.
  • Add [icc destroy] to destroy a feed, performing cleanup along the way.
  • Add support for exception events to [icc get].
  • Guard against [icc destroy] happening in the middle of [icc get].
  • Add [icc catch] to get exception events.
  • Don't explicitly accept timeout in the coroutine feed.
  • In [panic], don't attempt to send errors to the client if not using HTTP.
  • Improve demo to use docroot directory if it exists.
check-in: a5738e0779 user: andy tags: trunk
New outgoing header format, Thanksgiving bonanza

Source, announcement.

Major revision!

  • Bump revision to 0.2.
  • Put zone handlers in "::wibble::zone" namespace.
  • Rewrite zone handlers to properly inherit from the existing state dicts.
  • Rename the [static], [template], and [script] zone handlers to [staticfile], [templatefile], and [scriptfile], respectively.
  • Change [compiletemplate] to [template], which immediately expands the template rather than just compiling it.
    • This effectively reverts a change made in the 2010-11-06 revision [eaa66764e3].
  • Use [template] in zone handlers when appropriate.
  • Fundamentally change the format of response headers generated by zone handlers.
    • The new format mirrors the format of request headers.
  • Change the branch order of [indexfile] to prefer serving index.html.
  • Remove caching of template scripts.
    • Writing files into the docroot made me nervous...
  • Add [contenttype] zone handler to guess content-type from file extension.
  • Expand [dumprequest] into [dumpstate] which analyzes the entire state dictionary, not just a request dictionary.
  • Remove [enurl] and [deurl].
  • Make [enhex] more flexible to make up for the loss of [enurl].
  • Update [enquery]/[dequery] to use [enhex]/[dehex] instead of [enurl]/[deurl].
  • Add [entime] and [detime] to process HTTP time/date, both relative and absolute.
  • Improve correctness of [delist], and teach it to recognize weak tag prefix ("w/").
  • Add [enquote] to complement [dequote].
  • Add [entag] and [detag] to process HTTP entity tags, including weak tags.
  • Add [enheader] to complement [deheader].
    • HUGE new feature!
  • Update [deheader] for changes in encode/decode procs.
  • Add support for cache-control, if-range, and date headers to [deheader].
  • Correct if-match and if-none-match support in [deheader].
  • Beef up warning support in [deheader].
  • Call [dequote] by default in [deheader].
  • Eliminate duplicate filters in [icc configure accept].
  • Style tweak to [icc put].
  • Search for zone handler commands in the new "::wibble::zone" namespace.
  • Add cleanup script naming and cancellation capabilities to [cleanup].
  • Simplify path normalization regexp in [getrequest].
  • Add TE/transfercoding to accept dictionary generation.
  • Prefer [dict for] over [foreach].
  • Replace [deurl] with [dehex] in [getrequest].
  • Add blank response dictionary to initial system dictionary in [getresponse].
  • Set charset to utf-8 in various places.
    • This change is probably a mistake, since the output will be converted to iso8859-1 anyway.
  • Move much of the guts of [process] into [defaultsend].
  • In [defaultsend], use the updated [cleanup] facility to close the contentfile.
  • Use [enheader] in [defaultsend] to encode the outgoing headers for HTTP.
  • Remove header capitalization normalization.
  • Add connection: close capability via the return value of [defaultsend].
  • Update [process] for the change in [cleanup].
  • Have [process] call [defaultsend] or a custom send command supplied by the zone handler.
  • Move the error log code into [panic] which can be overridden by the application.
  • Update panic code to use [dumpstate] instead of [dumprequest].
  • In Wibble demo, explicitly initialize zonehandlers to empty.
    • This facilitates re-sourcing wibble.tcl in the middle of execution.
  • Add sample content-type zone handler configuration.
  • Add Tk console to demo.
    • Use [console show] if available. Customize it, too.
    • If that fails, provide a bare-bones command prompt window.
check-in: 6cd02937b9 user: andy tags: trunk, version-0.2
Inter-coroutine communication, text/xml POST, cleanup scripts, contentchan

Source, announcement.

I added a bunch of new features.

  • Change "wibble" to "::wibble" to support being sourced, etc. when not in the :: namespace. This was done by JCW's request.
  • Add [redirect] zone handler.
  • Modify [dirslash] to chain to [redirect].
  • Add [forbidden] zone handler.
  • Modify [dirlist] to chain to [forbidden].
  • Add [string trimright] to end of [compiletemplate]. I can't remember exactly why I did this, but I think it cleans up the output a little bit in some obscure corner case.
  • Allow display of multiline data in [dumprequest], so long as the hard-coded string length limit isn't exceeded.
  • Remove [resume] and [suspend].
  • Remove argument from [getline] and [getblock]; instead derive the socket name from the coroutine name.
  • Use the new [icc] commands instead of [resume] and [suspend].
  • Strip CR in [enhtml], [enattr], and [enpre].
  • Add new [icc] commands.
  • Add [cleanup] command.
  • Update accept list generation logic to discard elements with a nonpositive qvalue.
  • Restructure the POST content-type dispatch code.
  • Add text/xml POST support.
  • Add default set of cleanup scripts.
  • Create an ICC feed for each coroutine.
  • Add support for contentchan/contentsize in addition to content and contentfile.
  • Don't error on flushing an output socket. (Maybe I should revert this change.)
  • Call cleanup scripts when the coroutine terminates.
  • Avoid gratuitous use of [namespace code].
check-in: d8efc44d96 user: andy tags: trunk
Fix 501 bug, remove empty query and post

Source, announcement.

Oops. The 501 code didn't work. I forgot to quote the value of the header key, resulting in an extra argument to [dict create]. Also, I removed the query, rawquery, post, and rawpost keys from the request dictionary when no query or post was made. This makes it easier to check if there was a query or a post.

  • Fix 501 bug.
  • Remove empty query, rawquery, post, and rawpost dicts.
check-in: 2240c95caa user: andy tags: trunk
Remove no-op [nexthandler] invocations, rearrange [suspend]

Source, announcement.

Per JBR's suggestion, I removed the [nexthandler $state] calls when $state is unmodified. Instead the zone handler just returns. This winds up having the same effect, because the no-op [nexthandler $state] was changing $system without really modifying it. ;^)

  • Remove no-op [nexthandler] invocations throughout Wibble.
  • Clarify the comment for [resume].
  • Rearrange [suspend] to be a little easier to understand.
check-in: 4a8b958f02 user: andy tags: trunk
State dicts, coroutine helpers, fixed zone handler order

Source, announcement.

I changed the zone handler arguments, so any existing zone handlers will have to be rewritten. I hope this new method works better than the fixed request/response approach I had before. Also, I changed the way the coroutines [yield] and are resumed; this should make AJAX work better. (Yes, Wibble supports AJAX!)

  • Cutesy CSS changes in [vars].
  • Update all zone handlers to receive a unified state dict instead of request and response dicts.
  • Update [vars] to display all sub-dicts in $state.
  • Pointless wording, capitalization, comment, and indentation changes.
  • Fix [dumprequest] to format query the same as post.
  • Write [resume] and [suspend] as wrappers around reinvoking the coroutine and [yield].
  • Remove [chan names] testing code since it didn't work anyway.
  • Update [getline] and [getblock] to use [suspend].
  • Rename $zones to $zonehandlers.
  • Change $zonehandlers to be a flat list instead of a dict.
  • Rewrite [getresponse] to use state dictionaries instead of request/response pairs.
  • Don't merge options into the request dict; instead make a separate options dict in $state.
  • Fix zone order handling in [getresponse].
  • Fix a subtle bug in [getresponse] that can make it replace the wrong state entry in $system.
  • Update the [chan copy] code to use [resume] and [suspend].
  • Don't install the [chan event] handler in [listen] since it'll be installed by [suspend].
check-in: 804f37444e user: andy tags: trunk
Non-blocking file transfers, bug workarounds

Source, announcement.

Sorry about the blocking [chan copy]. It's fixed now.

  • Don't initialize $wibble::zones to empty string. This makes it easier to re-[source] wibble.tcl while it's running.
  • Remove some extra [chan close]s. The channel will be closed anyway by the finally clause at the end of [process].
  • Add workaround for the Wiki bug that was corrupting [enhtml] and [enattr] (see http://wiki.tcl.tk/27382#pagetoc5da162fc).
  • Remove the question mark from [enquery] to make it mirror [dequery]
  • Make [chan copy] be non-blocking.
  • Add workaround for the "command returned bad code: 2" Tcl bug (see http://wiki.tcl.tk/27382#pagetoc640ac485).
  • Spell out "peerhost" and "peerport".
  • Re-fix the [namespace code] in [accept] (see http://wiki.tcl.tk/27382#pagetoca290566b).
check-in: 122ff1895b user: andy tags: trunk
Separate templates and scripts, improved request dictionary reporting

Source, announcement.

Now that I've finished reorganizing all the Wibble pages, I'm eager to edit them some more! :^)

  • Write [dumprequest] to partially "flatten" a request dictionary to make it easier to display.
  • Make the output of the vars zone handler much nicer.
  • Make the error log nicer too.
  • Split the template zone handler into two pieces:
    • [template]: Compile *.tmpl files into *.script files.
    • [script]: Execute *.script files.
  • Add rawtime, time, and port to the request dictionary.
  • Completely remove PUT.
  • Slightly simplify POST handling.
  • Replace [dict for] with [foreach] to support duplicate keys.
  • Improve the failsafe ![info exists $request] error log.
  • Remove -nonewline option from [log].
  • Move \n from the end to the beginning of the line.
  • Add new script zone handler to example code.
  • Remove special logging of the never-implemented "content" key in the request dictionary.
  • Remove [accept] and changed [listen] to use [apply].
check-in: bd595e7814 user: andy tags: trunk
Header and POST parsing.

Source, announcement.

I've been holding on to these changes for far too long, and I'm glad to finally publish them.

  • Add separator comments delimiting major sections of the code.
  • Change usage of [dict with request] to cut down on indenting.
  • Add many conversion routines:
    • [enhtml]: Encode for HTML.
    • [enattr]: Encode for HTML tag attribute.
    • [enpre]: Encode for HTML <pre>.
    • [enquery]: Encode a query string.
    • [dequery]: Decode a query string into a list.
    • [enhex]: Encode most non-alphanumerics with hexadecimal codes.
    • [dehex]: Decode hexadecimal encoding.
    • [enurl]: Encode for URLs.
    • [deurl]: Decode URL encoding.
    • [delist]: Decode header list encoding.
    • [dequote]: Decode header quoting.
    • [deheader]: Decode HTTP headers. (!!!)
  • Actually, [dehex] already existed, named [unhex]. Rename because [enhex] and [unhex] are too similar.
  • Modify zone handlers to use new conversion routines, e.g. [enhtml].
  • Replace <td><b> with <th> in [vars].
  • Simplify the way [dirlist] adds .. to the directory listing.
  • Change [applytemplate] to [compiletemplate], which returns the script instead of running it.
  • Make [template] cache the result of [compiletemplate].
  • Simplify append's arguments in [compiletemplate].
  • Add channel closure detection to [getline] and [getblock].
  • Revert second-chance [chan gets] in [getline], since I'm not convinced it's necessary (see http://wiki.tcl.tk/27382#pagetoc3c65f636).
  • Change the way [nexthandler] and [sendresponse] pass control back to [getresponse].
  • Add accept, post, and rawpost to the request dictionary.
  • Add Accept*: header handling.
  • Add POST handling.
  • Unset request dictionary after sending the response to avoid stale data.
  • Correct error report charset.
  • Incorporate APN's [accept] fix (see http://wiki.tcl.tk/27382#pagetoc8c99f371).

The channel closure detection makes it possible to close connections due to timeouts. This isn't implemented yet, but it would be nice to harden Wibble against basic DoS attacks. check-in: eaa66764e3 user: andy tags: trunk

Use neither [namespace code] nor [namespace current] to identify the coroutine command. http://wiki.tcl.tk/_/revision?N=23626&V=80 check-in: 902f2fb0a0 user: andy tags: trunk
Instead of [namespace code], explicitly use [namespace current] to identify the coroutine command. http://wiki.tcl.tk/_/revision?N=23626&V=76 check-in: 3920957b86 user: andy tags: trunk
Use [namespace code] to armor the coroutine command being executed. http://wiki.tcl.tk/_/revision?N=23626&V=75 check-in: 6c59e8eb84 user: andy tags: trunk
Per Miguel Sofer, use [variable] instead of giving the namespace'd variable name. http://wiki.tcl.tk/_/revision?N=23626&V=61 check-in: 3b5983aeb4 user: andy tags: trunk
Use [getblock] instead of [getline] to get non-chunked request body. http://wiki.tcl.tk/_/revision?N=23626&V=57 check-in: fe25f88b0f user: andy tags: trunk
Remove charset=utf-8. http://wiki.tcl.tk/_/revision?N=23626&V=56 check-in: 4bccaaab72 user: andy tags: trunk
Add header comment giving name, URL, (obsolete) email contact, and license. Rework long line detection. Remove [filejoin] in favor of simple concatenation. http://wiki.tcl.tk/_/revision?N=23626&V=55 check-in: 022fd7f3c5 user: andy tags: trunk
Remove [contentrange]. http://wiki.tcl.tk/_/revision?N=23626&V=45 check-in: 69e5aa2d4e user: andy tags: trunk
Don't use [namespace export] because the wibble namespace isn't meant to be imported. In the request dict, rename querytext to rawquery, and add rawheader. Split [get] into [getline] and [getblock]. Add the (nonexistent) [contentrange] handler to the demonstration after the [notfound] fallback (this change must have been done in error). http://wiki.tcl.tk/_/revision?N=23626&V=44 check-in: 7a4531c476 user: andy tags: trunk
Use [catch] instead of single-argument [try] which doesn't actually inhibit errors. http://wiki.tcl.tk/_/revision?N=23626&V=42 check-in: 3a1846e481 user: andy tags: trunk
Compact the non-chunked request and zone handler match code. Rearrange content length computation. http://wiki.tcl.tk/_/revision?N=23626&V=41 check-in: 0db237210e user: andy tags: trunk
Change the way [operation] encodes its result. Pass zone handlers preliminary response dictionaries. Remove [operation] in favor of separate [sendresponse] and [nexthandler] commands. http://wiki.tcl.tk/_/revision?N=23626&V=39 check-in: d0f8d8522d user: andy tags: trunk
Compact the first line HTTP parser code and the chunked request code. Improve HTTP header parser and generator to handle multi-line headers. Fix [log] so it actually works. http://wiki.tcl.tk/_/revision?N=23626&V=37 check-in: 8b1da2f099 user: andy tags: trunk
Use the centralized error system on excessively long lines. http://wiki.tcl.tk/_/revision?N=23626&V=34 check-in: 2f7c2fa2f0 user: andy tags: trunk
Catch errors when finally closing the socket. http://wiki.tcl.tk/_/revision?N=23626&V=28 check-in: b36b0d2acf user: andy tags: trunk
Improve error logging. Create [log] command. Close the socket even when an error doesn't occur. http://wiki.tcl.tk/_/revision?N=23626&V=26 check-in: 5f71e0aa5c user: andy tags: trunk
Use [chan configure -translation] instead of -encoding. http://wiki.tcl.tk/_/revision?N=23626&V=25 check-in: 3255e68808 user: andy tags: trunk
Don't keep-alive on 404 and other errors. http://wiki.tcl.tk/_/revision?N=23626&V=24 check-in: 16c9b455f1 user: andy tags: trunk
Put everything in a wibble package and a wibble namespace. Add [handle] to register a zone handler. Create [listen] command. http://wiki.tcl.tk/_/revision?N=23626&V=23 check-in: e13c7a2969 user: andy tags: trunk, version-0.1
Convert incoming HTTP header keys to lowercase. Improve range request handling. http://wiki.tcl.tk/_/revision?N=23626&V=22 check-in: 2170975245 user: andy tags: trunk
Fix HTTP parser to not be greedy, or else it includes trailing spaces in the protocol name. http://wiki.tcl.tk/_/revision?N=23626&V=21 check-in: 0c27dc620b user: andy tags: trunk
Centralize HTTP header capitalization logic. Permit extra spaces in HTTP. Only emit Content-Range when a range was requested. Remove [bgerror]. http://wiki.tcl.tk/_/revision?N=23626&V=20 check-in: 5b4c6ea97e user: andy tags: trunk
Update [get] to abort the coroutine on excessively long header lines, indicative of DoS attempts. http://wiki.tcl.tk/_/revision?N=23626&V=19 check-in: 1ac3ccc2ff user: andy tags: trunk
Remove extra closing bracket from [notfound]. http://wiki.tcl.tk/_/revision?N=23626&V=15 check-in: e8289016ec user: andy tags: trunk
Oops, forgot one place that needs [operation]. http://wiki.tcl.tk/_/revision?N=23626&V=14 check-in: 232fe38f72 user: andy tags: trunk
Add [operation], and make zone handlers use it instead of return. http://wiki.tcl.tk/_/revision?N=23626&V=13 check-in: d399ee9291 user: andy tags: trunk
Use iso8859 encoding per HTTP compliance. Don't use the forbidden identity encoding. http://wiki.tcl.tk/_/revision?N=23626&V=7 check-in: 11d5f7ec5d user: andy tags: trunk
Add comment describing $root. Remove $statuscodes. Rename some variables. Significantly rework [process]. http://wiki.tcl.tk/_/revision?N=23626&V=4 check-in: 986021df18 user: andy tags: trunk
Rename [directory] zone handler to [dirlist]. http://wiki.tcl.tk/_/revision?N=23626&V=3 check-in: 5c52be654c user: andy tags: trunk
Add missing comment describing [getresponse]. http://wiki.tcl.tk/_/revision?N=23626&V=2 check-in: ae8c254329 user: andy tags: trunk