Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

https.get hangs with mtgox.com #1302

Closed
nponeccop opened this issue Jul 10, 2011 · 3 comments
Closed

https.get hangs with mtgox.com #1302

nponeccop opened this issue Jul 10, 2011 · 3 comments
Labels

Comments

@nponeccop
Copy link

The code below works with google.com and many other servers, but fails with mtgox in 0.4.9. Chrome. Firefox and wget work. The host seem to use a rare RC4/MD5 algorithms so this may be a problem. Even if mtgox does something wrong, the code should emit error and not hang.

var https = require('https');

https.get({ host: 'mtgox.com', path: '/' }, function(res) {
  console.log('get ok')
  res.on('data', function(d) {
    console.log('chunk');
  });

  res.on('end', function() {
    console.log('end');
  });
}).on('error', function(e) {
  console.error(e);
});
@bnoordhuis
Copy link
Member

Confirmed with current master.

$ NODE_DEBUG="net http" ./node_g tmp/issue1302.js
HTTP: Agent _cycle sockets=0 queue=1
HTTP: Agent _cycle sockets=1 queue=1
HTTP: Agent found socket, shift
HTTP: Agent _cycle sockets=1 queue=0
HTTP: outgoing message end.
NET: connecting to 72.52.5.67 : 443
NET: wrote 121 bytes to socket.
NET: [fd, off, len] = [6,0,121]
NET: socket 6 received 5420 bytes
NET: wrote 310 bytes to socket.
NET: [fd, off, len] = [6,0,310]
NET: socket 6 received 43 bytes
HTTP: Agent _getConnection callback
HTTP: Agent _cycle sockets=1 queue=0
NET: wrote 75 bytes to socket.
NET: [fd, off, len] = [6,0,75]

The client receives 5463 of 6144 bytes and then stalls.

@peroksid
Copy link

Simply add user agent header.

@bnoordhuis
Copy link
Member

Right, that works. Here's an updated example:

var headers = {'User-Agent':'Mozilla/3.0 WebTV/1.2 (compatible; MSIE 2.0)'}; // <3

require('https').get({host:'mtgox.com', headers:headers}, function(res) {
  res.setEncoding('utf8');
  res.on('data', console.error);
});

No sense in accommodating every half-assed HTTP server implementation out there. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants