Commit graph

1138 commits

Author SHA1 Message Date
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
Josh Matthews
80eaeac9f4 Make headers available when creating an HTTP request via a factory. 2016-04-15 01:45:48 -04:00
Josh Matthews
dc790048ec Remove unnecessary type annotations. 2016-04-15 01:00:44 -04:00
Daniel
b0e1f10ba5 401 authorization UI then restart request/save successful auth creds 2016-04-14 21:38:45 -04:00
bors-servo
d21ff2fa13 Auto merge of #10189 - KiChjang:cors-preflight-fetch, r=jdm
Implement CORS preflight fetch

Fixes #10145.

<!-- 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/10189)
<!-- Reviewable:end -->
2016-04-13 21:28:25 +05:30
Keith Yeung
e42481d0e7 Implement CORS preflight fetch 2016-04-13 11:28:14 -04:00
Nazım Can Altınova
d22d1c4fc1 Removed unused imports from methods.rs 2016-04-09 22:09:11 +03:00
Keith Yeung
32f309c02e Use mime! macro in fetch methods 2016-04-08 11:26:48 -04:00
Ms2ger
489d2e5e49 Update uuid. 2016-04-07 09:00:22 +02:00
bors-servo
9f892edd87 Auto merge of #10272 - creativcoder:implement-data-url-fetch, r=jdm
implements data-url fetching

Fixes #10165
jdm mentioned of decoupling the, payload loading mechanism to data_loader.rs. So accordingly a `decoder` method has been added to data_loader.

<!-- 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/10272)
<!-- Reviewable:end -->
2016-04-01 15:12:30 +05:30
Rahul Sharma
3e74164e5f implements data-url fetching 2016-04-01 09:49:08 +05:30
Anthony Ramine
e29beb10a8 Bump websocket to 0.16.1 2016-03-28 19:45:20 +02:00
faineance
7c45a4fea0 change changes effecting verbosity 2016-03-27 13:54:41 +01:00
faineance
418842faf9 use self.0 instead of destructing single item tuple structs 2016-03-27 11:50:08 +01:00
bors-servo
d82f97a9cd Auto merge of #10188 - ConnorGBrewster:http-global-state, r=jdm
Add Http Global State Object

This adds a new HttpState object which holds common http state(#10175). This reduces the amount of work that is required to add extra things to the Http state.

The HttpState object currently holds:
```
hsts_list: Arc::new(RwLock::new(HSTSList::new())),
cookie_jar: Arc::new(RwLock::new(CookieStorage::new())),
auth_cache: Arc::new(RwLock::new(HashMap::new())),
```

<!-- 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/10188)
<!-- Reviewable:end -->
2016-03-26 19:06:52 +05:30
Connor Brewster
b09570b2b6 Added global state struct
Replace hsts_list, auth_cache, and cookie_jar with http_state

Reverted a few changes

Moved http_state back to factory
Removed unnecessary Arc

Removed Arc for http_state
2016-03-25 12:35:40 -06:00
bors-servo
38e8c923b5 Auto merge of #10154 - stjepang:fix-local-urls-only-10147, r=KiChjang
Fix #10147: Correctly handle flag local_urls_only

In function Request::fetch_main, flag local_urls_only (if set)
should allow fetching local urls only. Before this change, the flag had
the inverse behaviour.

Fixes #10147.
Test with: `./mach test-unit -p net fetch::test_fetch_with_local_urls_only`

<!-- 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/10154)
<!-- Reviewable:end -->
2016-03-25 12:42:48 +05:30
bors-servo
7f944afee8 Auto merge of #10111 - DDEFISHER:master, r=jdm
add auth cache to resources + set auth header from it if url does not have creds

initial attempt of

- in resource_thread.rs, define an HTTP authorization cache storage (username, password, URL) and instantiate it like the cookie_storage member (inside an Arc<Rwlock<>> value, to enable sharing it between threads)
- in modify_request_headers in http_loader.rs, implement the remaining pieces of step 12(13?) of the appropriate specification using this new authorization cache.

 for the NCSU student project Implement HTTP authorization UI and persistent sessions.

<!-- 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/10111)
<!-- Reviewable:end -->
2016-03-24 23:54:13 +05:30
Daniel
d49d3b01f2 add auth cache to resources + set auth header if url does not have creds 2016-03-24 12:24:08 -04:00
Stjepan Glavina
4965c93d16 Merge branch 'master' into fix-local-urls-only-10147 2016-03-24 13:45:25 +01:00
Stjepan Glavina
3ec4515a73 Address PR comments
- Remove fn `url_is_local`
- Remove fn `set_local_urls_only`
- Fix `test_fetch_with_local_urls_only`
2016-03-24 13:42:40 +01:00
Stjepan Glavina
bcd813d961 Fix fetching about:blank
When fetching about:blank, response body should be the empty byte
sequence.
Spec: https://fetch.spec.whatwg.org/#concept-basic-fetch

Before this change, response body would be set to `ResponseBody::Empty`,
and then fetching would result in an infinite loop at step 19 in fn
`main_fetch` (methods.rs).
2016-03-24 11:17:12 +01:00
Stjepan Glavina
6576fde29b Correctly handle flag local_urls_only
In function Request::fetch_main, flag local_urls_only (if set)
should allow fetching local urls only. Before this change, the flag had
the inverse behaviour.
2016-03-23 18:01:43 +01:00
Corey Farwell
182b9b1e4f Use external 'threadpool' crate, remove in-tree utility. 2016-03-18 11:05:49 -04:00
Ms2ger
e8db43ce50 Disallow unsafe code in net and net_traits. 2016-03-18 10:30:07 +01:00
Anthony Ramine
46c505e47b Bump serde to 0.7 2016-03-17 13:52:39 +01:00
Anthony Ramine
7214fba45b Bump openssl to 0.7.6 2016-03-16 23:42:21 -07:00
Anthony Ramine
a4d6d41665 Reorder dependencies in net/Cargo.toml 2016-03-16 23:36:04 -07:00