beast: Can not beast::http::read with boost::asio::streambuf

beast::http::read(stream, cache, parser); does not compile with

using cache_type = boost::asio::streambuf;
cache_type streambuf;
beast::buffers_adapter<cache_type::mutable_buffers_type> cache(streambuf.prepare(512));

but I compiles with boost::asio::mutable_buffer cache; According to the documentation buffers_adapter takes a MutableBufferSequence which boost::asio::streambuf::prepare fullfills and wraps it to a DynamicBuffer. Have I missunsterstood something? Im using gcc6.1 on ubuntu 17.04.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I wish I could say that I have never tried to do such a thing…

tsk tsk!

Ur right, lol, fail.

beast::http::read(
    stream,
    beast::buffers_adapter<cache_type::mutable_buffers_type>(streambuf.prepare(512)),
    parser);

You’re trying to bind a temporary to a non-const reference parameter? tsk tsk! I think that’s not valid C++!

Yes! I was able to reproduce your defect. I believe this branch fixes your problem please try it: https://github.com/vinniefalco/Beast/commits/v44

the error occurs on compiling the line beast::http::read(...)

I set up a quick project https://github.com/qwertzui11/beast_issue386 Because I’m not at work the compiler now is g++5.4.0, Boost-1.58 and ubuntu 16.04 At work the same error occurs with g++6.1, Boost-1.64 and ubuntu 17.04 Beast version is “master” (v44?)

Another issue occured with g++5.4.0 when I replace in https://github.com/qwertzui11/beast_issue386/blob/master/test.cpp line 1 and 2 with #include <beast/core.hpp> it doesnt compile because of the header files.