eight-point HTTP toolkit

2010-01-12 @ 10:07#

not long ago i commented on a REST-discuss thread regarding coding frameworks for building HTTP applications. i've tried a handful and was not happy with most. since i spend most of my time in the Windows/IIS space, my options are limited. not a fan of ASPX's post-back, didn't like WCF and not happy w/ MVC, either (picky bugger, eh?). instead, i developed my own small-ish library of utilities that let me write HTTP request/responses directly with very little setup or cruft. i also have MIME and URI parsers, the ability to dynamically handle representation transforms, can support conditional requests (via simple caching), and support simple authentication models (Basic and Digest to start).

it's not a framework, really, as much as a set of handy tools i keep at the ready. i use this toolkit in most of my talks and demos and it forms the basis of a larger, more robust framework that i've used for a number of production-level projects. whenever i'm thinking about an HTTP issue, want to demonstrate a problem, or are just puzzling out thought experiments, this toolkit is the first thing i whip out. I've even posted a simple version of it on GoogleCode to make it available to others to play with.

below is a quick list of what i find is the minimal eight tools i need to build HTTP compliant apps. when i'm working with any coding library building HTTP applications, these are the functions i want to make sure i have at the ready.

Request Dispatcher
Routes HTTP requests to the proper execution code
URI Handler
Parses the details of the URI (scheme, path, query info, etc.) and exposes them for use.
Mime Parser
Handles the details of determining the media type including support for conneg
Request Handler
Target of the Request Dispatcher; the interesting/computational stuff goes here
Representation Handler
Converts stored data into the proper representation for responses and handles incoming representations from requests
HTTP Client
A 'mini HTTP Client' that allows you to make requests to, and handle responses from, other HTTP servers
Caching
Basic support for caching and conditional requests
Authentication
Understands various auth models

code