1. 11 Sep, 2019 3 commits
    • Kenton Varda's avatar
      Allow capability servers to redirect themselves. · f203027c
      Kenton Varda authored
      With this change, a capability server can implement `Capability::Server::shortenPath()` to return a promise that resolves to a new capability in the future. Once it resolves, further calls can be redirected to the new capability.
      
      The RPC system will automatically apply path-shortening on resolution. For example:
      * Say Alice and Bob are two vats communicating via RPC. Alice holds a capability to an object hosted by Bob. Bob's object later resolves itself (via shortenPath()) to a capability pointing to an object hoste by Alice. Once everything settles, if Alice makes calls on the capability that used to point to Bob, those calls will go directly to the local object that Bob's object resolved to, without crossing the network at all.
      * In a level 3 RPC implementation (not yet implemented), Bob could instead resolve his capability to point to a capability hosted by Carol. Alice would then automatically create a direct connection to Carol and start using it to make further calls.
      
      All this works automatically because the implementation of `shortenPath()` is based on existing infrastructure designed to support promise pipelining. If a capability server implements `shortenPath()` to return non-null, then capabilities pointing to it will appear to be unsettled promise capabilities. `whenResolved()` or `whenMoreResolved()` can be called on these to wait for them to "resolve" to the shorter path later on. Up until this point, RPC calls on a promise capability couldn't possibly return until the capability was settled, but nothing actually depended on this in practice.
      
      This feature will be used to implement dynamic path shortening through KJ streams and `pumpTo()`.
      f203027c
    • Kenton Varda's avatar
      Client::whenResolved() should automatically attach a reference. · fe6024d0
      Kenton Varda authored
      Capability::Clients do not follow the usual KJ style with regards to lifetimes of returned promises. RPC methods in particular automatically take a reference on the capability until the method completes. This makes some intuitive sense as Capability::Client itself is a pointer-like type implementing reference counting on some inner object.
      
      whenResolved() did not follow the pattern, and instead required that the caller explicitly take a reference. I screwed this up when using it, suggesting that it's pretty unintuitive. It's cheap and safe to automatically take a reference, so let's do that.
      fe6024d0
    • Kenton Varda's avatar
      Fix userland pipe bug that propagated EOF from a pump. · dba7f35b
      Kenton Varda authored
      A pump does not propagate EOF. So a BlockedRead state should not complete when a pump happens that does not satisfy the read.
      dba7f35b
  2. 10 Sep, 2019 3 commits
  3. 09 Sep, 2019 1 commit
    • Kenton Varda's avatar
      Fix http-test.c++ to avoid dubious assumptions about gather-writes. · 8f9717d2
      Kenton Varda authored
      Most (all?) implementations of `write(ArrayPtr<const ArrayPtr<const byte>>)`, if the outer array contains only one inner array, do not use the outer array again after the initial call returns (as opposed to the promise resolving). But, this is not a safe assumption and http-test.c++ should not be relying on it.
      
      (I found this when I tried forcing all writes to complete asynchronously to check if it resulted in any bugs. This is all I found.)
      8f9717d2
  4. 03 Sep, 2019 5 commits
  5. 21 Aug, 2019 1 commit
  6. 20 Aug, 2019 3 commits
  7. 05 Aug, 2019 1 commit
  8. 02 Aug, 2019 1 commit
    • Harris Hancock's avatar
      Report raw HTTP content when handling client protocol errors in kj-http · 350b2f2b
      Harris Hancock authored
      This information is typically necessary to debug such protocol errors. However, it requires special handling, since it could contain sensitive information.
      
      The code which has the best view on protocol errors is HttpHeaders::tryParseRequest(), which previously returned an empty Maybe<Request> on failure. This commit changes that function to return a OneOf<Request, ProtocolError>. This required some surgery in various other parts of the code to deal with the OneOf.
      350b2f2b
  9. 23 Jul, 2019 2 commits
  10. 22 Jul, 2019 3 commits
  11. 10 Jul, 2019 1 commit
  12. 08 Jul, 2019 16 commits