Skip to content

Commit

Permalink
Merge pull request socketio#980 from doozr/jsonp-error-crash
Browse files Browse the repository at this point in the history
Always set the HTTP response in case an error should be returned to the client
  • Loading branch information
rauchg committed Aug 6, 2012
2 parents 48ad0d3 + d723d36 commit 46227e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/transports/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ HTTPTransport.prototype.__proto__ = Transport.prototype;
*/

HTTPTransport.prototype.handleRequest = function (req) {

// Always set the response in case an error is returned to the client
this.response = req.res;

if (req.method == 'POST') {
var buffer = ''
, res = req.res
Expand Down Expand Up @@ -77,8 +81,6 @@ HTTPTransport.prototype.handleRequest = function (req) {
headers['Access-Control-Allow-Credentials'] = 'true';
}
} else {
this.response = req.res;

Transport.prototype.handleRequest.call(this, req);
}
};
Expand Down

0 comments on commit 46227e7

Please sign in to comment.