Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
Once the caller determines that the HTTP request is a WebSocket Upgrade, additional overloads of一旦确认 HTTP 请求是 WebSocket 升级请求,就可以使用 [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:的额外重载版本,这些重载接受整个 HTTP 请求头部对象来完成握手。通过手动读取请求,程序既能处理普通 HTTP 请求,也能处理升级请求。同时,程序还可以基于 HTTP 字段(例如基本认证)来实施策略控制。以下示例先使用 HTTP 算法读取请求,然后将其传递给新构造的流: