copy headers from script request to net request

This commit is contained in:
Gregory Terzian 2017-11-12 14:11:50 +08:00
parent f674cba612
commit d196f3de62
7 changed files with 9 additions and 249 deletions

View file

@ -234,6 +234,12 @@ impl Headers {
*self.header_list.borrow_mut() = hyper_headers;
}
pub fn get_headers_list(&self) -> HyperHeaders {
let mut headers = HyperHeaders::new();
headers.extend(self.header_list.borrow_mut().iter());
headers
}
// https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
pub fn extract_mime_type(&self) -> Vec<u8> {
self.header_list.borrow().get_raw("content-type").map_or(vec![], |v| v[0].clone())

View file

@ -339,6 +339,9 @@ impl Request {
_ => {},
}
// Copy the headers list onto the headers of net_traits::Request
r.request.borrow_mut().headers = r.Headers().get_headers_list();
// Step 32
let mut input_body = if let RequestInfo::Request(ref input_request) = input {
let input_request_request = input_request.request.borrow();

View file

@ -1,17 +0,0 @@
[accept-header.any.html]
type: testharness
[Request through fetch should have 'accept' header with value 'custom/*']
expected: FAIL
[Request through fetch should have 'accept-language' header with value 'bzh']
expected: FAIL
[accept-header.any.worker.html]
type: testharness
[Request through fetch should have 'accept' header with value 'custom/*']
expected: FAIL
[Request through fetch should have 'accept-language' header with value 'bzh']
expected: FAIL

View file

@ -6,12 +6,6 @@
[CORS that succeeds with credentials: false; method: OK (allowed: *); header: X-Test,1 (allowed: *)]
expected: FAIL
[CORS that fails with credentials: true; method: GET (allowed: get); header: X-Test,1 (allowed: *)]
expected: FAIL
[CORS that fails with credentials: true; method: GET (allowed: *); header: X-Test,1 (allowed: *)]
expected: FAIL
[CORS that succeeds with credentials: true; method: PUT (allowed: PUT); header: (allowed: *)]
expected: FAIL

View file

@ -6,18 +6,9 @@
[CORS [NEW\], server allows]
expected: FAIL
[CORS [GET\] [x-test-header: allowed\], server allows]
expected: FAIL
[CORS [GET\] [x-test-header: refused\], server refuses]
expected: FAIL
[CORS [GET\] [several headers\], server allows]
expected: FAIL
[CORS [GET\] [several headers\], server refuses]
expected: FAIL
[CORS [PUT\] [several headers\], server allows]
expected: FAIL
@ -30,18 +21,9 @@
[CORS [NEW\], server allows]
expected: FAIL
[CORS [GET\] [x-test-header: allowed\], server allows]
expected: FAIL
[CORS [GET\] [x-test-header: refused\], server refuses]
expected: FAIL
[CORS [GET\] [several headers\], server allows]
expected: FAIL
[CORS [GET\] [several headers\], server refuses]
expected: FAIL
[CORS [PUT\] [several headers\], server allows]
expected: FAIL

View file

@ -1,185 +0,0 @@
[cors-redirect-preflight.any.html]
type: testharness
[Redirect 301: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 301: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 301: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 301: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 301: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 301: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 302: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 302: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 302: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 302: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 302: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 302: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 303: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 303: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 303: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 303: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 303: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 303: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 307: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 307: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 307: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 307: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 307: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 307: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 308: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 308: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 308: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 308: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 308: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 308: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[cors-redirect-preflight.any.worker.html]
type: testharness
[Redirect 301: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 301: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 301: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 301: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 301: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 301: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 302: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 302: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 302: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 302: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 302: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 302: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 303: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 303: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 303: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 303: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 303: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 303: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 307: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 307: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 307: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 307: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 307: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 307: cors to another cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 308: same origin to cors (preflight after redirection success case)]
expected: FAIL
[Redirect 308: same origin to cors (preflight after redirection failure case)]
expected: FAIL
[Redirect 308: cors to same origin (preflight after redirection success case)]
expected: FAIL
[Redirect 308: cors to same origin (preflight after redirection failure case)]
expected: FAIL
[Redirect 308: cors to another cors (preflight after redirection success case)]
expected: FAIL
[Redirect 308: cors to another cors (preflight after redirection failure case)]
expected: FAIL

View file

@ -1,23 +0,0 @@
[authentication-basic.any.html]
type: testharness
[User-added Authorization header with include mode]
expected: FAIL
[User-added Authorization header with same-origin mode]
expected: FAIL
[User-added Authorization header with omit mode]
expected: FAIL
[authentication-basic.any.worker.html]
type: testharness
[User-added Authorization header with include mode]
expected: FAIL
[User-added Authorization header with same-origin mode]
expected: FAIL
[User-added Authorization header with omit mode]
expected: FAIL