1. 25 Feb, 2018 1 commit
  2. 17 Feb, 2018 1 commit
  3. 16 Feb, 2018 4 commits
  4. 13 Feb, 2018 1 commit
    • Kenton Varda's avatar
      Redesign server-side WebSocket handling. · 632888d6
      Kenton Varda authored
      Previously HttpService had two virtual methods: request() and openWebSocket(). Since it's legitimate to respond to a WebSocket request with a normal HTTP response, openWebSocket() actually had a default implementation that fell back to request().
      
      In the new design, there is only request(). The HttpService detects a WebSocket request by checking the headers. A convenience method, HttpHeaders::isWebSocket(), is provided for this purpose.
      
      The new approach makes life much easier for services composed of many layers. For example, you might write an HttpService implementation which performs some URL or header rewrite and then calls on to another HttpService. Previously, every such wrapper would have to separately handle regular requests and WebSockets, usually with near-identical code. Of course, you could factor out the common code, but in practice this often turned out pretty clunky. Worse, developers would often just omit the openWebSocket() implementation since implementing only request() seems to work fine -- until you need a WebSocket, and everything is broken. With the new approach, you have to go somewhat out of your way to write a wrapper layer that breaks WebSockets.
      
      I did not apply the same logic to HttpClient because:
      
      1. It's not as easy: HttpClient's methods return results rather than calling a callback on completion, so unifying the methods would have forced request()'s signature to change. Lots of code would need to be updated, and would likely become uglier, as request() would now have to return a `webSocketOrBody` variant type even when the caller isn't asking for a WebSocket.
      2. People don't implement custom HttpClients nearly as often as they implement custom HttpServices.
      632888d6
  5. 11 Feb, 2018 3 commits
  6. 08 Feb, 2018 3 commits
  7. 07 Feb, 2018 3 commits
  8. 05 Feb, 2018 5 commits
  9. 04 Feb, 2018 1 commit
  10. 01 Feb, 2018 4 commits
  11. 31 Jan, 2018 1 commit
    • Kenton Varda's avatar
      Add Array::attach() and ArrayPtr::attach(). · 8447ac76
      Kenton Varda authored
      Array::attach() is like Own::attach().
      
      ArrayPtr::attach() promotes an ArrayPtr to an Array by attaching other objects to it. (Hopefully one of those objects actually owns the underlying array data.)
      8447ac76
  12. 30 Jan, 2018 2 commits
  13. 29 Jan, 2018 1 commit
  14. 26 Jan, 2018 2 commits
  15. 20 Jan, 2018 1 commit
  16. 19 Jan, 2018 1 commit
  17. 18 Jan, 2018 2 commits
    • Kenton Varda's avatar
      Fix newly-uncovered bug when pipelining requests with HttpClient. · d42d3b40
      Kenton Varda authored
      The headers for multiple responses could end up merged because the call to headers.clear() was happening too early. This manifested as `Content-Length: 7, 13` observed in the second pipelined response.
      d42d3b40
    • Kenton Varda's avatar
      Refactor handling of connection-level headers. · 3b08c76b
      Kenton Varda authored
      Although applications in theory shouldn't care to see connection-level headers (e.g. `Transfer-Encoding`), higher-level specs like the JavaScript Fetch API often specify that these headers should be visible, and they can be useful for debugging. So, this change makes it so that the application can see the connection-level headers on incoming requests.
      
      For outgoing requests, the application can provide an HttpHeaders object that specifies these headers (important especially for the pass-through case), but the HTTP implementation will ignore them.
      
      Additionally, we can now allow the application to set WebSocket connection-level headers on non-WebSocket requests. This is useful for frameworks that emulate WebSocket over HTTP and assume the ability to set WebSocket headers (especially `Sec-WebSocket-Extension`) on regular non-WebSocket HTTP requests.
      3b08c76b
  18. 11 Jan, 2018 4 commits