• In the docs I can see there is provision for HTTPS when using http.get, you just pass a https:// url and it works it out. But what about when using http.request?

      var options = {
        host: 'google.com',
        port: 80,
        path: '/',
        method: 'GET',
      };
    
      console.log('about to http request');
      http.request(options, function(res) {
        console.log('request cb');
        res.on('data', function(data) {
          console.log("HTTP> "+data);
        });
    
        res.on('close', function(data) {
          console.log(data);
          console.log("Connection closed");
        });
    
        res.on('error', function(err) {
          console.log(err);
        });
      }).end();
    

    Works fine, but if I change the port to 443 it just stalls. I assume because its trying to talk HTTP to a HTTPS port. I don't really want to use tls.connect because that gives me a socket rather than a https connection.

About

Avatar for dave_irvine @dave_irvine started