Skip to content

Instantly share code, notes, and snippets.

@josephg
Created November 1, 2011 10:11
Show Gist options
  • Save josephg/1330256 to your computer and use it in GitHub Desktop.
Save josephg/1330256 to your computer and use it in GitHub Desktop.
http client behaviour under 0.5.0
$ coffee cc.coffee
Error: socket hang up
at createHangUpError (http.js:1083:15)
at Socket.<anonymous> (http.js:1166:27)
at Socket.emit (events.js:88:20)
at Array.0 (net.js:280:10)
at EventEmitter._tickCallback (node.js:194:26)
http = require 'http'
http.createServer (req, res) ->
res.writeHead 200, {'Content-Type': 'text/plain'}
# not calling res.end()
.listen 3000, ->
req = http.get {host:'127.0.0.1', path:'/', port:3000}, (res) ->
# This is never called - I wonder if the head is buffered waiting for data?
console.log res.statusCode
setTimeout (-> req.abort()), 1000
# This error handler gets called.
req.on 'error', (e) -> console.warn e.stack
@madhums
Copy link

madhums commented Apr 20, 2012

I am getting the same error, did you figure out why it was happening?

@josephg
Copy link
Author

josephg commented Apr 21, 2012

I can't remember :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment