Can't HTTP.get certain URLs due to infinite redirect / lack of cookie jar

1,430 views
Skip to first unread message

Dan Dascalescu

unread,
Apr 15, 2014, 3:55:36 AM4/15/14
to meteo...@googlegroups.com
I'm trying to HTTP.get this URL: http://rss.nytimes.com/c/34625/f/640316/s/395c8915/sc/1/l/0L0Snytimes0N0C20A140C0A40C150Cbusiness0C20Eexecutives0Eare0Eout0Eat0Egm0Eafter0Erecall0Bhtml0Dpartner0Frss0Gemc0Frss/story01.htm

Nothing special about the code:

if (Meteor.isServer) {
  Meteor.startup(function () {
    var url = 'http://rss.nytimes.com/c/34625/f/640316/s/395c8915/sc/1/l/0L0Snytimes0N0C20A140C0A40C150Cbusiness0C20Eexecutives0Eare0Eout0Eat0Egm0Eafter0Erecall0Bhtml0Dpartner0Frss0Gemc0Frss/story01.htm';
    var result = HTTP.call("GET", url, {
      followRedirects: true
    });
    console.log(result);
  });
}

What happens is that the code issues a warning,

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

then terminates with


But same request succeeds with wget, and the only difference seems to be that wget uses a cookie jar (it only follows three redirects, and maxRedirects is 10).

I've enabled NODE_DEBUG=request, and indeed, jar is set to false (see attached trace). The raw Node.js request succeeds too when jar is set to truerequest({uri: '...', jar: true}, callback);

Should the HTTP module set jar to true? Or enable passing it as a parameter? Or is there another Meteor way of enabling session cookies for HTTP requests?
trace.txt

David Glasser

unread,
Apr 28, 2014, 4:57:11 PM4/28/14
to meteo...@googlegroups.com

You can use the npm request or http module directly. It is not the goal of the Meteor http package to painstakingly reimplement every single HTTP client feature, but rather to provide a unified client/server API that covers the common cases easily.

--
You received this message because you are subscribed to the Google Groups "meteor-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meteor-core...@googlegroups.com.
To post to this group, send email to meteo...@googlegroups.com.
Visit this group at http://groups.google.com/group/meteor-core.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages