Once the caller determines that the HTTP request is a WebSocket Upgrade, additional overloads of [link beast.ref.boost__beast__websocket__stream.accept `accept`] and [link beast.ref.boost__beast__websocket__stream.async_accept `async_accept`] are provided which receive the entire HTTP request header as an object to perform the handshake. By reading the request manually, the program can handle normal HTTP requests as well as upgrades. The program may also enforce policies based on the HTTP fields, such as Basic Authentication. In this example, the request is first read in using the HTTP algorithms, and then passed to a newly constructed stream:
Once the caller determines that the HTTP request is a WebSocket Upgrade, additional overloads of [link beast.ref.boost__beast__websocket__stream.accept `accept`] and [link beast.ref.boost__beast__websocket__stream.async_accept `async_accept`] are provided which receive the entire HTTP request header as an object to perform the handshake. By reading the request manually, the program can handle normal HTTP requests as well as upgrades. The program may also enforce policies based on the HTTP fields, such as Basic Authentication. In this example, the request is first read in using the HTTP algorithms, and then passed to a newly constructed stream: