Closed haogang closed 6 years ago
Thanks for the PR. I had the solution already done at that point and was working on the tests. The 1.1.0 package is now published. See here for how this works. One caveat is that the 'message' handler of the underlying 'ws' library buffers up all frames to fin, so large transfers are an issue here. Fixing that will require dropping down one level to explicit frame handling. I'll do that eventually and will remind myself with an issue.
@clemensv Thanks for the fix! Will you please also fix the bug where we don't pass server
argument to requestChannelRequest
(see https://github.com/Azure/azure-relay-node/blob/master/hyco-https/lib/HybridConnectionHttpsServer.js#L637). The bug will trigger when the client sends a >64KB request.
Simple test case:
const https = require('hyco-https');
const ns = "...";
const path = "...";
const keyrule = "...";
const key = "...";
const token = https.createRelayToken(https.createRelayHttpsUri(ns, path), keyrule, key)
const req = https.request({
hostname : ns,
path : (!path || path.length == 0 || path[0] !== '/'?'/':'') + path,
method : 'POST',
port : 443,
headers : {
'ServiceBusAuthorization' : token,
}
}, (res) => {
let error;
if (res.statusCode !== 200) {
console.error('Request Failed.\n Status Code:', res.statusCode, res.statusMessage);
res.resume();
}
else {
res.setEncoding('utf8');
res.on('data', (chunk) => {
console.log(`BODY: ${chunk}`);
});
};
})
// Sending a > 64KB payload to force rendezvous connection
req.end('v=' + 'x'.repeat(65 * 1024));
Description
This patch fix a few issues:
COUNTER_HTTP_SERVER_RESPONSE
, which is undefined in newer version of nodejsserver
argument torequestChannelRequest
stream
interface inheritance does not seem to work as expected.This checklist is used to make sure that common guidelines for a pull request are followed.