Commit graph

1138 commits

Author SHA1 Message Date
Sam Gibson
81fe5938bf Removes HttpRequest, adds HttpResponse wrapper
The HttpRequest trait doesn't make sense, on further reflection. Rather,
just modify the method signature on the requester. The hyper request was
only being used to mutate it's headers anyway.

servo/servo#6727
2015-08-30 12:13:33 +10:00
Sam Gibson
7633cd54c2 Abstract everything but the response from hyper
Because we're using unsized types not for requesting, there's not a
satisfactory way of doing this without boxing the request...

Once unsized stuff lands in rust 1.2/1.3(???) then this should be
implemented with Rc's instead of Box's.

For the time being I'm not sure what else to do.

servo/servo#6727
2015-08-30 12:13:33 +10:00
Sam Gibson
6cba33a50b Abstracts the hyper connection to a servo HttpRequester trait
servo/servo#6727
2015-08-30 12:13:32 +10:00
Sam Gibson
67aa11323b Adds simple POC unit test for load
servo/servo#6727
2015-08-30 12:13:32 +10:00
Sam Gibson
9ac250c62c Abstracts out initial client connection and SSL errors (which I don't think are working?)
servo/servo#6727
2015-08-30 12:13:31 +10:00
Sam Gibson
c8c36f4490 Injects the network connector as a dependency into http_loader::load
servo/servo#6727
2015-08-30 12:13:30 +10:00
Sam Gibson
610ef40105 Refactors http_loader::load to be synchronous w/ an async wrapper
This simplifies the arguments that are passed in and should make testing
errors/responses easier once they're mocked

servo/servo#6727
2015-08-30 12:13:29 +10:00
bors-servo
645dd7ba03 Auto merge of #7436 - jdm:netthreadname, r=Manishearth
Improve debuggability of http_loader panics.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7436)
<!-- Reviewable:end -->
2015-08-28 13:14:28 -06:00
Josh Matthews
2360db68b1 Improve debuggability of http_loader panics. 2015-08-28 15:11:30 -04:00
Johann Tuffe
dd1c8c826e Refactor mime_classifier
Use more iterators in particular.
2015-08-28 22:47:41 +08:00
Sara Tang
8c39e968cd Fixed mismatched type error 2015-08-24 23:11:31 -04:00
Sara Tang
f80ae3402a Fixes for issue #7347 2015-08-24 21:32:16 -04:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
bors-servo
0d6d6a0500 Auto merge of #7257 - jxs:master, r=Ms2ger
Replace uses of `for foo in bar.iter()`,

and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7257)
<!-- Reviewable:end -->
2015-08-18 02:46:46 -06:00
Glenn Watson
6d9fccbae7 Add a simple method to emulate a platform UA (e.g. pretend a desktop build is an android UA). 2015-08-18 14:42:28 +10:00
João Oliveira
067a22a868 Replace uses of for foo in bar.iter(),
and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
2015-08-18 01:46:11 +01:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
João Oliveira
0038580abf Replace uses of for foo in bar.iter() and for foo in bar.iter_mut()
closes #7197
2015-08-15 02:27:39 +01:00
João Oliveira
9c11781880 replace .len() == 0 with is_empty()
closes #7198
2015-08-14 04:00:33 +01:00
wilmoz
210e068ac7 Remove Message suffix from NetworkEventMessage 2015-08-10 18:48:53 -05:00
Adrián Arroyo Calle
af21c2457e MIME classifier should use &[T] instead of &Vec<T> 2015-08-10 15:00:35 +02:00
Connor Imes
b526214a3d Move net_error_list from net to net_traits. Fixes #7050. 2015-08-06 16:37:08 -05:00
James Graham
f52276d2cc Use hosts-replaced URL only when loading resources 2015-08-05 10:34:20 +01:00
Sam Gibson
0d94ee917d Ensure STS headers are only honoured when they come from an HTTPS host 2015-08-02 21:18:24 +12:00
Sam Gibson
c44579018a Obey Strict-Transport-Security header 2015-08-02 21:17:58 +12:00
Patrick Walton
024c4df912 script: Fix merge fallout. 2015-07-31 11:28:09 -07:00
Patrick Walton
2aa5174246 script: Make the resource task communication use IPC channels. 2015-07-31 11:28:09 -07:00
Patrick Walton
44d13f7fd4 net: Use a thread for each AsyncResponseTarget to avoid having to send
trait objects across process boundaries.
2015-07-31 11:27:49 -07:00
Patrick Walton
9c9d7dc93b net: Make most of the resource task messages serializable. 2015-07-31 11:27:49 -07:00
Patrick Walton
164e10202c devtools: Convert the developer tools to run over IPC. 2015-07-27 09:10:01 -07:00
Patrick Walton
82b53d83ff script: Make the ImageCacheTask use IPC.
This necessitated getting rid of the boxed trait object that was being
be passed between the script task and the image cache task.
2015-07-26 23:07:44 -07:00
Patrick Walton
43cb7d5abd net: Convert the storage task to use IPC. 2015-07-26 17:07:17 -07:00
Sam Gibson
118122da38 Uses the approach suggested by @SimonSapin for changing Url scheme
servo/rust-url#61
2015-07-22 11:49:10 +12:00
Sam Gibson
5014da42fc Only secure URL's that aren't already to HTTPS.
Cuts down on logger spam, and unnecessary Url::clone's
2015-07-22 11:49:09 +12:00
Sam Gibson
bae979137a Moves HSTS includeSubdomains enum to net_traits 2015-07-22 11:49:09 +12:00
Sam Gibson
82cafc4274 Passes an Arc<Mutex<HSTSList>> to threads instead of cloning 2015-07-22 11:49:09 +12:00
Sam Gibson
11f5be6d85 Responds to more code review feedback
* Use regex from resource task
* Don't have an option of an HSTS list, default to empty
2015-07-22 11:49:08 +12:00
Sam Gibson
f2148f06b1 Moves the HSTS replacement code to http_loader
This respects STS for redirects as well.
2015-07-22 11:49:08 +12:00
Sam Gibson
826f56bdf3 Moves HSTS code to it's own module 2015-07-22 11:49:07 +12:00
Sam Gibson
02bd5cdc1b Resolves remaining code review issues
* Don't pass a boolean to the HSTSEntry constructor, use an enum instead
* Don't clone when securing load data
* Comment about the Url bug
* Change remaining assert!(... == ...) to assert_eq!(..., ...)
2015-07-22 11:49:07 +12:00
Sam Gibson
29a34dbdb5 Resolves code review comments
* Lots of rust-isms
* Mutable iterator for modifying entries (much better)
2015-07-22 11:49:06 +12:00
Sam Gibson
a068a80619 Don't unnecessarily clone strings 2015-07-22 11:49:06 +12:00
Sam Gibson
8a401d5a7f Re-parse URL to not have inconsistent state 2015-07-22 11:49:05 +12:00
Sam Gibson
795454fb81 Adds control message for HSTS headers 2015-07-22 11:49:04 +12:00
Sam Gibson
f284181781 Abstract out ResourceManager messaging from impl
De-coupling makes testing a bit easier.
2015-07-22 11:49:04 +12:00
Sam Gibson
ff1777e446 Evict HSTS entries when a max-age of 0 is seen 2015-07-22 11:49:03 +12:00
Sam Gibson
690ac636eb Rename/refactor 2015-07-22 11:49:03 +12:00
Sam Gibson
15c90a58b2 Expire HSTS entries that have exceeded their max-age
servo/servo#6105
2015-07-22 11:49:03 +12:00
Sam Gibson
8d39fb6dcf Shift checking for IP address host for HSTS entry to constructor
servo/servo#6105
2015-07-22 11:48:05 +12:00
Sam Gibson
cb9b0c2a7a Add max-age to HSTS entries
Refactors API for pushing new entries on, and adds a max age. This does
not add a check for the max-age, or remove old entries from the list.
Instead this just adds the data-field.

servo/servo#6105
2015-07-22 11:48:05 +12:00