11cb0ef41Sopenharmony_ci// Flags: --insecure-http-parser 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci'use strict'; 41cb0ef41Sopenharmony_ciconst common = require('../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst http = require('http'); 71cb0ef41Sopenharmony_ciconst net = require('net'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst server = http.createServer(function(req, res) { 101cb0ef41Sopenharmony_ci assert.strictEqual(req.headers['content-type'], 'text/te\bt'); 111cb0ef41Sopenharmony_ci req.pipe(res); 121cb0ef41Sopenharmony_ci}); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciserver.listen(0, common.mustCall(function() { 151cb0ef41Sopenharmony_ci const bufs = []; 161cb0ef41Sopenharmony_ci const client = net.connect( 171cb0ef41Sopenharmony_ci this.address().port, 181cb0ef41Sopenharmony_ci function() { 191cb0ef41Sopenharmony_ci client.write( 201cb0ef41Sopenharmony_ci 'GET / HTTP/1.1\r\n' + 211cb0ef41Sopenharmony_ci 'Content-Type: text/te\x08t\r\n' + 221cb0ef41Sopenharmony_ci 'Connection: close\r\n\r\n'); 231cb0ef41Sopenharmony_ci } 241cb0ef41Sopenharmony_ci ); 251cb0ef41Sopenharmony_ci client.on('data', function(chunk) { 261cb0ef41Sopenharmony_ci bufs.push(chunk); 271cb0ef41Sopenharmony_ci }); 281cb0ef41Sopenharmony_ci client.on('end', common.mustCall(function() { 291cb0ef41Sopenharmony_ci const head = Buffer.concat(bufs) 301cb0ef41Sopenharmony_ci .toString('latin1') 311cb0ef41Sopenharmony_ci .split('\r\n')[0]; 321cb0ef41Sopenharmony_ci assert.strictEqual(head, 'HTTP/1.1 200 OK'); 331cb0ef41Sopenharmony_ci server.close(); 341cb0ef41Sopenharmony_ci })); 351cb0ef41Sopenharmony_ci})); 36