-
Notifications
You must be signed in to change notification settings - Fork 7.3k
regression: https.get(url, ...) returns partial content #25749
Comments
The way you concatenate and stringify the response chunks won't work if a chunk ends with a partial character. Try this instead, maybe that helps: var chunks = [];
res.on("data", function(chunk) {
chunks.push(chunk);
});
res.on("end", function() {
httpString = Buffer.concat(chunks).toString('utf-8');
onend();
}); ... and equivalently for Edit: Going |
Thanks for the tip ! But it is still failing. I updated the test: var http = require("http");
var https = require("https");
var httpString;
var httpsString;
var onend = function() {
if(httpString && httpsString) {
var assertion = httpsString == httpString;
console.log(assertion ? "test passed" : "test failed");
process.exit(assertion ? 0 : 1);
}
};
http.get("http://ccapi-preprod.cleverapps.io/v2/application.wadl", function(res) {
var chunks = [];
res.on("data", function(chunk) {
chunks.push(chunk);
});
res.on("end", function() {
httpString = Buffer.concat(chunks).toString("utf-8");
onend();
});
});
https.get("https://ccapi-preprod.cleverapps.io/v2/application.wadl", function(res) {
var chunks = [];
res.on("data", function(chunk) {
chunks.push(chunk);
});
res.on("end", function() {
httpsString = Buffer.concat(chunks).toString("utf-8");
onend();
});
}); |
After running a |
Some https requests returns truncated content, although everything works when requesting the same resource with http. This regression appears since 15a5a4a, and making the https globalAgent keep the connection alive fix it. Closes nodejs#25749
Some https requests returns truncated content, although everything works when requesting the same resource with http. This regression appears since 15a5a4a, and making the https globalAgent keep the connection alive fix it. Closes nodejs#25749
This is a workaround for nodejs/node-v0.x-archive#25749 If keepAlive is not explicitely enabled, some requests are truncated.
Any news on this issue? |
@divarvel ... it hasn't been forgotten. It's actually on my rather long "short list" of items to look at further, just haven't had the opportunity to dig in on it. |
Ok, thanks for the update
|
Enable keepAlive on https requests in nodeJS This is a workaround for nodejs/node-v0.x-archive#25749 If keepAlive is not explicitely enabled, some requests are truncated.
Hi,
It seems that the https module is broken for Node.js 0.12.7, it may also be the case for other 0.12.x versions of Node, but I haven't built them yet.
I am getting some content which is available via HTTP or HTTPS, and using the
http
and thehttps
modules does not give me the same result, while Firefox, wget and Node.js 0.10.39 do.Here is the piece of code reproducing the bug:
We expect the following output (and this is what we get with Node.js 0.10.39 and 0.10.40):
And this is what we actually get with Node.js 0.12.7:
Technical information:
OS: Linux mufasa 4.0.7-2-ARCH #1 SMP PREEMPT Tue Jun 30 07:50:21 UTC 2015 x86_64 GNU/Linux
Node.js: 0.12.7, installed with nvm (as for Node.js 0.10.39)
The text was updated successfully, but these errors were encountered: