- 13 Feb, 2018 1 commit
-
-
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.
-
- 11 Feb, 2018 2 commits
-
-
Kenton Varda authored
-
Kenton Varda authored
This is particularly useful for implementing logic to grab the client's IP address and shove it in X-Real-IP.
-
- 08 Feb, 2018 3 commits
-
-
Kenton Varda authored
Fix new compiler warnings.
-
Kenton Varda authored
Add project() call to root CMakeLists.txt
-
Kenton Varda authored
-
- 07 Feb, 2018 3 commits
-
-
Kenton Varda authored
Fix bug in HTTP client connection reuse.
-
Kenton Varda authored
-
Tim Hutt authored
Fixes issue #629
-
- 05 Feb, 2018 5 commits
-
-
Kenton Varda authored
Use application/x-www-form-urlencoded for URL query strings
-
Harris Hancock authored
The main motivation here is to make sure we don't %-escape incoming pluses, but rather interpret them as spaces.
-
Harris Hancock authored
These are almost the same as {encode,decode}UriComponent, differing only in the set of characters they consider reserved, and their treatment of spaces. I wasn't sure what to name them -- encodeWwwForm() seemed least bad. For the encode side, I added a completely separate function -- it seemed like more trouble than it was worth trying to integrate the changes into encodeUriComponent(). For the decode side, I integrated the change (plus-to-space) into decodeBinaryUriComponent(), since that function is a bit longer, and the change was trivial.
-
Kenton Varda authored
Add option to omit default-valued primitives from JSON output.
-
Kenton Varda authored
-
- 04 Feb, 2018 1 commit
-
-
Kenton Varda authored
-
- 01 Feb, 2018 4 commits
-
-
Kenton Varda authored
Fix bug where DNS lookup would fail for very long hostnames.
-
Kenton Varda authored
-
Kenton Varda authored
Add Array::attach() and ArrayPtr::attach().
-
Kenton Varda authored
-
- 31 Jan, 2018 1 commit
-
-
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.)
-
- 30 Jan, 2018 2 commits
-
-
Kenton Varda authored
Allow working around the message size limit
-
Alex Silverstein authored
-
- 29 Jan, 2018 1 commit
-
-
Kenton Varda authored
-
- 26 Jan, 2018 2 commits
-
-
Kenton Varda authored
Treat 'Premature EOF' error on async stream as DISCONNECTED.
-
Kenton Varda authored
Unfortunately TCP does not always distinguish between dirty connection failure and clean connection shutdown. In practice, though, "Premature EOF" errors on streams basically always appear to be due to disconnects (including when the peer crashes).
-
- 20 Jan, 2018 1 commit
-
-
Kenton Varda authored
-
- 19 Jan, 2018 1 commit
-
-
Kenton Varda authored
Refactor handling of connection-level headers.
-
- 18 Jan, 2018 2 commits
-
-
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.
-
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.
-
- 11 Jan, 2018 11 commits
-
-
Kenton Varda authored
Silence compiler warning about non-virtual dtor on non-final classes
-
Harris Hancock authored
-
Kenton Varda authored
Make AsyncUnixTest/InterruptedTimer slower on Linux becaues it turns out to be flaky on machines other than mine.
-
Kenton Varda authored
-
Kenton Varda authored
Replace all include guards with #pragma once.
-
Kenton Varda authored
@kloepper pointed out a while back that every compiler you've ever heard of supports this. Plus, it's more concise, it's not prone to copy-paste errors, and it looks nicer. At the time I wanted to remain consistent and I didn't feel like spending the time to update all my existing code. But, every time I've added a new header since I've cursed the include guard, so I finally broke down and changed it.
-
Kenton Varda authored
Fix wrong poll/epoll timeout after EINTR.
-
Kenton Varda authored
-
Kenton Varda authored
-
Kenton Varda authored
-
Kenton Varda authored
Fix capnp_generate_cpp usage of --src-prefix
-