@bytecodealliance/preview3-shim 0.2.0 → 0.2.1

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.
@@ -6,9 +6,14 @@ export const _forbiddenHeaders = {
6
6
  get value() {
7
7
  return (FORBIDDEN_HEADERS ??= new Set([
8
8
  "connection",
9
- "keep-alive",
9
+ "http2-settings",
10
10
  "host",
11
- "custom-forbidden-header",
11
+ "keep-alive",
12
+ "proxy-authenticate",
13
+ "proxy-authorization",
14
+ "proxy-connection",
15
+ "transfer-encoding",
16
+ "upgrade",
12
17
  ]));
13
18
  },
14
19
  };
@@ -21,8 +21,15 @@ async function handleRead({ fd, offset, stream }) {
21
21
  throw new TypeError("stream must have a getWriter() method");
22
22
  }
23
23
  const writer = stream.getWriter();
24
+ let pos = BigInt(offset);
25
+ try {
26
+ filePosition(pos);
27
+ }
28
+ catch (err) {
29
+ await writer.close();
30
+ throw err;
31
+ }
24
32
  try {
25
- let pos = BigInt(offset);
26
33
  const start = pos;
27
34
  while (true) {
28
35
  const { bytesRead } = await readAsync(fd, BUFFER, 0, CHUNK_BYTES, filePosition(pos));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/preview3-shim",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "WASI Preview3 shim for JS environments",
5
5
  "homepage": "https://github.com/bytecodealliance/jco/blob/main/packages/preview3-shim/#readme",
6
6
  "bugs": {