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

HTTPS fails with 'socket hang up' #939

Closed
lexer opened this issue Apr 15, 2011 · 6 comments
Closed

HTTPS fails with 'socket hang up' #939

lexer opened this issue Apr 15, 2011 · 6 comments
Labels

Comments

@lexer
Copy link

lexer commented Apr 15, 2011

I'm developing nodejs oauth2 npm module: https://github.com/lexer/node-oauth2

When Im trying to make https request to google or facebook i get:

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: socket hang up
    at Socket.<anonymous> (http.js:1272:45)
    at Socket.emit (events.js:64:17)
    at Array.<anonymous> (net.js:825:12)
    at EventEmitter._tickCallback (node.js:126:26)

You can reproduce bug in express sample application that i've made:

https://github.com/lexer/node-oauth2/tree/master/examples/express

@lexer
Copy link
Author

lexer commented Apr 17, 2011

Have fixed the issue. Instead of http.ClientRequest with secure option "true" im using https.request method that works fine.

@johnae
Copy link

johnae commented Apr 25, 2011

This issue looks like the same as the one I reported here http-party/node-http-proxy#36

@eflorico
Copy link

eflorico commented Apr 3, 2012

Getting the same error on 0.6.14, using either https.get, https.request or the request library:

Error: socket hang up
    at createHangUpError (http.js:1107:15)
    at CleartextStream.<anonymous> (http.js:1210:27)
    at CleartextStream.emit (events.js:88:20)
    at Array.0 (tls.js:792:22)
    at EventEmitter._tickCallback (node.js:192:40)

The same code, however, is working when deployed to the production environment on Nodester which is running 0.6.12.

@xdmx
Copy link

xdmx commented Aug 13, 2012

I confirm this problem (0.8.6).
If you try:

var req = require('https').request({host:'wepay.com', port:443, path:'/', method:'HEAD', agent:false}, function (res) {console.log("done " + res.headers['server']);}); req.end();

It won't return anything (I've tried from 2 different places/connections)

But
var req = require('https').request({host:'stripe.com', port:443, path:'/', method:'HEAD', agent:false}, function (res) {console.log("done " + res.headers['server']);}); req.end();

(as many other websites) works correctly

I've found several hostnames that have this problem

@bnoordhuis
Copy link
Member

@xdmx It's not the same bug but it is a bug. Can you open a new issue?

I'm closing this one, the hangup errors have been fixed a long time ago.

@xdmx
Copy link

xdmx commented Aug 13, 2012

sure, here it is #3865

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

5 participants