Skip to content

Commit e1fefe2

Browse files
committed
Change http2 stream id convention to match spec
1 parent 000ee11 commit e1fefe2

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

main/lib/http2/parserbase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class ParserBase {
115115
* @param {{sendOrder: bigint,sendGroupId: bigint}} priority
116116
*/
117117
newStream(streamid, priority) {
118-
const incoming = this.isclient ? !(streamid & 0x1n) : !!(streamid & 0x1n)
118+
const incoming = this.isclient ? !!(streamid & 0x1n) : !(streamid & 0x1n)
119119
const streamIdManager =
120120
streamid & 0x2n
121121
? this.session.streamIdMngrUni

main/lib/http2/streamidmanager.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ export class StreamIdManager {
190190
onStreamClosed(streamId) {
191191
// Nothing to do for outgoing streams.
192192
if (
193-
(this.isclient && streamId & 0x1n) ||
194-
(!this.isclient && !(streamId & 0x1n))
193+
(this.isclient && !(streamId & 0x1n)) ||
194+
(!this.isclient && streamId & 0x1n)
195195
)
196196
return
197197

@@ -283,7 +283,7 @@ export class StreamIdManager {
283283
* @param {number} id
284284
*/
285285
isAvailableStream(id) {
286-
if ((this.isclient && id & 0x1) || (!this.isclient && !(id & 0x1))) {
286+
if ((this.isclient && !(id & 0x1)) || (!this.isclient && id & 0x1)) {
287287
// Stream IDs under next_ougoing_stream_id_ are either open or previously
288288
// open but now closed.
289289
return id >= this.nextOutgoingStreamId
@@ -298,14 +298,14 @@ export class StreamIdManager {
298298

299299
getFirstOutgoingStreamId() {
300300
let streamid = 0n
301-
if (this.isclient) streamid |= 0x1n
301+
if (!this.isclient) streamid |= 0x1n
302302
if (this.unidirectional) streamid |= 0x2n
303303
return streamid
304304
}
305305

306306
getFirstIncomingStreamId() {
307307
let streamid = 0n
308-
if (!this.isclient) streamid |= 0x1n
308+
if (this.isclient) streamid |= 0x1n
309309
if (this.unidirectional) streamid |= 0x2n
310310
return streamid
311311
}

main/readme.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ A web-based lecture system developed out of university lectures.
1717
While FAILS as a whole is licensed via GNU Affero GPL version 3.0, this package is licensed under a BSD-style license that can be found in the LICENSE file, while code taken from other projects is still under their respective license (see LICENSE file for details).
1818
This package is licensed more permissive since it can be useful outside of the FAILS environment.
1919

20-
This module started as a C++ node binding to libquiche [https://github.com/google/quiche](https://github.com/google/quiche) (note there is a second library with a similar purpose and the same name), which provides besides other network protocols HTTP/3 support. Now it can also handle Webtransport over HTTP/2 and a WebSocket mapping of the HTTP/2 protocol together with a polyfill and ponyfill for the browsers without reliable WebTransport support or no WebTRansport support at all.
20+
This module started as a C++ node binding to libquiche [https://github.com/google/quiche](https://github.com/google/quiche) (note there is a second library with a similar purpose and the same name), which provides besides other network protocols HTTP/3 support. Now it can also handle Webtransport over HTTP/2 and a WebSocket mapping of the HTTP/2 protocol together with a polyfill and ponyfill for the browsers without reliable WebTransport support or no WebTransport support at all.
2121
This package currently provides support for WebTransport with an interface similar to the browser side (but not all features implemented), for the server as well as for the client, see `old_test/test.js`, `old_test/testsuite.js`, `old_test/echoclient.js`, `old_test/echoserver.js` for examples.
2222
Note, that the client implementation only supports certificate checking via `certificateHashes`, however experimental support for rootCA-based checking is introduced with version 1.0.0.
2323
It may be possible in the future to also support normal HTTP/3 with not so much effort, however, there is no intention from the author to implement this since it will not be needed by FAILS. However, PR requests are welcome and will be supported by advice from the author.
2424
The package for the HTTP/3 should be considered as a duct tape-style solution until a bulletproof native support of HTTP/3 and WebTransport is provided by node itself.
2525

26+
## Changes for Version 2.x.x
27+
28+
The interface did not change it all.
29+
However input from a Firefox developer uncovered a non standard complaint implementation of the http/2 protocols, that includes the Webtransport over WebSocket polyfill.
30+
Therefore, the protocol of the non http/3 flavors is not compatible to the 1.x.x versions.
31+
2632
## Changes for Version 1.x.x
2733

2834
The interface for version 1.x.x is not changed compared to 0.x.x.

0 commit comments

Comments
 (0)