0

For some reason this request GET never returns, but only in Node.js. I've tried in browser, curl, httparty, ruby's Net::Http, postman, clojure and they all work fine. Node.js will not.

This will return as you'd expect

echo "require('https').get('https://github.com/jakecraige.json', function(res) { console.log(res); });" | node

This never will return, it eventually throws an ECONNRESET

echo "require('https').get('https://gateway.rpx.realpage.com/rpxgateway/PricingAndAvailability.svc?wsdl', function(res) { console.log(res); });" | node

If anyone could provide some insight into this that would be extremely helpful.

Thanks!

jakecraige
  • 2,707
  • 4
  • 21
  • 25

4 Answers4

1

Zyrri in IRC directed me to here which solved the problem.

SSL Error in nodejs

Looks like it wants SSLv3_method from node.js

Community
  • 1
  • 1
jakecraige
  • 2,707
  • 4
  • 21
  • 25
0
$ curl 'https://gateway.rpx.realpage.com/rpxgateway/PricingAndAvailability.svc' -I
HTTP/1.1 400 Bad Request

Try providing an error handler and see what you get.

chovy
  • 72,281
  • 52
  • 227
  • 295
  • Looks like I needed to tack on the ?wsdl to the end of the url to get a valid request. Though the solution was different – jakecraige Aug 28 '14 at 04:33
0

Your code hangs for me whichever URL I pick. I believe that's node trying to make sure we don't exit prematurely, running its event loop just in case. All other techniques you listed are synchronous, not event-driven. Also, res is probably not what you want to print, since it's the node's internal response object. Try this:

cat <<EOF | node
require("https").get("https://github.com/jakecraige.json",
  function(res) {
    var body = ''
    res.
      on('data', function(data) { body += data}).
      on('end', function() { console.log(body); process.exit(0); });
  }
);
EOF
Amadan
  • 191,408
  • 23
  • 240
  • 301
0

Combining @Constarr links with this original post I have this constructed request getting a valid response.

var https = require('https');
https.globalAgent.options.secureProtocol = 'SSLv3_method';

https.get("https://gateway.rpx.realpage.com/rpxgateway/PricingAndAvailability.svc?wsdl", function(res) {
  console.log("Got response: " + res.statusCode);
}).on('error', function(e) {
  console.log("Got error: " + e.message);
});            

Docs here

Jay
  • 496
  • 1
  • 4
  • 11