Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Origin header to WebSocket connections. #6611

Merged
merged 2 commits into from Jul 14, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Fix #6379

  • Loading branch information
boghison authored and jdm committed Jul 13, 2015
commit 35d5328271bc10b18a418d37933efd168bed09a4
@@ -32,6 +32,7 @@ use websocket::client::receiver::Receiver;
use websocket::stream::WebSocketStream;
use websocket::client::request::Url;
use websocket::Client;
use websocket::header::Origin;

#[derive(JSTraceable, PartialEq, Copy, Clone)]
enum WebSocketRequestState {
@@ -139,7 +140,7 @@ impl WebSocket {

// TODO Client::connect does not conform to RFC 6455
// see https://github.com/cyderize/rust-websocket/issues/38
let request = match Client::connect(url) {
let mut request = match Client::connect(url) {
Ok(request) => request,
Err(_) => {
let global_root = ws.r().global.root();
@@ -149,6 +150,7 @@ impl WebSocket {
return Ok(ws);
}
};
request.headers.set(Origin(global.get_url().serialize()));
let response = request.send().unwrap();
response.validate().unwrap();

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.