-
Notifications
You must be signed in to change notification settings - Fork 26
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
Trying to write octets to a flexi-stream fails. #49
Comments
The implementation seems to partially support binary output. Line 147 in 74a1027
It seems, if the sequence you try to write was an array with integer element type, the output would work. Also the docstring of that function:
Speaking of mixing the chars and octets in the sequence, the code seems to only support it for lists: Line 129 in 74a1027
For other input sequences, the code applies to every element a The body is expected to get the current element using Line 187 in 74a1027
|
Ok. Thank you for the answer. I find it regretable that libraries impose such restrictions, given that CL itself doesn't.
so you may want to keep the issue to allow vectors of any type of element, as long as the contents is acceptable, or reject it (and close it). For now I have a workaround, that makes it more costly to use flexi-stream: I just have to copy the data to temporary vector of octet buffers. Thank you. |
If anything, I am not a maintainer, just a subscribed user. Contributed some fixes in the past, so curious to look at issues sometimes. |
So, in short, the issue is: flexi-streams, for input arrays whose element-type is not explicitly binary, always assumes characters. You want it instead to look at the stream element type of the flexi stream itself. Right? That may be reasonable, especially that CLHS entry for write-sequence mentions stream element type in a way that may be interpretted to suggest such an aporoach:
But changing flexi-streams this way will break compatibility: somebody who was successfully performing character output on flexi-stream with element type octet will suddenly get a failure. The most flexible would be to look at the actual type of every element, as it is currently implemented for lists, but I suppose that was avoided for arrays in a quest for higher performance. |
The stream is created by
drakma:http-request
with:force-binary t
We can seen in the inspect below that it is "wellformed" AFAIK, having ELEMENT-TYPE: FLEXI-STREAMS:OCTET. But when my code sends it bytes with write-sequence, it rejects by octets, expecting characters:The text was updated successfully, but these errors were encountered: