Update HTTP-network fetch

This commit is contained in:
Keith Yeung 2017-06-25 02:22:46 -07:00
parent 99f59352b8
commit 34178bdd4c

View file

@ -1024,8 +1024,6 @@ fn http_network_fetch(request: &Request,
done_chan: &mut DoneChannel, done_chan: &mut DoneChannel,
context: &FetchContext) context: &FetchContext)
-> Response { -> Response {
// TODO: Implement HTTP network fetch spec
// Step 1 // Step 1
// nothing to do here, since credentials_flag is already a boolean // nothing to do here, since credentials_flag is already a boolean
@ -1036,6 +1034,9 @@ fn http_network_fetch(request: &Request,
// TODO be able to tell if the connection is a failure // TODO be able to tell if the connection is a failure
// Step 4 // Step 4
// TODO: check whether the connection is HTTP/2
// Step 5
let url = request.current_url(); let url = request.current_url();
let request_id = context.devtools_chan.as_ref().map(|_| { let request_id = context.devtools_chan.as_ref().map(|_| {
@ -1150,10 +1151,10 @@ fn http_network_fetch(request: &Request,
// TODO Read request // TODO Read request
// Step 5-9 // Step 6-11
// (needs stream bodies) // (needs stream bodies)
// Step 10 // Step 12
// TODO when https://bugzilla.mozilla.org/show_bug.cgi?id=1030660 // TODO when https://bugzilla.mozilla.org/show_bug.cgi?id=1030660
// is resolved, this step will become uneccesary // is resolved, this step will become uneccesary
// TODO this step // TODO this step
@ -1165,24 +1166,22 @@ fn http_network_fetch(request: &Request,
} }
}; };
// Step 11 // Step 13
// TODO this step isn't possible yet (CSP) // TODO this step isn't possible yet (CSP)
// Step 12 // Step 14
if response.is_network_error() && request.cache_mode == CacheMode::NoStore { if !response.is_network_error() && request.cache_mode != CacheMode::NoStore {
// TODO update response in the HTTP cache for request // TODO update response in the HTTP cache for request
} }
// TODO this step isn't possible yet // TODO this step isn't possible yet
// Step 13 // Step 15
// Step 14.
if credentials_flag { if credentials_flag {
set_cookies_from_headers(&url, &response.headers, &context.state.cookie_jar); set_cookies_from_headers(&url, &response.headers, &context.state.cookie_jar);
} }
// TODO these steps // TODO these steps
// Step 15 // Step 16
// Substep 1 // Substep 1
// Substep 2 // Substep 2
// Sub-substep 1 // Sub-substep 1