rpc_dart_http 0.2.4
rpc_dart_http: ^0.2.4 copied to clipboard
HTTP/1.1 caller/responder transports for rpc_dart (unary only).
0.2.4 #
- Deliver the
400when a request body exceedsRpcSecurityPolicy.maxMessageLengthBytes. The responder used to stop reading the moment the limit was passed, which left unread bytes on the socket; dart:io then tore the connection down before the response was flushed and the client saw "Connection closed before full header was received" instead of the status. The body is now drained to its end (buffer dropped, later chunks discarded, so memory stays bounded) before the400is returned. - Validate outgoing metadata on send. Both the caller (
sendMetadata) and the responder (sendMetadata) now runRpcSecurityPolicy.validateMetadatabefore writing headers, closing the gap where HTTP/1.1 sent metadata without the checks every other transport applies. Combined with the core change, this enforces printable-ASCII header values (%x20-%x7E) — non-ASCII / CR-LF values are rejected with anArgumentErrorinstead of corrupting or injecting HTTP headers. The caller uses a defaultRpcSecurityPolicy; the responder uses its configuredsecurityPolicy(or the default when unset).
0.2.3 #
- BEHAVIORAL CHANGE (secure-by-default CORS):
RpcHttpCorsPolicy.allowedOriginsnow defaults toconst [](CLOSED) instead ofconst ['*']. With the closed default, cross-origin browser preflights are rejected (403, noaccess-control-allow-origin) and cross-origin actual requests receive no CORS headers, so the browser blocks the response read. Same-origin requests (which carry noOriginheader) are unaffected. The previous allow-any-origin default let any web page (including DNS-rebinding / drive-by attackers) call a local/internal RPC server. To restore the old behavior, passallowedOrigins: ['*']explicitly, or list specific origins. - Allowing any origin via
allowedOrigins: ['*']now emits a one-time warning (via an optionalloggeron the policy constructor, falling back to stderr), noting it is intended for dev / public-API use only. The existing assert that'*'is incompatible withallowCredentialsis unchanged.
0.2.2 #
- Server-side hardening.
RpcHttpServernow forwards asecurityPolicyand an optionalbodyReadTimeoutto itsRpcHttpResponderTransport. Previously the server constructed the transport with only the CORS policy, so request bodies reached via the public server API were buffered UNBOUNDED (DoS via large/slow POST) and had no read timeout (slowloris). - BEHAVIORAL CHANGE:
securityPolicydefaults to a non-nullconst RpcSecurityPolicy(), so the built-inmaxMessageLengthBytes(16 MiB), header, and concurrency limits are now ENFORCED out of the box. Requests exceeding the body limit are rejected with400instead of being buffered. PasssecurityPolicy: nullto opt out (not recommended), or a tunedRpcSecurityPolicyto adjust the limits. - Added
RpcHttpServer.actualPortgetter (returns the OS-assigned port after binding when constructed with port0).
0.2.1 #
- Added
test/web_smoke_test.dart: cross-platform (dart2js) smoke test proving theRpcHttpCallerTransportclient compiles to JS and round-trips a unary call without a real server. It injects apackage:httpMockClientthat decodes the gRPC-framed request and returns a canned framed response. - Wired the http web smoke into the
just test_webrecipe and thewebCI job (runs on-p node; also verified on-p chrome).
0.2.0 #
- Updated to
rpc_dart: ^3.0.0. RpcHttpServer: addedafterModulesStarthook support.
0.1.0 #
- Initial release: HTTP/1.1 unary-only transport for rpc_dart using
shelf.