Monday 5 June 2017

NodeJS: request (post) to a .dll

I am trying to POST to a URL that is a .dll (e.g.: https://thiswebsite.com/file.dll)

My request:

var url = 'https://thiswebsite.com/file.dll'
var myForm = { ... }
var myHeaders = { ... }

request({
  method: 'POST',
  url,
  formData : myForm,
  headers: myHeaders
},
function (error, response, body) {
  if (response) {
    console.log(response);
    console.log(body);
  }
  else {
    console.log('CONNECTION REFUSED');
    console.log(error);
  }
}
)

And I am getting:

{ Error: socket hang up
    at createHangUpError (_http_client.js:252:15)
    at TLSSocket.socketOnEnd (_http_client.js:344:23)
    at emitNone (events.js:91:20)
    at TLSSocket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ECONNRESET' }

I've heard that URLs that contains .dll in the path are not "POSTable", since they do not behave as regular URLs. However, when I try to do the same request with the same headers and formData through DHC, I get a valid response -- so I guess the problem is not with my headers or formData, but with the way I proceed with my request via Node.js.

Any idea of how I should proceed to get a valid response? Any help will be much appreciated.



via Vinicius Martinson

No comments:

Post a Comment