[drakma-devel] Drakma : Problem saving file
lam at tuxfamily.org
lam at tuxfamily.org
Wed Dec 6 10:51:03 UTC 2006
hello,
> On Wed, 6 Dec 2006 09:47:17 +0100 (CET), lam at tuxfamily.org wrote:
>
>> i make some test with drakma and i have a problem with http-request :
>>
>> (drakma:http-request
>> "http://stats-dev/cgi-bin/view_image.cgi?filename=/tmp/sms_5Avkjm.png"
>> :want-stream t :force-binary t :content-length t)
>
> The :CONTENT-LENGTH argument is useless in your case, because you
> don't send a content body to the server.
>
> I think that what you're trying to do should work, but you don't
> provide enough information to reproduce your problem.
>
> 1. "http://stats-dev/" is an URL that doesn't work for me.
yes :(
in fact the url is in a local server
> 2. Which Lisp implementation and which OS are you using?
$> sbcl --version
SBCL 0.9.14
> 3. Are you using the newest versions of Drakma, FLEXI-STREAMS, and
> Chunga?
yes
i have deleted all previous version, and i have install chunga,
flexi-streams and drakma with asdf-install :
drakma: 0.5.4
flexi-streams: 0.8.0
chunga: 0.2.1
> 4. Have you considered to use *HEADER-STREAM* to see if you're maybe
> redirected?
i make another test with the newest versions and *HEADER-STREAM* :
CL-USER> (with-open-file (os (format nil "/tmp/~A.png" "foo")
:direction :output
:if-exists :supersede
:element-type 'unsigned-byte)
(setf drakma:*header-stream* *standard-output*)
(multiple-value-bind (body-stream status-code headers uri
stream must-close)
(drakma:http-request
"http://stats-dev.lam/cgi-bin/view_image.cgi?filename=/tmp/sms_5Avkjm.png"
:want-stream t)
(declare (ignore headers uri stream must-close))
(when (= status-code 200)
(format t "Type ~A~%" (type-of body-stream))
(loop for c = (read-byte body-stream nil)
until (null c)
do (progn
(format t "Write ~%")
(write-byte c os)))
(close body-stream))))
GET /cgi-bin/view_image.cgi?filename=/tmp/sms_5Avkjm.png HTTP/1.1
Host: stats-dev.lam
User-Agent: Drakma/0.5.4 (SBCL 0.9.14; Linux; 2.6.15-23-686;
http://weitz.de/drakma/)
Accept: */*
Connection: close
HTTP/1.1 200 OK
Date: Wed, 06 Dec 2006 10:48:50 GMT
Server: Apache/1.3.34 (Debian) PHP/4.4.4-6 mod_jk/1.2.18 mod_ssl/2.8.25
OpenSSL/0.9.8c mod_perl/1.29
Connection: close
Transfer-Encoding: chunked
Content-Type: image/png
Type FLEXI-IO-STREAM
T
> Cheers,
> Edi.
>
More information about the Drakma-devel
mailing list