Commit graph

515 commits

Author SHA1 Message Date
bors-servo
3d38a60cee Auto merge of #10867 - danlrobertson:sandbox, r=KiChjang
Fix logic for cors cache match

The current logic for a cors cache match does not consider "credentials is false and request's credentials mode is not "include" or credentials is true."

I could have missed something, but `CacheRequestDetails::credentials` is set to true if credentials mode is "include", and false otherwise. So `(!cors_cache.credentials && !cors_req.credentials) || cors_cache.credentials` would be directly following the spec, but unless I'm mistaken `cors_cache.credentials || !cors_req.credentials` is logically the same.

Fixes: #10525

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10867)
<!-- Reviewable:end -->
2016-04-28 13:36:05 -07:00
Daniel Robertson
483f07c8f0
Cleanup CORSCache
Remove the CORSCache trait, CORSCacheSender, CORSCacheThreadMsg, and
CORSCacheThread. Rename BasicCORSCache to CORSCache and keep its old
implementation of CORSCache.
2016-04-27 17:02:54 -04:00
Daniel Robertson
153059c55c
Fix logic for cors cache match
The current logic for a cors cache match does not consider "credentials
is false and request's credentials mode is not "include" or credentials
is true."
2016-04-27 16:39:57 -04:00
bors-servo
88020e9151 Auto merge of #10869 - frewsxcv:dry, r=jdm
DRY out `StreamedResponse::from_http_response`.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10869)
<!-- Reviewable:end -->
2016-04-27 04:23:34 -07:00
Corey Farwell
87b54ef685 DRY out StreamedResponse::from_http_response. 2016-04-27 01:00:50 -04:00
Corey Farwell
55c2f93740 Add NetworkError::LoadCancelled variant. 2016-04-27 00:25:27 -04:00
bors-servo
2729864af7 Auto merge of #10857 - servo:toml, r=nox
Simplify TOML syntax

* Sections like `[dependencies.foo]` can be entries in a `[dependencies]` section with the `{key = value}` syntax.
* Per-target dependencies can be expressed with more general `cfg(…)` conditions instead of exact target triples: https://github.com/rust-lang/cargo/pull/2328

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10857)
<!-- Reviewable:end -->
2016-04-26 15:46:37 -07:00
Simon Sapin
83b3ebf6ac Simplify TOML syntax
* Sections like `[dependencies.foo]` can be entries in a `[dependencies]`
  section with the `{key = value}` syntax.
* Per-target dependencies can be expressed with more general `cfg(…)`
  conditions instead of exact target triples:
  https://github.com/rust-lang/cargo/pull/2328
2016-04-26 23:51:36 +02:00
bors-servo
47efbea666 Auto merge of #10767 - akhan7:command, r=jdm
Added Store Command to ImageCache Task

Implemented last bullet of [Image conformance student project: Initial Steps](https://github.com/servo/servo/wiki/Image-load-conformance-student-project)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10767)
<!-- Reviewable:end -->
2016-04-26 07:40:18 -07:00
Sagar Muchhal
5b9251ed3b Added Store Command to ImageCache Task 2016-04-26 03:05:15 -04:00
bors-servo
7a582b4bf9 Auto merge of #10800 - DDEFISHER:read_profile_dir_from_file, r=frewsxcv
read cookie_jar, hsts_list, auth_cache, and local_data from file if profile_dir option is present

Last step in Persistent sessions student project

"check for the presence of the profile directory command-line option in the ResourceThread constructor and look for files that will contain serialized versions of the previous steps. If they exist, populate the appropriate fields with deserialized versions of the file contents."

Also populated local_data in StorageManager constructor

I am not sure if the handling of decoding and encoding the Option Tm type was done in the cleanest way here.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10800)
<!-- Reviewable:end -->
2016-04-25 18:10:40 -07:00
Daniel
d9c32b273a read cookie_jar, hsts_list, auth_cache, and local_data from file if profile_dir option is present 2016-04-25 19:39:40 -04:00
bors-servo
81f6e70a62 Auto merge of #10785 - frewsxcv:loaderrortype-nostring, r=jdm
Refactor `LoadErrorType` to not require a `String` for every type.

Some of the `LoadErrorType` like `LoadCancelled` don't need a `String`
associated with the type since the variant is self-explanatory.

There are some variants that don't need an associated `String`, but that
can be cleaned up in a later refactor. Also, `net_traits::NetworkError`
currently requires a `String`, but that can potentially also be
refactored away too.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10785)
<!-- Reviewable:end -->
2016-04-25 14:37:44 -07:00
Corey Farwell
2675d9d1ff Refactor LoadErrorType to not require a String for every type.
Some of the `LoadErrorType` like `LoadCancelled` don't need a `String`
associated with the type since the variant is self-explanatory.

There are some variants that don't need an associated `String`, but that
can be cleaned up in a later refactor. Also, `net_traits::NetworkError`
currently requires a `String`, but that can potentially also be
refactored away too.
2016-04-25 17:10:33 -04:00
Rebecca
526525b835 Add referrer policy pass-through and referrer header logic
add pass-through from doc to http-loader for referrer_policy, ref_URL
add logic for setting referer header
add script pass-through for referrer
add unit tests for setting referer header
2016-04-25 16:41:06 -04:00
Simon Sapin
e662605138 More chrome URL hardenning and tests. 2016-04-23 20:28:03 +02:00
Simon Sapin
374679852c Make chrome: URLs have a "host". 2016-04-23 20:28:02 +02:00
Simon Sapin
7932ab6ac2 Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
Zbynek Winkler
924d804583 Move '&&' to the end of the previous line.
Following https://github.com/servo/servo/issues/10692 this is just a
formating change to satisfy a new tidy requirement of not having '&&' at
the beginning of a line.
2016-04-22 14:28:18 +02:00
Daniel
d4f63cda5f write cookie_jar, hsts_list, auth_cache, and local_data to file if profile_dir option is present 2016-04-20 18:12:00 -04:00
Josh Matthews
d888ed368d Make new test use local resources only. 2016-04-20 12:38:38 -04:00
Ravi Shankar
16096f1a9c Added 'about:sslfail' and a reftest for SSL failure 2016-04-20 12:38:37 -04:00
Ravi Shankar
945a2c66e1 Updated the unit tests to include NetworkError 2016-04-20 12:38:36 -04:00
Ravi Shankar
5e6f32a59b Propagating the load errors from network loader 2016-04-20 12:38:35 -04:00
Corey Farwell
f0a6403211 Fix incorrect indentation for line continuation. 2016-04-19 19:36:17 -04:00
Corey Farwell
a10b574d44 Flatten and cleanup ConstellationListener::is_cancelled. 2016-04-19 19:36:16 -04:00
Corey Farwell
16be0640a8 Refactor loop into a while loop. 2016-04-19 19:36:15 -04:00
Corey Farwell
4618ad6b73 More idiomatic char retrieval from String. 2016-04-19 19:36:12 -04:00
Corey Farwell
7500307e80 Avoid unnecessary net_traits::LoadData clone. 2016-04-18 22:53:28 -04:00
bors-servo
80662f1e4e Auto merge of #10672 - frewsxcv:net-network, r=KiChjang
Improvements to network preferences, HTTP redirection limiting.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10672)
<!-- Reviewable:end -->
2016-04-19 04:06:25 +05:30
bors-servo
6edcad206d Auto merge of #10640 - frewsxcv:apache-flag, r=KiChjang
Cleanup code regarding mimesniff 'apache bug'.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10640)
<!-- Reviewable:end -->
2016-04-19 00:16:12 +05:30
Corey Farwell
da0adeb0ac Verify number of redirects when we reach limit. 2016-04-17 20:14:08 -04:00
Corey Farwell
8e14cbccc3 Add pref for HTTP redirection limit.
The pref key name matches the associated Gecko pref key name.
2016-04-17 16:43:55 -04:00
Corey Farwell
07209c75db Rename net.mime.sniff pref to network.mime.sniff.
Gecko uses the `network` prefix for network related items. Might be good
to mirror that here.
2016-04-17 16:15:24 -04:00
Corey Farwell
08fc002f41 Rename 'HSTS*' structures to 'Hsts*'.
"In CamelCase, acronyms count as one word: use Uuid rather than UUID."

-- https://doc.rust-lang.org/style/style/naming/README.html
2016-04-17 14:12:28 -04:00
Corey Farwell
faa3d8724b Refactor Servo HSTS file loading, hard-fail if can't load.
Use constructor pattern instead of separate utility function.

Instead of allowing the Servo HSTS file loading to silently fail, we
should expect that file to always exist and be formatted correctly.
2016-04-17 14:12:07 -04:00
Corey Farwell
d3b8b6472b Move UTF8 bytes handling into generic constructor.
Separate from Servo specific logic.
2016-04-17 12:39:50 -04:00
Corey Farwell
52b3226d54 Rename constructor to match convention, add doc comment. 2016-04-17 12:38:29 -04:00
Corey Farwell
c37ab1facd Make read_resource_file param simpler and more idiomatic.
`<P: AsRef<Path>>` is also what `File::open` uses as a generic type for
the parameter.
2016-04-16 23:06:59 -04:00
bors-servo
cc290c6e8a Auto merge of #10650 - jdm:disabletfd, r=KiChjang
Disable tinyfiledialogs on non-OS X and Linux platforms.

I haven't been able to fix the appveyor build yet, so this gives us back a usable Windows build.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10650)
<!-- Reviewable:end -->
2016-04-17 02:50:19 +05:30
Josh Matthews
d09a497aa5 Disable tinyfiledialogs on non-OS X and Linux platforms. 2016-04-16 15:00:31 -04:00
Corey Farwell
da34d469cf Cleanup retrieval of last slice item. 2016-04-15 18:14:16 -04:00
Corey Farwell
540e5ce6ad Use constructor pattern for ApacheFlag enum. 2016-04-15 18:10:33 -04:00
Corey Farwell
6c0927c289 Add relevant sepc link for 'apache bug' mimesniff. 2016-04-15 18:07:55 -04:00
Corey Farwell
12dfe6ff28 Flatten implementation of net::http_response::HttpResponse. 2016-04-15 09:13:47 -04:00
Corey Farwell
50c6d937a5 Flatten implementation of net::file_loader::factory. 2016-04-15 09:13:47 -04:00
Josh Matthews
43369fa897 Rename create_with_headers to create. 2016-04-15 01:46:04 -04:00
Josh Matthews
a761f2bed4 Remove unused header manipulation facilities. 2016-04-15 01:46:03 -04:00
Josh Matthews
a315f8db9e Reorganize header manipulation that occurs before sending an HTTP request so we can provide the full set of headers while creating a request. 2016-04-15 01:45:56 -04:00
Josh Matthews
0e1703d747 Convert NetworkHttpRequestFactory. 2016-04-15 01:45:55 -04:00