newLISP Fan Club

Forum => newLISP in the real world => Topic started by: Jeff on February 19, 2009, 06:38:36 AM

Title: Printing binary content
Post by: Jeff on February 19, 2009, 06:38:36 AM
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?
Title:
Post by: Jeff on February 19, 2009, 07:17:22 AM
Ok... write-buffer with device does not work, but:


(setf content (get-url "http://localhost/test.gif"))
(write-buffer 1 "Content-type: image/gifnn")
(write-buffer 1 content (length content))


...manually using 1 as the out in a cgi seems to work :/