contentLengthDiscard
Function parameters
Parameters
- io_r:*std.Io.Reader
- limit:std.Io.Limit
Type definitions in this namespace
Types
- Method
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
- Status
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
- TransferEncoding
- compression is intentionally omitted here since it is handled in `ContentEncoding`.
- BodyWriter
- Request or response body.
Source
Implementation
fn contentLengthDiscard(io_r: *std.Io.Reader, limit: std.Io.Limit) std.Io.Reader.Error!usize {
const reader: *Reader = @alignCast(@fieldParentPtr("interface", io_r));
const remaining_content_length = &reader.state.body_remaining_content_length;
const remaining = remaining_content_length.*;
if (remaining == 0) {
reader.state = .ready;
return error.EndOfStream;
}
const n = try reader.in.discard(limit.min(.limited64(remaining)));
remaining_content_length.* = remaining - n;
return n;
}