|
From: Glyn M. <gly...@gm...> - 2010-02-10 09:15:37
|
Hi Erik,
On 9 February 2010 23:52, Nelson, Erik - 2
<eri...@ba...>wrote:
> Is there any reason I can't send a binary response?
>
> For example, the hello_world_server has
>
> response = server::response::stock_reply(server::response::ok, "Hello,
> World!");
>
> Could I fill a string with binary data and send it like this?
>
> String s("\0\0\0\0\0")
> response = server::response::stock_reply(server::response::ok, s);
>
> and get it out on the client side? If so, would I use
> boost::network::body(response) on the client side, or something else?
>
You'd have to base 64 encode and decode any binary data in HTTP. There's
nothing in cpp-netlib which does this, but you can use:
https://svn.boost.org/trac/boost/browser/trunk/boost/archive/iterators/base64_from_binary.hpp
before copying your data to the message on the server and.
https://svn.boost.org/trac/boost/browser/trunk/boost/archive/iterators/binary_from_base64.hpp
for the client.
HTH,
Glyn
|