Portable Allegroserve Enhanced Version for SBCL
This version of Portable AllegroServe Web server contains important enhancements and bugfixes for SBCL. With this version it is possible to use external formats other than latin-1 (ISO-8859-1), e.g. UTF-8. The buffering is rewritten using low level external format functions from SBCL.
Changes from AllegroServe 1.2.47 are merged.
For further information please see the
README.vbz file.
portableaserve-1.2.47-vbz-0.1.4.tar.gz
portableaserve-1.2.47-vbz-0.1.4.tar.gz.md5
This version is for SBCL 1.0, or later.
SBCL 1.0.34 or later
In SBCL 1.0.34, the data type for external formats was changed from a list to a structure. The following changes to acl-compat/llefu-sbcl.lisp fix the problem:
(defun add-variable-ef (var-ef)
(let* ((ef-sym (car var-ef))
(ef-entry (cdr var-ef))
(ef-sym-list (sb-impl::ef-names (sb-impl::find-external-format ef-sym))))
(mapc #'(lambda (ef) (add-ef ef ef-entry)) ef-sym-list)))
(defun add-identity-ef (ef-sym)
(let ((ef-sym-list (sb-impl::ef-names (sb-impl::find-external-format ef-sym))))
(when ef-sym-list
(let ((ef-entry (list nil t #'identity #'identity)))
(mapc #'(lambda (ef) (add-ef ef ef-entry)) ef-sym-list))
t)))
|
Here is the complete revised file: llefu-sbcl.lisp
SBCL 1.0.23 or later
Note1: As of 1.0.23, the new sb-bsd-sockets does not pass the :auto-close t argument from the make-socket-stream in the acl-socket.lisp. This causes heap space exhaustion... if auto-close is commented out. Trying to hack the sb-bsd-sockets code by adding the keyword and passing the argument down to the sb-sys:make-fd-stream function does not bring joy. (This is with sbcl-1.0.25). I will update this note if there is a solution. I will have to go back to sbcl-1.0.18 in the meantime.
Note 1a:
The following workaround works on sbcl-1.0.26-gentoo-r10 on AMD64 involves fixing the contrib/sb-bsd-sockets/sockets.lisp file. Here are the steps:
# cd /usr/portage/dev-lisp/sbcl
# ebuild sbcl-1.0.26-r10 unpack
Edit: /var/tmp/portage/dev-lisp/sbcl-1.0.26-r10/work/sbcl-1.0.26/contrib/sb-bsd-sockets/sockets.lisp
(defgeneric socket-make-stream (socket &key input output
element-type external-format
buffering
timeout
auto-close)
(:documentation "Find or create a STREAM that can be used for IO on
SOCKET \(which must be connected\). Specify whether the stream is for
INPUT, OUTPUT, or both \(it is an error to specify neither\). ELEMENT-TYPE
and EXTERNAL-FORMAT are as per OPEN. TIMEOUT specifies a read timeout
for the stream."))
(defmethod socket-make-stream ((socket socket)
&key input output
(element-type 'character)
(buffering :full)
(external-format :default)
timeout
(auto-close t))
"Default method for SOCKET objects. An ELEMENT-TYPE of :DEFAULT
will construct a bivalent stream. Acceptable values for BUFFERING
are :FULL, :LINE and :NONE. Streams will have no TIMEOUT
by default.
The stream for SOCKET will be cached, and a second invocation of this
method will return the same stream. This may lead to oddities if this
function is invoked with inconsistent arguments \(e.g., one might request
an input stream and get an output stream in response\)."
(let ((stream
(and (slot-boundp socket 'stream) (slot-value socket 'stream))))
(unless stream
(setf stream (sb-sys:make-fd-stream
(socket-file-descriptor socket)
:name "a socket"
:dual-channel-p t
:input input
:output output
:element-type element-type
:buffering buffering
:external-format external-format
:timeout timeout
:auto-close auto-close)))
(setf (slot-value socket 'stream) stream)
(sb-ext:cancel-finalization socket)
stream))
|
Compile and package:
# cd /usr/portage/dev-lisp/sbcl
# ebuild sbcl-1.0.26-r10.ebuild package
# cd /usr/portage/packages/
# emerge sbcl-1.0.26-r10.tbz2
you will have to uninstall the old sbcl instance before it lets you do the above (unless its an upgrade)... # emerge --unmerge sbcl
At this point, things should be OK. I ran the resulting application with apache bench for about 20k requests...
Further updates to this will be posted on http://www.rayservers.com/blog/technical-notes (coming soon)
Note 2: llefu-sbcl.lisp in acl-compat.lisp whines about a missing char->utf8 function in package sb-impl. This can be fixed by...
(in-package :sb-impl)
(defun char->utf8 (char) char)
at the top of that file.
For older SBCL's please use the following package (tested with 0.9.15):
portableaserve-1.2.47-vbz-0.1.2.tar.gz
portableaserve-1.2.47-vbz-0.1.2.tar.gz.md5
This page is linked from: AllegroServe Portable Allegroserve and SBCL with Unicode Portableaserve
CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively