Created
June 14, 2010 15:33
-
-
Save pgriess/437842 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/http.js b/lib/http.js | |
index 1cf9eca..e9d7c6a 100644 | |
--- a/lib/http.js | |
+++ b/lib/http.js | |
@@ -863,11 +863,18 @@ function Client ( ) { | |
self.destroy(ret); | |
} else if (parser.incoming && parser.incoming.upgrade) { | |
var bytesParsed = ret; | |
- var upgradeHead = d.slice(start + bytesParsed, end - start); | |
- parser.incoming.upgradeHead = upgradeHead; | |
- var req = self._outgoing[0]; | |
self.ondata = null; | |
self.onend = null | |
+ | |
+ var req = self._outgoing[0]; | |
+ | |
+ var upgradeHead = d.slice(start + bytesParsed + 1, end - start); | |
+ | |
+ if (self.listeners('upgrade').length) { | |
+ self.emit('upgrade', req, self, upgradeHead); | |
+ } else { | |
+ self.destroy(); | |
+ } | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment