[hunchentoot-devel] Clozure CL HUNCHENTOOT-TEST Error
Wade Humeniuk
wade.humeniuk at gmail.com
Mon Jun 16 04:52:15 UTC 2008
I am using Clozure CL 1.2 rc1.2 with Hunchentoot. The
hunchentoot-test pages that come with the install
are not working completely. I had the to modify the test code in
test.lisp to get a backtrace of what was
happening. stream-direct-utf-8 is throwing an error and no content is
coming back.
(defvar *htest-debug-stream* nil)
(defun stream-direct-utf-8 ()
(handler-bind ((error (lambda (c)
(describe c *htest-debug-stream*)
(format *htest-debug-stream* "~A" (hunchentoot:get-backtrace c)))))
(setf (content-type) "text/html; charset=utf-8")
(let ((stream (send-headers)))
(setf (flex:flexi-stream-external-format stream) *utf-8*)
(with-open-file (in (merge-pathnames "UTF-8-demo.html" *this-file*)
:element-type 'flex:octet)
(setq in (flex:make-flexi-stream in :external-format *utf-8*))
(loop for line = (read-line in nil nil)
while line
do (write-line line stream))))))
and modifying chunga::write-chunk to..
(defmethod write-chunk ((stream chunked-output-stream) sequence
&key (start 0)
(end (length sequence)))
"Writes the contents of SEQUENCE from START to END to the
underlying stream of STREAM as one chunk."
(let ((output-stream (chunked-stream-output-stream stream)))
(describe output-stream hunchentoot-test::*htest-debug-stream*)
;; chunk size
(format output-stream "~X" (- end start))
;; CRLF
(write-string #.(format nil "~C~C" #\Return #\Linefeed) output-stream)
;; data
#+:clisp (setf (flexi-stream-element-type output-stream) 'octet)
(write-sequence sequence output-stream :start start :end end)
#+:clisp (setf (flexi-stream-element-type output-stream) 'character)
;; CRLF
(write-string #.(format nil "~C~C" #\Return #\Linefeed) output-stream)))
Visting the page /hunchentoot/test/utf8-character.txt produces the output below.
As far as I can tell from looking at the code there should be no instance of
EXTERNAL-FORMAT since there is no method FLEXI-STREAMS::ENCODING-FACTOR
for it (only subclasses of EXTERNAL-FORMAT). I have pretty well banged my head
looking at the code in flexi-streams and chunga trying to determine the problem.
This works fine for SBCL, and I see no conditional code for CCL that
might explain the
problem.
Wade
CL-USER> (hunchentoot:start-server :port 4242)
#<HUNCHENTOOT::SERVER #x3000426BF81D>
CL-USER> (setf hunchentoot-test::*htest-debug-stream* *standard-output*)
#<SWANK-BACKEND::SLIME-OUTPUT-STREAM #x300040E2FC1D>
#<SIMPLE-ERROR #x30004274A50D>
Class: #<STANDARD-CLASS SIMPLE-ERROR>
Wrapper: #<CLASS-WRAPPER #x3000404AC86D>
Instance slots
CCL::FORMAT-CONTROL: "No applicable method for args:~% ~s~% to ~s"
CCL::FORMAT-ARGUMENTS: ((#<EXTERNAL-FORMAT (:ISO-8859-1
:EOL-STYLE
:LF) #x30004122DA1D>)
#<STANDARD-GENERIC-FUNCTION
FLEXI-STREAMS::ENCODING-FACTOR #x300040FACA3F>)
BACKTRACE--->>>>>>
(7FC8F700D0B8) : 0 (GET-BACKTRACE #<SIMPLE-ERROR #x30004274A50D>) 285
(7FC8F700D120) : 1 (FUNCALL #'#<(:INTERNAL
HUNCHENTOOT-TEST::STREAM-DIRECT-UTF-8)> #<SIMPLE-ERROR
#x30004274A50D>) 173
(7FC8F700D140) : 2 (SIGNAL #<SIMPLE-ERROR #x30004274A50D> [...]) 997
(7FC8F700D198) : 3 (%ERROR #<SIMPLE-ERROR #x30004274A50D> NIL
17562639276619) 117
(7FC8F700D1C0) : 4 (CERROR "Try calling it again" "No applicable
method for args:~% ~s~% to ~s" [...]) 933
(7FC8F700D258) : 5 (FUNCALL #'#<#<CCL::STANDARD-KERNEL-METHOD
NO-APPLICABLE-METHOD (T)>> #<STANDARD-GENERIC-FUNCTION
FLEXI-STREAMS::ENCODING-FACTOR #x300040FACA3F> [...]) 117
(7FC8F700D298) : 7 (FUNCALL #'#<#<STANDARD-METHOD
TRIVIAL-GRAY-STREAMS:STREAM-WRITE-SEQUENCE
(FLEXI-STREAMS:FLEXI-OUTPUT-STREAM T T T)>>
#<FLEXI-STREAMS:FLEXI-IO-STREAM #x30004272511D> "....
(7FC8F700D300) : 8 (%%STANDARD-COMBINED-METHOD-DCODE '(# NIL #<#>)
17562639276650) 269
(7FC8F700D378) : 10 (WRITE-STRING "...
(7FC8F700D3D8) : 11 (%PR-INTEGER 0 [...]) 965
(7FC8F700D478) : 12 (FORMAT-PRINT-NUMBER
#<FLEXI-STREAMS:FLEXI-IO-STREAM #x30004272511D> 8187 16 NIL NIL NIL)
1829
(7FC8F700D4F8) : 13 (FUNCALL #'#<Anonymous Function #x3000409324EF>
#<FLEXI-STREAMS:FLEXI-IO-STREAM #x30004272511D> NIL NIL [...]) 165
(7FC8F700D530) : 14 (SUB-FORMAT #<FLEXI-STREAMS:FLEXI-IO-STREAM
#x30004272511D> 1 2) 2469
(7FC8F700D5E8) : 15 (DO-SUB-FORMAT #<FLEXI-STREAMS:FLEXI-IO-STREAM
#x30004272511D>) 157
(7FC8F700D608) : 16 (FORMAT #<FLEXI-STREAMS:FLEXI-IO-STREAM
#x30004272511D> "~X" [...]) 1725
(7FC8F700D728) : 17 (FUNCALL #'#<#<STANDARD-METHOD
CHUNGA::WRITE-CHUNK (CHUNGA:CHUNKED-OUTPUT-STREAM T)>>
#<CHUNGA:CHUNKED-IO-STREAM #x30004273F56D> #(60 33 68 79 67 ...)
[...]) 237
(7FC8F700D770) : 18 (%%CHECK-KEYWORDS #(2 #(:END :START)
#<METHOD-FUNCTION CHUNGA::WRITE-CHUNK #>) 17562639276793) 245
(7FC8F700D7F0) : 20 (FUNCALL #'#<#<STANDARD-METHOD
CHUNGA::FLUSH-BUFFER (CHUNGA:CHUNKED-OUTPUT-STREAM)>>
#<CHUNGA:CHUNKED-IO-STREAM #x30004273F56D>) 213
(7FC8F700D810) : 21 (FUNCALL #'#<#<STANDARD-METHOD
TRIVIAL-GRAY-STREAMS:STREAM-WRITE-SEQUENCE
(CHUNGA:CHUNKED-OUTPUT-STREAM T T T)>> #<CHUNGA:CHUNKED-IO-STREAM
#x30004273F56D> #(184 177 224 184 162 ...) 0 63 [...]) 709
(7FC8F700D868) : 22 (WRITE-SEQUENCE #(184 177 224 184 162 ...)
#<CHUNGA:CHUNKED-IO-STREAM #x30004273F56D> [...]) 765
(7FC8F700D8D8) : 23 (FUNCALL #'#<(:INTERNAL
FLEXI-STREAMS::FLUSH-BUFFER
(TRIVIAL-GRAY-STREAMS:STREAM-WRITE-SEQUENCE
(FLEXI-STREAMS:FLEXI-OUTPUT-STREAM T T T)))>) 85
(7FC8F700D900) : 24 (FUNCALL #'#<(:INTERNAL
FLEXI-STREAMS::WRITE-OCTET (TRIVIAL-GRAY-STREAMS:STREAM-WRITE-SEQUENCE
(FLEXI-STREAMS:FLEXI-OUTPUT-STREAM T T T)))> 154) 69
(7FC8F700D938) : 25 (FUNCALL #'#<#<STANDARD-METHOD
FLEXI-STREAMS::CHAR-TO-OCTETS (FLEXI-STREAMS::FLEXI-UTF-8-FORMAT T
T)>> #<FLEXI-UTF-8-FORMAT (:UTF-8 :EOL-STYLE :LF) #x300042642DBD>
#\U+0E1A #<COMPILED-LEXICAL-CLOSURE (:INTERNAL
FLEXI-STREAMS::WRITE-OCTET #) #x30004274A8CF>) 1629
(7FC8F700D970) : 26 (FUNCALL #'#<#<STANDARD-METHOD
TRIVIAL-GRAY-STREAMS:STREAM-WRITE-SEQUENCE
(FLEXI-STREAMS:FLEXI-OUTPUT-STREAM T T T)>>
#<FLEXI-STREAMS:FLEXI-IO-STREAM #x30004273CBCD> "
(7FC8F700D9F8) : 27 (%%STANDARD-COMBINED-METHOD-DCODE '(# NIL #<#>)
17562639276873) 269
(7FC8F700DA70) : 29 (WRITE-STRING "...
(7FC8F700DAD0) : 30 (WRITE-LINE "
(7FC8F700DB20) : 31 (STREAM-DIRECT-UTF-8) 805
(7FC8F700DBB0) : 32 (PROCESS-REQUEST '(# # # # # ...)
#<FLEXI-STREAMS:FLEXI-IO-STREAM #x30004273CBCD> :GET
"/hunchentoot/test/utf8-character.txt" :HTTP/1.1) 3045
(7FC8F700DD18) : 33 (PROCESS-CONNECTION #<HUNCHENTOOT::SERVER
#x3000426BF81D> #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/6)
#x30004271F65D>) 5429
(7FC8F700DEB8) : 34 (RUN-PROCESS-INITIAL-FORM #<PROCESS
hunchentoot-worker-1(13) [Active] #x30004271E9BD> '(#)) 717
(7FC8F700DF48) : 35 (FUNCALL #'#<(:INTERNAL
CCL::%PROCESS-PRESET-INTERNAL)> #<PROCESS hunchentoot-worker-1(13)
[Active] #x30004271E9BD> '(#)) 397
(7FC8F700DF98) : 36 (FUNCALL #'#<(:INTERNAL
CCL::THREAD-MAKE-STARTUP-FUNCTION)>) 293
CHUNGA INFO--->>>>>>>>>
Class: #<STANDARD-CLASS FLEXI-STREAMS:FLEXI-IO-STREAM>
Wrapper: #<CLASS-WRAPPER #x300040FCCC3D>
Instance slots
CCL::SHARED-RESOURCE: NIL
STREAM: #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/6) #x3000426A322D>
FLEXI-STREAMS::EXTERNAL-FORMAT: #<EXTERNAL-FORMAT (:ISO-8859-1
:EOL-STYLE
:LF) #x30004122DA1D>
FLEXI-STREAMS::ELEMENT-TYPE: FLEXI-STREAMS::CHAR*
FLEXI-STREAMS::COLUMN: 0
FLEXI-STREAMS::LAST-CHAR-CODE: NIL
FLEXI-STREAMS::LAST-OCTET: NIL
FLEXI-STREAMS::OCTET-STACK: NIL
POSITION: 0
FLEXI-STREAMS::BOUND: NIL
#<FLEXI-STREAMS:FLEXI-IO-STREAM #x3000426A36BD>
Class: #<STANDARD-CLASS FLEXI-STREAMS:FLEXI-IO-STREAM>
Wrapper: #<CLASS-WRAPPER #x300040FCCC3D>
Instance slots
CCL::SHARED-RESOURCE: NIL
STREAM: #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/6) #x3000426A322D>
FLEXI-STREAMS::EXTERNAL-FORMAT: #<EXTERNAL-FORMAT (:ISO-8859-1
:EOL-STYLE
:LF) #x30004122DA1D>
FLEXI-STREAMS::ELEMENT-TYPE: FLEXI-STREAMS::CHAR*
FLEXI-STREAMS::COLUMN: 0
FLEXI-STREAMS::LAST-CHAR-CODE: NIL
FLEXI-STREAMS::LAST-OCTET: NIL
FLEXI-STREAMS::OCTET-STACK: NIL
POSITION: 0
FLEXI-STREAMS::BOUND: NIL
More information about the Tbnl-devel
mailing list