Repository navigation
Conversation
|
@jasnell updated with |
|
+1... I started digging in yesterday then completely ran out of time to finish. Hoping to return to it this afternoon. |
|
Ok, looks like there's a conflict with the change in node_http2.cc that needs to be looked at following @addaleax's refactor that landed yesterday. I'll look at resolving that in just a bit |
|
@jasnell this is not working ATM. You can check out the branch as it is and let me know what the problem is. This is my current client, and it's not working :(: 'use strict'
const net = require('net');
const h2 = require('http2');
const socket = net.connect(8000, 'localhost');
const client = h2.createClientSession(socket);
const req = client.request();
socket.on('connect', function () {
console.log('socket connected');
});
req.on('response', function (headers) {
console.log('response!', headers)
})
let data = '';
req.setEncoding('utf8');
req.on('data', console.log); |
|
Yeah, I've applied the patch locally and will be going through it in detail again here shortly. Hoping to have it working by the time we meet up in Seattle |
|
Here's the "working" client 'use strict'
const common = require('../common');
const assert = require('assert');
const h2 = require('http2');
const net = require('net');
const body =
'<html><head></head><body><h1>this is some data</h2></body></html>';
const server = h2.createServer();
server.on('stream', common.mustCall(onStream));
function onStream (stream) {
stream.respond({
'content-type': 'text/html',
':status': 200
})
stream.end(body);
}
server.listen(0);
server.on('listening', common.mustCall(function() {
const socket = net.connect(this.address());
const client = h2.createClientSession(socket);
setImmediate(() => {
const headers = {
':method': 'GET',
':scheme': 'http',
':authority': `localhost:${this.address().port}`,
':path': '/'
};
const req = client.request(headers);
req.on('response', common.mustCall(function (headers) {
console.log('response!', headers)
}))
let data = '';
req.setEncoding('utf8');
req.on('data', d => data += d);
req.on('end', common.mustCall(function () {
assert.strictEqual(body, data);
}));
req.end();
});
}));Also, in core.js, setImmediate(() => session.submitSettings(settings)); |
992750c to
8ece24e
Compare
|
that's progress! I'll work on it later on. |
|
@jasnell this is ready to go. The test is green with a bunch of TODO! |
|
Landed! |
@jasnell this is not working, I suspect it is not sending anything on the wire in fact.