Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DoH (wireformat) throws exception when decoding HTTP request body #85

Open
I-Knight-I opened this issue May 13, 2024 · 0 comments
Open

Comments

@I-Knight-I
Copy link

I-Knight-I commented May 13, 2024

The following readStream function is the culprit:
https://github.com/song940/node-dns/blob/b2fdf66a1987e2597ad1b1f0948d0ac5c4acbfe2/server/doh.js#L22-L28

It's initialising the buffer as a string and not converting it for the resolve() call.
It should be:

const readStream = stream => new Promise((resolve, reject) => {
  let buffer = '';
  stream
    .on('error', reject)
    .on('data', chunk => { buffer += chunk; })
    .on('end', () => resolve(Buffer.from(buffer)));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant