Boost logo

Boost :

Subject: Re: [boost] [Beast] Questions Before Review
From: Artyom Beilis (artyom.beilis_at_[hidden])
Date: 2017-07-01 19:27:03

http vs WebSocket

I noticed some strange difference in these requests :

 // Wrap the now-connected socket in a websocket stream
    websocket::stream<tcp::socket&> ws{sock};

    // Perform the websocket handhskae
    ws.handshake(host, "/", ec);
        return fail("handshake", ec);

This one is fast and easy to use does all it needed

Now HTTP is very different story

    http::request<http::string_body> req;
    req.version = 11;
    req.set(http::field::host, host + ":" +
    req.set(http::field::user_agent, BEAST_VERSION_STRING);

Most of stuff can be defined there by default: version 1.1, Host header -
required by http/1.1 why should I bother? User agent put one by default
unless user wants - you do all this stuff for WS handshake so why not
there? Why so complicated?


Protocol Premier HTTP/1.1 example without host. Your example isn't valid
HTTP /1.1 request.

HTTP /1.1 unlike 1.0 requires host header


Boost list run by bdawes at, gregod at, cpdaniel at, john at