Re: [Cppcms-users] HTTP response and binary stream (libharu)
Brought to you by:
artyom-beilis
From: Joerg S. <jo...@br...> - 2015-09-20 17:12:34
|
On Fri, Sep 18, 2015 at 07:22:16PM +0000, Artyom Beilis wrote: > Several points: > (a) You misunderstand meaning of "raw" output - "raw" means you are sending CGI output including headers etc on your own and CppCMS does not interfere with it. There only very-very specific cases you may actually need this - bottom line you don't need it.(b) std::ostream is just a character or more correctly octet stream, std::string is a container that keeps bytes/"C chars"/octets in it in string friendly way. You can put any binary data to it. > Now in your case the problem is there" > app()->response().out() << buf << std::flush; or > cppcms_buf << buf > > Why? std::ostream assumes that buf is NUL terminated string so it would stop on NUL, and this what corrupts the stream.You need to use std::ostream::write, i.e. > out().write(buf,siz) Depends on the type of buf. If it is a std::string, it should work fine? That said, I have no idea what overloading the other library provides. Joerg |