|
Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
|
Orbit 1.x is pre-stable: minor releases may break source compatibility (see API Stability). This guide lists every release that needs changes in application code or build files, with before/after examples. Releases that are not listed (1.1.x, 1.2.x, 1.4.0 → 1.5.1 patch) upgrade in place.
For the full list of changes see CHANGELOG.md.
server::App has never had a default constructor. Older snippets that write server::App app; do not compile.
Every type and function moved from generic top-level namespaces into orbit: server::App is now orbit::server::App, http::HttpRequest is orbit::http::HttpRequest, and so on for concurrency, config, database, http, middleware, network, openapi, orm, routing, server, utils and websocket.
Existing code keeps compiling. The old names are defined as aliases of the new ones (namespace server = orbit::server;), so 1.x code builds unchanged:
The aliases put names like server, http and config in the global namespace, which is what #39 set out to stop. If your own code uses any of those names, define ORBIT_NO_LEGACY_NAMESPACES (before the first Orbit include, or on the command line: -DORBIT_NO_LEGACY_NAMESPACES, or target_compile_definitions(app PRIVATE ORBIT_NO_LEGACY_NAMESPACES)) and use the orbit:: names. The aliases will be removed in 3.0.
Code that refers to Orbit with a leading :: (::server::App) needs the new name; so does code that forward-declares Orbit types in the old namespaces.
Request parsing moved to llhttp (#43), which is a new build dependency (vcpkg, Conan and system packages are all supported). It is strict, and a few requests are now answered differently:
BREW / HTTP/1.1) gets 501 Not Implemented instead of being routed;Content-Length header is rejected with 400, even when both values match;Content-Length or Transfer-Encoding has no body (RFC 9112): its stream ends at once instead of running until the client closes.http::parse_framing(), http::MessageFraming, http::decode_chunked() and http::ChunkedStatus were removed. http::HttpParser::parse() stays; it now returns std::nullopt for an incomplete request instead of a partial body.
Built without gRPC (ORBIT_ENABLE_GRPC=OFF, the default), server::GrpcServer::start() and add_service() now throw instead of doing nothing, and start() throws when the server cannot start.
ServerConfig::event_loops (--event-loops N, Linux) runs several event loops; the default of 1 keeps the previous behaviour.
1.6.0 is a security release. Most changes are fixes, but several intentionally tighten behaviour.
405. A request whose path matches but whose method does not now gets 405 Method Not Allowed with an Allow header (it was 404). HEAD is answered from the GET route. Clients or tests that expected 404 need updating.Decoded paths. req.uri, req.query and route params are percent-decoded. Remove any manual decoding, or values are decoded twice. The raw request-target is still available as req.target.
Paths containing an encoded /, \ or NUL get 400.
500. To customise the response, or to log the exception, register app.on_error(...). It now also receives exceptions from handlers that return a value.nbf are rejected; jwt_auth("") throws. Use JwtOptions for issuer/audience checks and leeway.state cookie set by login_handler(). Start logins through login_handler() instead of redirecting to the provider yourself.Reverse proxy. HTTPS upstreams are verified. For a private CA set ca_file; for a self-signed test upstream set verify_tls = false.
Distributed rate limiter. When Redis is unreachable, requests are now rejected with 503 (fail closed); before they got 429. To let traffic through instead:
.env, .git/) are no longer served; set StaticFilesOptions::serve_dotfiles if you really need them.; charset=utf-8.Bound parameters. The ORM sends values as bound parameters. Code that read orm::Expr::sql expecting values inlined, or passed arbitrary operator strings or non-identifier column names, must change. For raw SQL use the parameterised overloads:
Failures are reported. A failed PostgresClient query returns ResultSet::failure(message) instead of an empty result. Check it:
to_json().** Empty strings stay ""; only SQL NULL becomes null.Timeouts. The single 10-second timer is replaced by per-phase timeouts. If you relied on connections closing after 10 s of activity, set them explicitly:
host (--bind), backlog (--backlog, now SOMAXCONN by default instead of 10) and max_connections. The default bind address is unchanged (0.0.0.0).hiredis only because Orbit required it, drop it.Source compatible. HttpResponse setters now return the response, so they can be chained; code that ignored the old void return still compiles.
The installed CMake package and its targets moved from HttpServer to OrbitFramework.
PostgresClient::query callbacks get a database::ResultSet instead of a raw PGresult*, and no longer need to free it.
Public headers moved from src/ (installed as include/http-server/) to include/orbit/. Update includes:
Add the install prefix's include/ directory to your include path (the CMake package does this for you) instead of include/http-server/.