Sorry, I was wrong about http-reqest uploading a wrong data, it works
well under Weblocks.
It's just that I get some corrpupted data when I get an html page,
parse it and send some content to a user so I'll investigate it
further.

Back to send-headers. I am using hunchentoot-0.15.7. As for the
handler, I use something like (create-regex-dispatcher "test.img"
'give-me-an-image).
What I found is that when I copy an image to stream using an array,
all works well.
If I copy it using cl-gl library, then the corruption happens:

1) This works well with and without Weblocks:
(defun give-me-an-image ()
  (setf (hunchentoot:content-type) "image/jpeg")
  (let ((zappa-img-path
"/your-path-to-lisp-lib/hunchentoot-0.15.7/test/fz.jpg"))
    (with-open-file (in zappa-img-path :element-type '(unsigned-byte 8))
     (let ((image-data (make-array (file-length in) :element-type
'(unsigned-byte 8))))
       (read-sequence image-data in)
       (write-sequence image-data (send-headers))))))

2) This only works without Weblocks (using cl-gd):
(defun give-me-an-image ()
  (setf (hunchentoot:content-type) "image/jpeg")
  (let ((zappa-img-path
"/your-path-to-lisp-lib/hunchentoot-0.15.7/test/fz.jpg"))
    (cl-gd:with-image-from-file (image zappa-img-path)
      (cl-gd:write-jpeg-to-stream (send-headers) :image image))))

Well, at least at this point we narrowed it down to a simple scenario
that should be easy to reproduce.


On Fri, Feb 27, 2009 at 10:19 AM, Leslie P. Polzer
<[email protected]> wrote:
>
> On Feb 27, 4:02 pm, Andrei Stebakov <[email protected]> wrote:
>> When return binary data directly from the handler everything works fine.
>> The problem now is when I try to upload an image to some site using
>> drakma:http-request, one of the arguments to the http-request (post
>> request) I supply a closure which is a function of one argument
>> (stream) which sends data to that stream.
>
> Can you be a bit more specific here? I'm not sure where you're passing
> a closure to what.
>
>
>> The problem is that when I upload an image this way, the receiving
>> server also gets corrupted data.
>> I think we need to fix this problem.
>
> Definitely.
>
>
>> Using (send-headers) is a clean way to reproduce the problem in Weblocks.
>> Does it only happen on my system, or someone can reproduce it as well?
>
> I'll check this later. For now:
>
> What version of Hunchentoot are you using (so we're on the same page)?
>
> How does your handler get called?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to