Issue 1:
Possible Bug Report

Using:

deno 1.7.5 (release, x86_64-pc-windows-msvc)

v8 9.0.123

typescript 4.1.4

Editor: VS Code 1.53.2, with intellisense plus Deno extension

Standard Lib used:

"https://deno.land/std@0.88.0/http/server.ts"

Class:

import {serve} from "https://deno.land/std@0.88.0/http/server.ts"

Implementation:

Async HTTP server through 'serve'

Same problem probably with 'serveTLS' but I did not test that one yet.

Problem Description

All 'object' types {} inside ServerRequest and Server (and possibly others) are wrongly formatted.

Hence JS doesn't recognize them and/or can't access them. For instance the HTTP headers variables such as 'host' or 'accept' cannot be reached (as an example). The error is consistent to ALL {} types.

See conn: r: headers: w: w.writer: etc.

Furthermore I think the ARRAY types [] have the same problem, but I didn't test yet. See w.buf

REMARK: I do .js, could this have to do with .ts ? It kind of looks like the JSON format for {} and [] has been extended with a datatype.

e.g.: headers: Headers {...}

e.g.: w.buf: Uint8Array(4096) [...]

CODE to reproduce the possible bug:

In index.js file:

import {serve} from "https://deno.land/std@0.88.0/http/server.ts"

import {dispatchRequest} from "./serving.js"

// Setup Asyn server and make it listen/wait for incoming connections and serve them

const server = serve({ "hostname": "127.0.0.1", "port": 8080 });

console.log("Server listening on port 8080");

for await (const req of server) { req.respond(await dispatchRequest(req)); }

In serving.js file:

export async function dispatchRequest(req) {

console.log(req);

... sever respond code suppressed (not needed to demonstrate problem)

}

Test run

Tested with URL : https://127.0.0.1:8080/test?abc=300

Tested with Firefox and Chrome (both up to date)

OUTPUT

Bot test runs have identical OUTPUT in VS Code console as shown below:

This is the output from the console.log() line in the serving.js file

ServerRequest {

conn: Conn {},

r: BufReader {

r: 367,

w: 367,

eof: false,

buf: Uint8Array(4096) [

71, 69, 84, 32, 47, 116, 101, 115, 116, 63, 97, 98, 99, 61, 51,

48, 48, 32, 72, 84, 84, 80, 47, 49, 46, 49, 13, 10, 72, 111,

115, 116, 58, 32, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, 56,

48, 56, 48, 13, 10, 85, 115, 101, 114, 45, 65, 103, 101, 110, 116,

58, 32, 77, 111, 122, 105, 108, 108, 97, 47, 53, 46, 48, 32, 40,

87, 105, 110, 100, 111, 119, 115, 32, 78, 84, 32, 49, 48, 46, 48,

59, 32, 87, 105, 110, 54, 52, 59, 32, 120,

... 3996 more items

],

rd: Conn {}

},

method: "GET",

url: "/test?abc=300",

proto: "HTTP/1.1",

protoMajor: 1,

protoMinor: 1,

headers: Headers { host: 127.0.0.1:8080, user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0, accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8, accept-language: en-US,en;q=0.5, accept-encoding: gzip, deflate, dnt: 1, connection: keep-alive, upgrade-insecure-requests: 1, sec-gpc: 1 },

w: BufWriter {

usedBufferBytes: 0,

err: null,

writer: Conn {},

buf: Uint8Array(4096) [

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

... 3996 more items

]

}

}

Problem Examples

Example 1 (code added in serving.js):

console.log(req.headers.toString());

console.log(req.url.toString());

var myJSON = JSON.stringify(req.headers);

console.log(myJSON);

OUTPUT:

[object Headers] <-- should be headers and not Headers, IMHO

/test?abc=300 <-- CORRECT, not an object {} type

{} <-- Should show content host: 127.0.0.1:8080 ... ect between the {}

Example 2 (code added in serving.js):

console.log(server.listener);

console.log(server.listener.toString());

var myJSON = JSON.stringify(server.listener);

console.log(myJSON);

OUTPUT:

Listener {}

[object Object]

{} <-- by coincidence correct because listener: is indeed an empty object {}.

Possible/Probable cause

I think this is a format problem, illustrated below for headers but actually it occurs for all OBJECT and possible all ARRAY types.

The first general log above shows:

headers: Headers { ... }

The 'Headers ' with uppercase and space shouldn't be there IMO.

Prove: I cut&paste the log string from the first log above, removed the word and a space 'Headers '.

The JSON.stringify() then works fine.

This problem occurs on ALL objects {} definitions inside ServerRequest and Sever and possibly in plenty of others that I didn't check as the error is so consistent that it might be generated by some routine.

Possibly the same for arrays [] types (or all non simple types in general).

If this is the case it could be the cause of many errors all over Deno, certainly in dependencies such as serveTLS.

Issue 2:
Possible Bug Report

ATTENTION: I posted this ALSO on the main Deno thread because I think the underlying problem might not be at the std library level but deeper. Anyways, just in case it would be std related I post it here again.

Using:

deno 1.7.5 (release, x86_64-pc-windows-msvc)

v8 9.0.123

typescript 4.1.4

Editor: VS Code 1.53.2, with intellisense plus Deno extension

Standard Lib used:

"https://deno.land/std@0.88.0/http/server.ts"

Class:

import {serve} from "https://deno.land/std@0.88.0/http/server.ts"

Implementation:

Async HTTP server through 'serve'

Same problem probably with 'serveTLS' but I did not test that one yet.

Problem Description

All 'object' types {} inside ServerRequest and Server (and possibly others) are wrongly formatted.

Hence JS doesn't recognize them and/or can't access them. For instance the HTTP headers variables such as 'host' or 'accept' cannot be reached (as an example). The error is consistent to ALL {} types.

See conn: r: headers: w: w.writer: etc.

Furthermore I think the ARRAY types [] have the same problem, but I didn't test yet. See w.buf

REMARK: I do .js, could this have to do with .ts ? It kind of looks like the JSON format for {} and [] has been extended with a datatype.

e.g.: headers: Headers {...}

e.g.: w.buf: Uint8Array(4096) [...]

CODE to reproduce the possible bug:

In index.js file:

import {serve} from "https://deno.land/std@0.88.0/http/server.ts"

import {dispatchRequest} from "./serving.js"

// Setup Asyn server and make it listen/wait for incoming connections and serve them

const server = serve({ "hostname": "127.0.0.1", "port": 8080 });

console.log("Server listening on port 8080");

for await (const req of server) { req.respond(await dispatchRequest(req)); }

In serving.js file:

export async function dispatchRequest(req) {

console.log(req);

... sever respond code suppressed (not needed to demonstrate problem)

}

Test run

Tested with URL : https://127.0.0.1:8080/test?abc=300

Tested with Firefox and Chrome (both up to date)

OUTPUT

Bot test runs have identical OUTPUT in VS Code console as shown below:

This is the output from the console.log() line in the serving.js file

ServerRequest {

conn: Conn {},

r: BufReader {

r: 367,

w: 367,

eof: false,

buf: Uint8Array(4096) [

71, 69, 84, 32, 47, 116, 101, 115, 116, 63, 97, 98, 99, 61, 51,

48, 48, 32, 72, 84, 84, 80, 47, 49, 46, 49, 13, 10, 72, 111,

115, 116, 58, 32, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, 56,

48, 56, 48, 13, 10, 85, 115, 101, 114, 45, 65, 103, 101, 110, 116,

58, 32, 77, 111, 122, 105, 108, 108, 97, 47, 53, 46, 48, 32, 40,

87, 105, 110, 100, 111, 119, 115, 32, 78, 84, 32, 49, 48, 46, 48,

59, 32, 87, 105, 110, 54, 52, 59, 32, 120,

... 3996 more items

],

rd: Conn {}

},

method: "GET",

url: "/test?abc=300",

proto: "HTTP/1.1",

protoMajor: 1,

protoMinor: 1,

headers: Headers { host: 127.0.0.1:8080, user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0, accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8, accept-language: en-US,en;q=0.5, accept-encoding: gzip, deflate, dnt: 1, connection: keep-alive, upgrade-insecure-requests: 1, sec-gpc: 1 },

w: BufWriter {

usedBufferBytes: 0,

err: null,

writer: Conn {},

buf: Uint8Array(4096) [

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

... 3996 more items

]

}

}

Problem Examples

Example 1 (code added in serving.js):

console.log(req.headers.toString());

console.log(req.url.toString());

var myJSON = JSON.stringify(req.headers);

console.log(myJSON);

OUTPUT:

[object Headers] <-- should be headers and not Headers, IMHO

/test?abc=300 <-- CORRECT, not an object {} type

{} <-- Should show content host: 127.0.0.1:8080 ... ect between the {}

Example 2 (code added in serving.js):

console.log(server.listener);

console.log(server.listener.toString());

var myJSON = JSON.stringify(server.listener);

console.log(myJSON);

OUTPUT:

Listener {}

[object Object]

{} <-- by coincidence correct because listener: is indeed an empty object {}.

Possible/Probable cause

I think this is a format problem, illustrated below for headers but actually it occurs for all OBJECT and possible all ARRAY types.

The first general log above shows:

headers: Headers { ... }

The 'Headers ' with uppercase and space shouldn't be there IMO.

Prove: I cut&paste the log string from the first log above, removed the word and a space 'Headers '.

The JSON.stringify() then works fine.

This problem occurs on ALL objects {} definitions inside ServerRequest and Sever and possibly in plenty of others that I didn't check as the error is so consistent that it might be generated by some routine.

Possibly the same for arrays [] types (or all non simple types in general).

If this is the case it could be the cause of many errors all over Deno, certainly in dependencies such as serveTLS.