Repository navigation
0.6.0
Added
- Interceptors: code that runs around every call, for authentication by metadata, logging and metrics in one place.
addInterceptoron a server (GrpcServer,AsyncGrpcServer) and on a channel (GrpcChannel,AsyncChannel). A server interceptor sees the path, the metadata and the deadline of a call to a registered method before its request is decoded, may set response metadata, and either lets the call proceed or refuses it with a status; after the handler it sees what the handler raised. A client interceptor may change the metadata and the deadline of everyunaryCallandnewCallon the channel, those of generated clients included, and sees the outcome of a unary call. Interceptors see no messages. An interceptor that swallows the error of a call does not turn it into OK. With no interceptor added nothing changes. How to: docs/interceptors.md; example:examples/interceptors.nim. Tests:tests/tinterceptors.nim.
Changed
- nghttp2 1.71.0 (from 1.68.1) in the CI,
tools/build-nghttp2.shand the build instructions. The library's code did not change for it. Run against it on 2026-11-16: the 25 test files,tools/hostile.sh(both servers, 0 failed), the interop cases with grpc-go v1.76.0 in both directions in plaintext, TLS and mutual TLS (blocking and chronos peers), and h2spec 2.6.0 (the same results as with 1.68.0). The lowest version that builds is still 1.61.0. - The CI checks the SHA-256 of the nghttp2 archive it downloads, as
tools/build-nghttp2.shalready did. - h2spec:
tools/h2specasyncandtools/h2specservertake a delay before their answer,tools/conformance.shuses 100 ms for both, and with it the timing artefacts of the test servers no longer occur, sotools/h2spec_check.pyaccepts nothing but the nine differences between RFC 7540 and RFC 9113; docs/h2spec.md has the runs. - chronos server:
stopstarts closing every connection before it waits for any of them (it closed them one after another).
Fixed
- A connection no longer holds a Nim reference to the
TlsConfigit was made with (ConnObj.tlsConf, blocking and chronos): the C side counts the owners of the configuration atomically since 0.3.1, so the reference only added reference-count traffic on an object that the caller's thread also uses, and aConnis freed on the thread that closes it. A blockingGrpcChannelholds ashareof the configuration instead of the caller's object, soclosemay run on a thread other than the one that dialled without touching the count of the object that thread passed todial. Test:tests/ttls.nim("channels dialled on several threads"); it passes on the old code too (the race is not reproduced), it guards the new ownership. - chronos adapter (client and server): a connection was closed with the socket still holding bytes that had not been read, when the peer sent something right behind the frame that ended the connection (a PING behind its GOAWAY, say). The kernel then sends a TCP reset instead of an orderly end, and a reset can cost the peer what it has not read yet. A connection that is being closed now ends its own side first, throws away what the peer still sends until the peer ends its side, for one second and one mebibyte at most, and closes the socket after that; a connection whose socket failed is closed at once as before. Found by h2spec (test 7, about one run in ten); the blocking adapter did not have it. Tests:
tests/tasynch2.nim(suite "how a connection is closed"). - chronos adapter: a connection whose peer had sent GOAWAY, with no call left, stayed open until the peer closed it if the GOAWAY arrived while the connection still had bytes to write: whether the session had finished was looked at only when input arrived. It is looked at after each write too. Found by the test above (about one run in ten of the file hung).
Upgrade notes: docs/upgrading.md (section 0.6.0).