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 all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -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();

@@ -1,3 +1,6 @@
[010.html]
type: testharness
expected: CRASH
expected: TIMEOUT
[WebSockets: protocol in response but no requested protocol]
expected: TIMEOUT

@@ -1,3 +1,6 @@
[011.html]
type: testharness
expected: CRASH
expected: TIMEOUT
[WebSockets: protocol mismatch]
expected: TIMEOUT

@@ -1,3 +1,6 @@
[012.html]
type: testharness
expected: CRASH
expected: TIMEOUT
[WebSockets: no protocol in response]
expected: TIMEOUT

@@ -1,3 +1,5 @@
[002.html]
type: testharness
expected: CRASH
[WebSockets: Set-Cookie in response]
expected: FAIL

This file was deleted.

@@ -1,3 +1,6 @@
[005.html]
type: testharness
expected: CRASH
expected: TIMEOUT
[WebSockets: setting HttpOnly cookies in ws response, checking ws request]
expected: TIMEOUT

@@ -1,3 +1,5 @@
[007.html]
type: testharness
expected: CRASH
[WebSockets: when to process set-cookie fields in ws response]
expected: FAIL

@@ -1,3 +1,6 @@
[005.html]
type: testharness
expected: CRASH
expected: TIMEOUT
[WebSockets: proper first line]
expected: TIMEOUT

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