vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Function HTTPServerResponse.writeRawBody

Writes the whole response body at once, without doing any further encoding.

void writeRawBody(RandomAccessStream) (
  RandomAccessStream stream
) @safe
if (isRandomAccessStream!RandomAccessStream);

void writeRawBody(InputStream) (
  InputStream stream,
  size_t num_bytes = 0
) @safe
if (isInputStream!InputStream && !isRandomAccessStream!InputStream);

void writeRawBody(RandomAccessStream) (
  RandomAccessStream stream,
  int status
) @safe
if (isRandomAccessStream!RandomAccessStream);

void writeRawBody(InputStream) (
  InputStream stream,
  int status,
  size_t num_bytes = 0
) @safe
if (isInputStream!InputStream && !isRandomAccessStream!InputStream);

The caller has to make sure that the appropriate headers are set correctly (i.e. Content-Type and Content-Encoding).

Note that the version taking a RandomAccessStream may perform additional optimizations such as sending a file directly from the disk to the network card using a DMA transfer.

Authors

Sönke Ludwig, Jan Krüger, Ilya Shipunov

Copyright

© 2012-2017 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.