node-js-libs / curlrequest

A cURL wrapper
MIT License
184 stars 44 forks source link

Timeout error returns undefined #24

Open pnispel opened 9 years ago

pnispel commented 9 years ago

I'm trying to connect to a webdav server that requires user credentials. When I pass an empty string as the user and the connection times out, the values passed to the callback are undefined and null. Also, when I don't pass the user credentials at all (on the same server that requires login) the second argument (return value) passed to the callback is empty.

I'm not sure if there is a part of the webdav protocol that handles user auth, but it would be nice to have errors for both of these situations.

Here are the 'arguments' to the callback function when the user is passed as an empty string:

{ '0': undefined,
  '1': null,
  '2': 
   { cmd: 'curl',
     args: 
      [ '--silent',
        '--show-error',
        '--no-buffer',
        '--url',
        '***REMOVED***',
        '--user',
        '',
        '--verbose',
        '--max-time',
        10,
        '--request',
        'GET',
        '--location',
        '--max-redirs',
        3,
        '--header',
        'Accept: */*',
        '--header',
        'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3',
        '--header',
        'Accept-Language: en-US,en;q=0.8',
        '--user-agent',
        'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)' ],
     time: 10006 } }