I have a lazy input range that produce alot of data (e.g. 1GB). I want to send this data via http without creating temporary array. The most intuitive way would be overloaded method "writeBody" that takes any range of bytes or chars. But there is no such overload. I tried to use StreamOutputRange but it looks wierd:

(scope req) {
	auto writer = StreamOutputRange(req.bodyWriter);
	foreach (c; range) {
		writer.put(c);
	}
}

I am sure that it is not effective and requires internal buffer for whole data. Is it possible to move this foreach iteration into vibe.d? Something like

(scope req) {
	auto reader = InputRangeStream(range); // must be template to inline ranges iteration
	req.writeBody(reader);
},

In this case vibe.d may write data directly to output buffer after this delegate completed. No additional memory required (only small buffer for one tcp frame that already exists). I am not sure about Content-Length. In case of RandomAccessRange everything is ok, in case of InputRange the only way is chunked encoding.

Same improvement would be perfect for raw TCP.