DESTRUCTURING-WRONG-NUM-ARGS when server was writing binary files
"Chun Tian (binghe)" <[email protected]> Fri, 18 Mar 2011 01:18:26 +0800
| Newsgroups | gmane.lisp.cl-http |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-7--47440107
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
Hi, CL-HTTP
Today I use CL-HTTP to serve a PDF file, something like this:
(export-url #u"/wireless/wireless-guide.pdf"
:pdf-file
:pathname #p"SYS:WWW;WIRELESS-GUIDE.PDF"
:public t
:max-age #.(* 60 60 24))
After several hours, I found many HTTP 500 error as below:
Log: "192.168.150.247 - - [2011-03-17 08:13:20] \"GET =
/wireless/wireless-guide.pdf HTTP/1.1\" 500 1001 \"Mozilla/5.0 (Windows; =
U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) =
Chrome/5.0.375.99 Safari/533.4\" -"
Error: DSPEC::DESTRUCTURING-WRONG-NUM-ARGS
Error Report: (24250 627165 602915) does not match ((HTTP::START =
HTTP::END HTTP::CONTENT-LENGTH)).
I believe this is caused by a wrongly used DESTRUCTURING-BIND macro =
%writing-binary-file (in HTTP:SERVER;SERVER.LISP), a form:
(destructuring-bind ((start end content-length)) (car byte-range-spec) =
...)
should be
(destructuring-bind (start end content-length) (car byte-range-spec) =
...)
It seems that the author was thinking the following alternative when =
writing above form:
(destructuring-bind ((start end content-length)) byte-range-spec ...)
Attach is my patch for this, please review it.
Regards,
Chun Tian (binghe)
--Apple-Mail-7--47440107
Content-Disposition: attachment;
filename=server-writing-binary-files.diff
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="server-writing-binary-files.diff"
Content-Transfer-Encoding: 7bit
Index: server/server.lisp
===================================================================
--- server/server.lisp (revision 35)
+++ server/server.lisp (working copy)
@@ -3008,7 +3008,7 @@
:content-type content-type ;; Confuses Adobe Reader -- Joswig 7/13/2009
#|:content-length content-length|#)
,range-copy-form))))))
- (t (destructuring-bind ((start end content-length)) (car byte-range-spec)
+ (t (destructuring-bind (start end content-length) (car byte-range-spec)
(send-single-byte-range start end content-length expires cache-control languages))))))))))))
(defun %%write-binary-file (pathname url content-type stream &optional charset last-modification version)
--Apple-Mail-7--47440107
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
WWW-CL mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/www-cl
--Apple-Mail-7--47440107--