D
D
dailysse2016-10-14 21:52:16
Node.js
dailysse, 2016-10-14 21:52:16

Strange characters in http response?

The meaning is this. I make a request to the site in this way.

var net = require('net');
 
var srv = net.createConnection(80, 'kartinki24.ru');
 
var buffers = [];
 
srv.on('data', function (data) {
    buffers.push(data);
});
 
srv.on('end', function () {
    var buf = Buffer.concat(buffers);
    console.log(buf.toString());
});
 
srv.write('GET / HTTP/1.1\r\nHost: www.kartinki24.ru\r\nConnection: close\r\n\r\n');


The meaning is that if you scroll to the headers, then after them the !DOCTYPE does not immediately go, but there are some 1cfd characters. (in the attachment). The problem is that these keys are scattered throughout the http request and sometimes it is impossible to correctly assemble it as a whole. Who is familiar with this?

924830a781d34ebfb7518418672cb5a3.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2016-10-14
@dailysse

read about Transfer-Encoding: chunked, you see it in the response headers

D
dailysse, 2016-10-14
@dailysse

And it's on almost all sites.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question