-
-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fails if you close the socket after writes? #240
Comments
i'll see if i can reproduce with less library in the way |
ah looks like us disabling agent is what did the trick: http.createServer(function(req, res){
res.setHeader('Content-Type', 'multipart/form-data; boundary=awesome');
res.write('\r\n');
res.write('--awesome\r\n');
res.write('Content-Disposition: attachment; name="image"; filename="something.png"\r\n');
res.write('Content-Type: image/png\r\n');
res.write('\r\n');
res.write('some data');
res.write('\r\n--awesome\r\n');
res.write('Content-Disposition: form-data; name="name"\r\n');
res.write('Content-Type: text/plain\r\n');
res.write('\r\n');
res.write('tobi');
res.write('\r\n--awesome--');
res.end();
}).listen(4000);
var url = require('url');
var opts = url.parse('http://localhost:4000');
opts.agent = false;
http
.get(opts)
.on('response', function(res){
var form = new formidable.IncomingForm;
form.parse(res, function(err, fields, files){
if (err) throw err;
console.log(fields);
console.log(files);
});
}) |
Reducing this even more: got 'abort' (and later, 'end') from ClientResponse. var http = require('http');
var server = http.createServer(function test1(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('aaa');
res.end('bbb');
});
server.listen(4000);
http.get({port: 4000, agent: false}).on('response', function (res) {
res.on('data', function () {
res.pause();
setTimeout(function () { res.resume(); }, 100);
});
res.on('aborted', function () {
console.log('abort');
});
res.on('end', function () {
console.log('end');
server.close();
});
}); |
Sorry for being late to the party. Is the consensus that this is probably a formidable bug, rather than something in node's beautiful http client? : ) |
I don't think there is a formidable bug here, but weird http client response behavior. We could probably implement a workaround in formidable though. |
seems like a node thing, I haven't had more time to look into it yet but I'll close for now to reduce noise until I can confirm! |
@visionmedia ok - keep me posted. I'm happy to help if it's in formidable! |
This almost seems like it might be a node buffering bug or something, but here's the test failing in 0.8.x and 0.11.x. If you remove
res.end()
it works fine, otherwise you get "Request aborted", but this used to pass just fineThe text was updated successfully, but these errors were encountered: