Commit graph

18 commits

Author SHA1 Message Date
Bert Belder 5b1e537446
refactor(ext/http): rewrite hyper integration and fix bug (#12332)
Fixes: #12193
2021-11-08 12:49:11 -08:00
Leo K 6268703487
fix(ext/http): allow multiple values in upgrade header for websocket (#12551)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2021-10-26 23:06:44 +02:00
Aaron O'Mullan c27ef0ac7b
perf(http): encode string bodies in op-layer (#12451)
Using serde_v8's StringOrBuffer
2021-10-26 22:00:01 +02:00
Ikko Ashimine a1d6b53acd
docs(ext/http): fix typo in http/lib.rs (#12466) 2021-10-17 20:04:44 +09:00
Luca Casonato c40d5040cd
fix(http): don't expose body on GET/HEAD requests (#12260)
GET/HEAD requests can't have bodies according to `fetch` spec. This
commit changes the HTTP server to hide request bodies for requests with
GET or HEAD methods.
2021-10-11 18:39:55 +02:00
Leo K 77a00ce1fb
chore: various op cleanup (#12329) 2021-10-05 22:38:27 +02:00
Ben Noordhuis 2b6f8d0187
fix(ext/http): include port number in h2 urls (#12181) 2021-09-26 20:26:16 +02:00
Aaron O'Mullan 3c88dffd32
fix(http): panic when responding to a closed conn (#12216)
Our oneshot receiver in `HyperService::call` would unwrap and panic, the `.await` on the oneshot receiver happens when the sender is dropped.

The sender is dropped in `op_http_response` because:
1. We take `ResponseSenderResource`
2. Then get `ConnResource` and early exit on failure (conn already closed)
3. The taken sender then gets dropped in this early exit before any response is sent over the channel

Fallbacking to returning a dummy response to hyper seems to be a fine quickfix
2021-09-25 13:22:19 +02:00
Ben Noordhuis 16ea39ee48
fix(ext/http): fortify "is websocket?" check (#12179)
Check for expected headers more rigorously and check that it's a
HTTP/1.1 GET request. The logic mirrors what Deno Deploy and the
tungstenite crate do.

The presence of "Sec-Websocket-Version: 13" is now also enforced.
I don't expect that to break anything: conforming clients already
send it and tungstenite can't talk to older clients anyway.

The new code is more efficient due to heap-allocating less and aligns
more closely with the checks in ext/http/01_http.js now.
2021-09-25 10:02:26 +02:00
Luca Casonato fcd0992dba
fix: move unstable declarations to deno.unstable (#11876) 2021-08-31 11:25:15 +02:00
Bartek Iwańczuk d1d2388d7f
test(ext/http): add test for incomplete HTTP message and fix resource leak (#11717)
This commit adds a test case for "Http: connection closed before
message completed" error as well as fixing an edge with resource
leak when the error is raised.
2021-08-16 13:43:43 +02:00
Aaron O'Mullan 2ca454b402
refactor(ops): return BadResource errors in ResourceTable calls (#11710)
* refactor(ops): return BadResource errors in ResourceTable calls

Instead of relying on callers to map Options to Results via `.ok_or_else(bad_resource_id)` at over 176 different call sites ...
2021-08-15 13:29:19 +02:00
Aaron O'Mullan 18ff6bb053
perf(ext/http): faster req_url string assembly (#11711)
This stood out on a flamegraph, it took up ~1% of a profiled loadtest of `cli/bench/deno_http_native.js`
2021-08-15 12:25:16 +02:00
Aaron O'Mullan c87b13e745
cleanup(ext/http): simplify cookie header handling (#11704)
cleanup(ext/http): simplify cookie header handling

Use `Vec::join` instead of essentially reimplementing it. There should be no meaningful performance delta
2021-08-14 14:35:58 +02:00
Aaron O'Mullan 8fa46a7b44
cleanup(ext/http): simplify op_http_request_next (#11691)
* cleanup(ext/http): simplify op_http_request_next

Keep op_http_request_next's high-level logic simple, factor out NextRequestResponse building to prepare_next_request() for improved readability & maintainability

* cleanup(ext/http): break prepare_next_request() into meaningful sub-funcs
2021-08-14 13:25:05 +02:00
Leo K 0c9d6cbb2a
fix(http/ws): support multiple options in connection header (#11675)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-08-13 20:52:13 +02:00
Bartek Iwańczuk 2937f02f00
fix(ext/http): remove unwrap() when HTTP conn errors (#11674) 2021-08-13 12:07:05 +02:00
Ryan Dahl a0285e2eb8
Rename extensions/ directory to ext/ (#11643) 2021-08-11 12:27:05 +02:00
Renamed from extensions/http/lib.rs (Browse further)