blob: 2a6bf482077166b8d5a215049b208f7bfcc2c91c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
const net = require('net');
const server = http.createServer(common.mustCall(function(req, res) {
assert.equal('GET', req.method);
assert.equal('/blah', req.url);
assert.deepStrictEqual({
host: 'mapdevel.trolologames.ru:443',
origin: 'http://mapdevel.trolologames.ru',
cookie: ''
}, req.headers);
}));
server.listen(0, function() {
const c = net.createConnection(this.address().port);
c.on('connect', function() {
c.write('GET /blah HTTP/1.1\r\n' +
'Host: mapdevel.trolologames.ru:443\r\n' +
'Cookie:\r\n' +
'Origin: http://mapdevel.trolologames.ru\r\n' +
'\r\n\r\nhello world'
);
});
c.on('end', function() {
c.end();
});
c.on('close', function() {
server.close();
});
});
|