You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public BoundaryStreamReader(string boundary, Stream baseStream, Encoding streamEncoding, int bufferLength)
{
if (baseStream == null)
throw new ArgumentNullException("baseStream");
if (!baseStream.CanSeek || !baseStream.CanRead)
throw new ArgumentException("baseStream must be a seekable readable stream.");
if (bufferLength < boundary.Length + 6)
throw new ArgumentOutOfRangeException(nameof(bufferLength),
"The buffer needs to be big enough to contain the boundary and control characters (6 bytes)");
Unfortunately, if you screw up your request and forget the boundary element in the content-type header, you can have boundary = null in which case if (bufferLength < boundary.Length + 6) fails with a null reference, making it difficult to know what happend.
In my case someone decided to send this equest:
POST ...
Content-Type: multipart/form-data
... other headers ...
boundary: 125a17bf-935d-4686-b0c9-95a9543bf255
Content-Length: ...
The text was updated successfully, but these errors were encountered:
Interesting. Boundary is required so in case it's invalid we should send back a 400 indeed, especially as it's a required element. For reference, rfc is at https://tools.ietf.org/html/rfc7578
In OpenRasta/IO/BoundaryStreamReader.cs we have:
Unfortunately, if you screw up your request and forget the boundary element in the content-type header, you can have boundary = null in which case
if (bufferLength < boundary.Length + 6)
fails with a null reference, making it difficult to know what happend.In my case someone decided to send this equest:
The text was updated successfully, but these errors were encountered: