@astrale-os/kernel-client 0.6.0-beta.78 → 0.6.0-beta.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -64,7 +64,7 @@ export class HttpByteStream {
|
|
|
64
64
|
}
|
|
65
65
|
this.bytes += next.value.byteLength;
|
|
66
66
|
if (this.expectedBytes !== undefined && this.bytes > this.expectedBytes) {
|
|
67
|
-
throw new ProtocolError(`streaming binary exceeded declared
|
|
67
|
+
throw new ProtocolError(`streaming binary exceeded its declared length (${this.expectedBytes}).`);
|
|
68
68
|
}
|
|
69
69
|
if (this.bytes > this.maximumBytes) {
|
|
70
70
|
throw new ProtocolError(`streaming binary exceeds maximumResponseBytes (${this.maximumBytes}).`);
|
|
@@ -197,11 +197,14 @@ export class HttpTransport {
|
|
|
197
197
|
if (streaming) {
|
|
198
198
|
if (response.body === null)
|
|
199
199
|
throw new ProtocolError('streaming binary has no body.');
|
|
200
|
-
|
|
200
|
+
// An intermediary may rewrite Content-Length (for example when it compresses the body), so the
|
|
201
|
+
// protocol length wins; Content-Length only counts for a Server that predates the field.
|
|
202
|
+
const declared = response.headers.get(protocol.http.BINARY_LENGTH_FIELD);
|
|
203
|
+
const length = declared ?? response.headers.get('content-length');
|
|
201
204
|
const expectedBytes = length === null ? undefined : Number(length);
|
|
202
205
|
if (length !== null &&
|
|
203
206
|
(!/^(?:0|[1-9][0-9]*)$/u.test(length) || !Number.isSafeInteger(expectedBytes))) {
|
|
204
|
-
throw new ProtocolError(
|
|
207
|
+
throw new ProtocolError(`streaming binary has an invalid ${declared === null ? 'Content-Length' : protocol.http.BINARY_LENGTH_FIELD}.`);
|
|
205
208
|
}
|
|
206
209
|
if (expectedBytes !== undefined && expectedBytes > this.maximumResponseBytes) {
|
|
207
210
|
throw new ProtocolError(`streaming binary exceeds maximumResponseBytes (${this.maximumResponseBytes}).`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-client",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.79",
|
|
4
4
|
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@astrale-os/kernel-core": "0.9.0-beta.
|
|
69
|
-
"@astrale-os/kernel-dsl": "0.2.0-beta.
|
|
70
|
-
"@astrale-os/kernel-protocol": "0.5.0-beta.
|
|
68
|
+
"@astrale-os/kernel-core": "0.9.0-beta.59",
|
|
69
|
+
"@astrale-os/kernel-dsl": "0.2.0-beta.43",
|
|
70
|
+
"@astrale-os/kernel-protocol": "0.5.0-beta.65",
|
|
71
71
|
"@tanstack/pacer": "0.20.1",
|
|
72
72
|
"msgpackr": "^2.0.5"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@astrale-os/kernel-server": "0.5.0-beta.
|
|
75
|
+
"@astrale-os/kernel-server": "0.5.0-beta.67",
|
|
76
76
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
77
77
|
"@types/node": "^22.0.0",
|
|
78
78
|
"typescript": "7.0.2",
|