5 Replies Latest reply on Jun 7, 2015 9:09 PM by Ten A

    how to  access https site from javascript socket object

    venkat9986863336

      HI ,

       

      I'm new to SSL's and scripting.

       

      I have written code to access http site and it is working.Below is the code.The script is failing when i try to access https application.

       

      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+':80', 'BINARY');

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

              socket.write(request[i]);

          }