Skip to content

Commit

Permalink
Merge pull request socketio#737 from mixu/mixu/authfix2
Browse files Browse the repository at this point in the history
Supplemental fix to gavinuhma/authfix, it looks like the same Access-Control-Origin logic is needed in the http and xhr-polling transports
  • Loading branch information
rauchg committed Feb 3, 2012
2 parents 6074795 + 304a428 commit b662704
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions lib/transports/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,8 @@ HTTPTransport.prototype.handleRequest = function (req) {

if (origin) {
// https://developer.mozilla.org/En/HTTP_Access_Control
headers['Access-Control-Allow-Origin'] = '*';

if (req.headers.cookie) {
headers['Access-Control-Allow-Credentials'] = 'true';
}
headers['Access-Control-Allow-Origin'] = origin;
headers['Access-Control-Allow-Credentials'] = 'true';
}
} else {
this.response = req.res;
Expand Down
7 changes: 2 additions & 5 deletions lib/transports/xhr-polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ XHRPolling.prototype.doWrite = function (data) {

if (origin) {
// https://developer.mozilla.org/En/HTTP_Access_Control
headers['Access-Control-Allow-Origin'] = '*';

if (this.req.headers.cookie) {
headers['Access-Control-Allow-Credentials'] = 'true';
}
headers['Access-Control-Allow-Origin'] = origin;
headers['Access-Control-Allow-Credentials'] = 'true';
}

this.response.writeHead(200, headers);
Expand Down

0 comments on commit b662704

Please sign in to comment.