1 Reply Latest reply on May 28, 2015 11:54 AM by David_Powers

    Needed help in understanding how to access https site using socket

    venkat9986863336 Level 1

      HI .

       

      I have written code to access http server from socket object.When i try accessing https URL it is breaking.Can some one please help me.

       

      Below is the code.

       

      var request = [];

          request.push('POST', ' ', path, ' ', "HTTP/1.1\n");       

          request.push('Authorization:', 'Basic d2NhZG1pbjp3Y2FkbWlu==', '\n');

          request.push('Host: ', host, "\r\n");

          request.push('User-Agent: ', USER_AGENT, "");

          //request.push('Connection: ', 'close', "\n");

          request.push('Pragma: ', "no-cache", "\r\n");

          request.push('Accept: ', "*/*", "\r\n");

          request.push('Accept-Charset: ', "UTF-8", "\r\n");

          request.push('Accept-Language: ', "en-US", "\r\n");

          request.push('Content-Language: ', "en-US", "\r\n");

          request.push('content-location: ', file.name, "\r\n");

          //request.push('Content-Length: ', fileContents.length, "\r\n");

          request.push('Content-Length: ', content.length, "\r\n");

          request.push('Content-Type: ', 'multipart/form-data;boundary=', boundary, "\r\n");

          

          request.push('\n');

          request.push(content);       

            alert('request--->'+request); 

          //  5. Upload

          var socket = new Socket;   

          socket.open(host+':60444', 'BINARY');

          for (var i = 0; i < request.length; ++ i) {

              socket.write(request[i]);

          }