-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
failure to send octets to a :force-binary stream. #135
Comments
Note, in the docs:
https://edicl.github.io/drakma/#arg-force-binary I hope this work for writing too. (Maybe you have a valid point about flexi-stream with element type octect, I am not sure. Although since the doc explicitly suggests the underlying stream for binary IO, it may be by design. At least working with the underlying stream is a workaround for your code.) |
An answer on the flexi-stream issue explains it. edicl/flexi-streams#49 The problem is that flexi-stream interprets a buffer vector of T (or not vector of integer) as non-binary, without looking at the contents of the vector. If we don't pass a buffer vector of integer, it expects characters inside. So we have to copy the buffers to vectors of octets to have it take the binary data. This means that I have a work-around, but it may be rather costly when we use flexi-stream (and therefore when we use drakma that uses flexi-stream). The problem is not directly in drakma, but since it uses flexi-stream explicitely in its API, I think the documentation should mention that when working on the http stream, we're restricted to vectors of bytes to send and receive binary data. Therefore this issue could be converted in a documentation update issue for drakma and be closed. Thank you. |
@informatimago, you've probably missed the comment above. Writing through the underlying stream may save from the need to copy buffers. |
Ah, it's a possibility. I will try it and report. |
@avodonosov it works indeed using the underlying stream. It's a better solution. Thank you. |
I'm trying to get a binary stream, but drakma always opens a latin-1 stream
So when I try to write a sequence of bytes, the flexistream complains:
I reported also the issue to flexi-stream, edicl/flexi-streams#49 since from the name flexi-stream I would also have expected an ambivalent stream, but perhaps it's not how it's supposed to work.
The text was updated successfully, but these errors were encountered: