Page 1 of 1

Printing binary content

Posted: Thu Feb 19, 2009 2:38 pm
by Jeff
I am writing an application that needs to sort of proxy data between two sources over HTTP. I am using get-url to fetch the data, but cannot output the data to a web browser using write-buffer or print, because the data may contain null characters and these seem to halt output at null chars. Is there any way to force it? I can pack and unpack it and see it if it is serialized to a string in a list, I can even write it to a file. But if it is going to an output like stdio or a browser, it stops at the first null. Any ideas?

Posted: Thu Feb 19, 2009 3:17 pm
by Jeff
Ok... write-buffer with device does not work, but:

Code: Select all

(setf content (get-url "http://localhost/test.gif"))
(write-buffer 1 "Content-type: image/gif\n\n")
(write-buffer 1 content (length content))
...manually using 1 as the out in a cgi seems to work :/