[drakma-devel] CHUNGA:INPUT-CHUNKING-UNEXPECTED-END-OF-FILE
Nico de Jager
ndj at hivsa.com
Wed Dec 12 11:34:14 UTC 2007
Hi
I have a fingerprint scanning application, that uploads fingerprint images using Drakma to a Hunchentoot server. Everything works great as long as I don't use a secure connection. With https, I get a CHUNGA:INPUT-CHUNKING-UNEXPECTED-END-OF-FILE condition on the server, and "Timeout while writing 8192 bytes to #<COMM:SOCKET-STREAM >" on the client. Sometimes the uploads are successful with https, though.
The server runs LispWorks 5.0.2 on Debian Etch. The client runs on LispWorks 5.0.2 on Windows XP SP2. Part of the application pulls in the trivial-ldap module which depends on cl+ssl - not sure if this can be an issue as cl+ssl is not needed on LispWorks for Drakma and Hunchentoot.
I am sure I am doing something stupid. The handler that does the actual upload on the client (which also uses Hunchentoot) is:
(define-easy-handler (upload-fp-image.action :uri "/hunchentoot/patient-study-db/upload-fp-image.action") ()
(let ((cookie-jar (make-instance 'drakma:cookie-jar
:cookies (list (make-instance 'drakma:cookie :name (session-value :hs-name) :value (session-value :hs-id)
:path (session-value :hs-path) :domain (session-value :hs-domain))))))
(handler-case
(let ((html-result (drakma:http-request (session-value :upload-url)
:method :post
:parameters (list (cons "finger" (session-value :finger))
(cons "img-file" (pathname *scanned-file*))
(cons "hs-id" (session-value :hs-id)))
:user-agent (session-value :user-agent)
:cookie-jar cookie-jar)))
(delete-file *scanned-file*)
(with-html-output-to-string (*standard-output*)
(str html-result)))
(condition (con)
(delete-file *scanned-file*)
(show-condition-html con (session-value :back-caption) (session-value :back-url))))))
The Hunchentoot server log spits out:
[2007-12-12 11:35:39 [ERROR]] While parsing multipart/form-data parameters: The condition #<CHUNGA:INPUT-CHUNKING-UNEXPECTED-END-OF-FILE 200B000C> occurred
[2007-12-12 11:35:39] 10.38.1.45 - "POST /hunchentoot/patient-study-db/identify-patient.action HTTP/1.1" 200 1058 "-" "Opera/9.10 (Windows NT 5.1; U; en)"
[2007-12-12 11:35:39 [ERROR]] Error while processing connection: Not all chunks from #<CHUNGA:CHUNKED-IO-STREAM 223A7893> have been read completely.
Backtraces on the server and client are included below.
Thanks.
Nico
Backtrace on server:
Error: The condition #<CHUNGA:INPUT-CHUNKING-UNEXPECTED-END-OF-FILE 223AB36C> occurred
1 (abort) Quit process.
Type :b for backtrace, :c <option number> to proceed, or :? for other options
CL-USER 1 : 1 > :b
Call to SIGNAL
Call to (METHOD CHUNGA::FILL-BUFFER (CHUNGA:CHUNKED-INPUT-STREAM))
Call to (METHOD STREAM:STREAM-READ-BYTE (CHUNGA:CHUNKED-INPUT-STREAM))
Call to READ-BYTE
Call to (METHOD FLEXI-STREAMS::READ-BYTE* (FLEXI-STREAMS::FLEXI-BINARY-INPUT-STREAM))
Call to (METHOD STREAM:STREAM-READ-CHAR (FLEXI-STREAMS::FLEXI-LATIN-1-INPUT-STREAM))
Call to READ-CHAR
Call to (SUBFUNCTION RFC2388::RUN RFC2388::READ-UNTIL-NEXT-BOUNDARY)
Call to RFC2388::READ-UNTIL-NEXT-BOUNDARY
Call to (METHOD RFC2388:PARSE-MIME (STREAM T))
Call to HUNCHENTOOT::PARSE-RFC2388-FORM-DATA
Call to (METHOD INITIALIZE-INSTANCE :AFTER (HUNCHENTOOT::REQUEST))
Call to CLOS::METHOD-COMBINATION-TEMPLATE
Call to CLOS::MAKE-INSTANCE-FROM-CLASS-1
Call to HUNCHENTOOT::PROCESS-REQUEST
Call to HUNCHENTOOT::PROCESS-CONNECTION
Call to (SUBFUNCTION MP::PROCESS-SG-FUNCTION MP::INITIALIZE-PROCESS-STACK)
Backtrace on client:
Error: Timeout while writing 8192 bytes to #<COMM:SOCKET-STREAM 2009C0E7>.
1 (abort) Quit process.
Type :b for backtrace, :c <option number> to proceed, or :? for other options
CL-USER 1 : 1 > :b
Call to SIGNAL
Call to (METHOD STREAM:STREAM-FLUSH-BUFFER (STREAM:BUFFERED-STREAM))
Call to (METHOD STREAM:STREAM-WRITE-SEQUENCE (STREAM:BUFFERED-STREAM T T T))
Call to CLOS::METHOD-COMBINATION-TEMPLATE
Call to WRITE-SEQUENCE
Call to WRITE-SEQUENCE
Call to (METHOD CHUNGA::WRITE-CHUNK (CHUNGA:CHUNKED-OUTPUT-STREAM T))
Call to (METHOD CHUNGA::FLUSH-BUFFER (CHUNGA:CHUNKED-OUTPUT-STREAM))
Call to (METHOD TRIVIAL-GRAY-STREAMS:STREAM-WRITE-SEQUENCE (CHUNGA:CHUNKED-OUTPUT-STREAM T T T))
Call to WRITE-SEQUENCE
Call to WRITE-SEQUENCE
Call to DRAKMA::SEND-CONTENT
Call to DRAKMA::SEND-CONTENT
Call to (SUBFUNCTION 1 DRAKMA::MAKE-FORM-DATA-FUNCTION)
Call to (SUBFUNCTION (LABELS DRAKMA::FINISH-REQUEST) DRAKMA:HTTP-REQUEST)
Call to DRAKMA:HTTP-REQUEST
Interpreted call to PATIENT-STUDY-DB-CLIENT::UPLOAD-FP-IMAGE.ACTION
Call to HUNCHENTOOT::PROCESS-REQUEST
Call to HUNCHENTOOT::PROCESS-CONNECTION
Call to (SUBFUNCTION MP::PROCESS-SG-FUNCTION MP::INITIALIZE-PROCESS-STACK)
More information about the Drakma-devel
mailing list