Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
8053071
quic: for streams allow ReadableStream as body
martenrichter Oct 12, 2025
33389e6
quic: Fix linting
martenrichter Oct 12, 2025
b8ee87a
quic: Fix linting2
martenrichter Oct 12, 2025
bf5e735
Test: catch close error
martenrichter Oct 18, 2025
016af68
quic: FIx several minor errors
martenrichter Oct 18, 2025
360aba8
Fix DataQueueFeeder
martenrichter Oct 18, 2025
a178c96
Fix Acknowledgement
martenrichter Oct 18, 2025
f80300b
Quic: fix Impl lifetime error
martenrichter Oct 19, 2025
526d8d5
Fix calling FinishClose multiple interleaving times
martenrichter Oct 19, 2025
82b8bfd
quic: fix crash in DataFeeder impl
martenrichter Oct 19, 2025
33278c6
quic: Fix linting 3
martenrichter Oct 19, 2025
f31ed61
quic: Fix linting 4
martenrichter Oct 19, 2025
fea4894
quic: Move DataQueueFeeder parts to header for non-windows build
martenrichter Oct 19, 2025
cb37974
quic: Move DataQueueFeeder to class body
martenrichter Oct 20, 2025
cc57a30
quic: Fix compilation on non-Windows
martenrichter Oct 20, 2025
d1c47e2
quic: Fix lint and unused variable
martenrichter Oct 20, 2025
6eabd64
quic: Fix format-cpp
martenrichter Oct 20, 2025
fde0404
quic: Improve test coverage
martenrichter Nov 1, 2025
da0298f
quic: Move helper functions to separate files
martenrichter Nov 2, 2025
af5d786
quic: add client to server unidirectional test
martenrichter Nov 2, 2025
963d492
quic: Fix new test and lint
martenrichter Nov 2, 2025
8b7bff6
quic: Fix new test 2
martenrichter Nov 2, 2025
0d51a86
quic: Fix use after free in next
martenrichter Nov 2, 2025
79b1673
quic: Fix lint
martenrichter Nov 2, 2025
eef7b1a
quic: Fix crash if queue_ is nullptr
martenrichter Nov 3, 2025
481aaf7
quic: Fix use after free in UpdateDataStats
martenrichter Nov 8, 2025
b4bff44
quic: Fix object lifetime in nested calls
martenrichter Nov 8, 2025
4d8fce6
quic: Fix race condition in Stream::Outbound::Pull
martenrichter Nov 9, 2025
0edf386
quic: Fix format-cpp
martenrichter Nov 9, 2025
4d6c889
quic: Remove debug message
martenrichter Nov 9, 2025
6e2d4ed
quic: Add ReadableStream to setOutbound (add to docs)
martenrichter Nov 9, 2025
d84410e
Add bidirectional server echo test
martenrichter Nov 9, 2025
d0831c1
quic: Fix cosmetic problems after review
martenrichter Nov 9, 2025
ec9524b
quic: Move DatequeueFeeder to queue.*
martenrichter Nov 9, 2025
e1eb51e
quic: Instead of shared_ptr use reference to Session
martenrichter Nov 9, 2025
aab3aa6
quic: Fix usings
martenrichter Nov 9, 2025
bb4b72a
quic: Fix format-cpp issue
martenrichter Nov 9, 2025
c923ac3
quic: Add env.h import to queue.h
martenrichter Nov 9, 2025
b7dafb9
quic: Fix header ordering
martenrichter Nov 9, 2025
cfd96c6
quic: Add async wrap
martenrichter Nov 10, 2025
eb07bd8
quic: Change header ordering in test_dataqueue
martenrichter Nov 10, 2025
cc57ac6
quic: next try of header ordering
martenrichter Nov 10, 2025
e8eebba
quic: Add aliased struct
martenrichter Nov 10, 2025
4a3de46
quic: queue.h change env.h to env-inl.h
martenrichter Nov 10, 2025
2e7ba46
quic: Move dataqueue feeder to queue
martenrichter Nov 15, 2025
deb76a9
quic: Fix test util function and use custom uint8array comparison
martenrichter Nov 15, 2025
f3427de
quic: Fix linting
martenrichter Nov 15, 2025
a318f29
quic: Fix lint
martenrichter Nov 15, 2025
12f1c3f
quic: lint
martenrichter Nov 15, 2025
ada59e0
quic: Change streaming implementation and various bugfixes
martenrichter Nov 22, 2025
c8d79c4
quic: Fix lint
martenrichter Nov 22, 2025
e613da3
quic: Fix format-cpp
martenrichter Nov 22, 2025
b81a3a9
quic: Fix lint
martenrichter Nov 22, 2025
5c4310a
quic: do not capture reader
martenrichter Nov 22, 2025
a31c9ab
quic: format-cpp
martenrichter Nov 22, 2025
4920725
quic: Remove debug counter
martenrichter Nov 22, 2025
a8231be
quic: Fix dataqueue test
martenrichter Nov 22, 2025
a971988
quic: correct behaviour use wait instead of block
martenrichter Nov 23, 2025
0c50006
quic: Fix dataqueue test
martenrichter Nov 23, 2025
78b724d
quic: Change Blob Reader to coalesce buffers
martenrichter Nov 23, 2025
4fdb2a3
quic: format-cpp
martenrichter Nov 23, 2025
d568012
quic: Format-cpp
martenrichter Nov 23, 2025
620d432
quic: Fix logic in IdempotentDataQueueReader
martenrichter Nov 23, 2025
e0baa8e
quic: format_cpp
martenrichter Nov 23, 2025
7a7f2f9
quic: Adapt blob test to new behaviour
martenrichter Nov 23, 2025
8548943
quic: Limit blob buffer coalescence
martenrichter Nov 24, 2025
8991e80
quic: Add dones clear, potentially fix mac issue
martenrichter Nov 24, 2025
0aa6582
quic: Temporarily deactivate SetImmediate
martenrichter Nov 24, 2025
1237370
Revert "quic: Temporarily deactivate SetImmediate"
martenrichter Nov 24, 2025
a2c7286
quic: Temporarily deactivate waited_next_
martenrichter Nov 24, 2025
72d854e
Revert "quic: Temporarily deactivate waited_next_"
martenrichter Nov 24, 2025
aa4fbb8
quic: Clear waited_next in NonIdempotentDataQueueReader
martenrichter Nov 24, 2025
b17137e
quic: Try to unlock the circle reference in dataqueue
martenrichter Nov 25, 2025
a12948d
Revert "quic: Try to unlock the circle reference in dataqueue"
martenrichter Nov 25, 2025
ce017dd
Revert "quic: Clear waited_next in NonIdempotentDataQueueReader"
martenrichter Nov 25, 2025
5ad8b54
quic: Use weak pointer in blob reader pull
martenrichter Nov 25, 2025
c946648
quic: Fix assertion
martenrichter Nov 25, 2025
b870653
quic: Fix assertation 2
martenrichter Nov 25, 2025
77afe06
quic: Remove wrong comment
martenrichter Nov 26, 2025
10833c5
quic: Bring blob test closer to old spirit
martenrichter Nov 27, 2025
3c5e791
quic: Remove redundant std::move
martenrichter Nov 29, 2025
5dd6c64
quic: Adhere to new js linting
martenrichter Nov 29, 2025
2d3847e
quic: Fix blob test, as the value may be time dependent
martenrichter Nov 29, 2025
15d2cc1
quic: Fix again blob test to new behaviour
martenrichter Nov 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions doc/api/quic.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ added: v23.8.0
-->

* `options` {Object}
* `body` {ArrayBuffer | ArrayBufferView | Blob}
* `body` {ArrayBuffer | ArrayBufferView | Blob | ReadableStream<Uint8Array>}
* `sendOrder` {number}
* Returns: {Promise} for a {quic.QuicStream}

Expand All @@ -489,7 +489,7 @@ added: v23.8.0
-->

* `options` {Object}
* `body` {ArrayBuffer | ArrayBufferView | Blob}
* `body` {ArrayBuffer | ArrayBufferView | Blob | ReadableStream<Uint8Array>}
* `sendOrder` {number}
* Returns: {Promise} for a {quic.QuicStream}

Expand Down Expand Up @@ -820,7 +820,7 @@ The callback to invoke when the stream is reset. Read/write.
added: v23.8.0
-->

* Type: {ReadableStream}
* Type: {ReadableStream | undefined}

### `stream.session`

Expand All @@ -832,6 +832,16 @@ added: v23.8.0

The session that created this stream. Read only.

### `stream.setOutbound(outbound)`

<!-- YAML
added: REPLACEME
-->

* `outbound` {ArrayBuffer|SharedArrayBuffer|ArrayBufferView|Blob|ReadableStream}

Set the outbound datasource.

### `stream.stats`

<!-- YAML
Expand Down
8 changes: 8 additions & 0 deletions lib/internal/blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@ function createBlobReaderStream(reader) {
if (buffer !== undefined && buffer.byteLength !== 0) {
c.enqueue(new Uint8Array(buffer));
}
if (status === 3) {
// status wait!
// the source will call us (this function!) again !
// we should not schedule another readnext,
// as we end up in a busy loop, calling pull over and
// over and pilling up next callbacks in dataqueue
return;
}
// We keep reading until we either reach EOS, some error, or we
// hit the flow rate of the stream (c.desiredSize).
// We use set immediate here because we have to allow the event
Expand Down
48 changes: 44 additions & 4 deletions lib/internal/quic/quic.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ const {
CLOSECONTEXT_START_FAILURE: kCloseContextStartFailure,
} = internalBinding('quic');

const {
DataQueueFeeder,
} = internalBinding('dataqueuefeeder');

const {
isArrayBuffer,
isArrayBufferView,
Expand Down Expand Up @@ -114,6 +118,10 @@ const {
buildNgHeaderString,
} = require('internal/http2/util');

const {
isReadableStream,
} = require('internal/webstreams/readablestream');

const kEmptyObject = { __proto__: null };

const {
Expand Down Expand Up @@ -546,6 +554,37 @@ setCallbacks({
function validateBody(body) {
// TODO(@jasnell): Support streaming sources
if (body === undefined) return body;
if (isReadableStream(body)) {
const feeder = new DataQueueFeeder();
const reader = body.getReader();

const feeding = async () => {
await feeder.ready();
let cont = true;

while (cont) {
let read;
try {
read = await reader.read();
} catch (error) {
feeder.error(error);
}
const { value, done } = read;
try {
cont = await feeder.submit(value, done);
} catch (error) {
reader.cancel(error.toString());
break;
}
}
if (!cont) {
reader.releaseLock();
}

};
feeding();
return feeder;
}
// Transfer ArrayBuffers...
if (isArrayBuffer(body)) {
return ArrayBufferPrototypeTransfer(body);
Expand Down Expand Up @@ -578,6 +617,7 @@ function validateBody(body) {
'ArrayBuffer',
'ArrayBufferView',
'Blob',
'ReadableStream',
], body);
}

Expand Down Expand Up @@ -802,10 +842,10 @@ class QuicStream {
/**
* Sets the outbound data source for the stream. This can only be called
* once and must be called before any data will be sent. The body can be
* an ArrayBuffer, a TypedArray or DataView, or a Blob. If the stream
* is destroyed or already has an outbound data source, an error will
* be thrown.
* @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView|Blob} outbound
* an ArrayBuffer, a TypedArray or DataView, or a Blob, a ReadableStream.
* If the stream is destroyed or already has an outbound data source,
* an error will be thrown.
* @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView|Blob|ReadableStream} outbound
*/
setOutbound(outbound) {
QuicStream.#assertIsQuicStream(this);
Expand Down
Loading
Loading