Semantics of constrained blob streams for the server #1389
Labels
documentation
This is a problem with documentation.
guidance
Question that needs advice or information.
What should a server do upon receiving a streaming blob that does not satisfy the modeled constraint traits?
Currently, the only allowed constraint trait on the
blob
shape is thelength
trait.When the blob is non-streaming, the server framework can buffer the entire request body in memory, check the length, and only then hand the blob to the application code. This is what smithy-rs does in this case.
However, when the blob is streaming, the intention is that the application code can begin working with the stream of bytes as they come in, processing the stream chunk by chunk. For example, smithy-rs hands the application code a
aws_smithy_http::byte_stream::ByteStream
, a type that implements theStream
trait, that users can lazily poll for chunks ofBytes
.So, how should a server enforce a
length
constraint trait on the streaming blob?length.max
value?length.min
?Bear in mind that application code is free to poll the stream however much they need. That is, it's perfectly valid for application code to poll
n
bytes (and possibly start rendering a response!) and ignore (or not) the rest. Perhapsn
is not within the modeledlength
bounds, but the full blob stream the client sent is.The text was updated successfully, but these errors were encountered: