drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.04k stars 1.06k forks source link

Expose more ways to obtain information about requests #2005

Open Mis1eader-dev opened 2 months ago

Mis1eader-dev commented 2 months ago

Is your feature request related to a problem? Please describe. In a reverse proxy application it is essential to know information about a request like its protocol (http, ws, etc.), or whether the request itself is a WebSocket.

Otherwise drogon::app().forward(...) can't make proper forwarding to the backend without rewriting what is already implemented in HttpServer.cc.

Describe the solution you'd like Several options:

  1. Expose the protocol string.
  2. Add a local boolean member within requests called isWebSocket.
  3. Expose the already implemented method in HttpServer.cc.

Describe alternatives you've considered Rewriting the current implementation.