I've recently started to work (for fun) on a web service, using
araneida(*) and sbcl.
Quickly I came across one of araneida's limitations: the fact that the
body of a http POST request is interpreted in the default charset of the
lisp implementation (sbcl).
This raises two problems:
1/ the web server might receive a request whose body is encoded using
an unsupported encoding.
2/ the service doesn't always need the body of a POST request be
interpreted as string.
.. and indeed, I receive a stream of bytes which I am supposed to pass to
cxml's so it actually parses it and generates SAX events I could handle.
.. so I hacked araneida a little, in order to make
the request body's stream available, instead of interpreting the
contents, and I chose to use a simple-stream to represent the
freshly-created socket's stream.
Now, cxml uses the 'regular' set of functions (read-byte,
file-position, ...), most of which is redefined in
sb-simple-streams, but the original functions do some
dispatch only in case the stream is either a gray-stream or an
(for example: read-byte assumes the stream is either an ansi-stream or
a gray-stream, but no handling is done in case it's a simple-stream)
I could hack cxml to prepend 'sb-simple-streams:' in front of any
function that needs use the sb-simple-streams version, but I have the
feeling I'm doing something wrong, here ..
Does someone have a suggestion?
Wouldn't it be appropriate to add the handling of simple-streams is
stream.lisp? (maybe with a compiler directive to actually enable it
only if needed (option that would be defined at sbcl's compile-time,
In case it's 'accepted', I can work on that
(*) I know araneida would probably not be the appropriate webserver
for a business/big application, but that's only for fun; toying with
the webserver's internals was one of my goals, so I chose a
'rather simple' one.