Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReferer header #10696
Referer header #10696
Conversation
highfive
commented
Apr 19, 2016
|
Heads up! This PR modifies the following files:
|
|
@jdm fyi on this PR. Also, merge conflicts, lame. I'll look into addressing. |
|
r? @jdm |
|
|
|
Want to point out - LoadData creation with referrer in components/msg/constellation_msg.rs is handled with a new_with_referrer() method. In components/net_traits/lib.rs, I edited the new() method to just add these 2 new fields in. I assume I should make them consistent, but wanted your opinion on which is better 1st. new_with_referrer means less changes to track down throughout the code, and you don't just have "None, None" thrown on the end most of the time you are creating. Editing new is maybe cleaner though, considering there may be future adds. Either way. |
|
Yeah, I'd prefer to stay with editing the As for these changes, great work! I'm a bit leery of the way we pass around URLs and strings in the main referrer determination algorithm, so I'd like to see what that looks like if we write it more like the specification algorithm and only deal in URLs instead. -S-awaiting-review +S-needs-code-changes Reviewed 3 of 15 files at r1, 12 of 12 files at r2, 6 of 6 files at r4. components/msg/constellation_msg.rs, line 420 [r4] (raw file): components/net/http_loader.rs, line 369 [r2] (raw file): components/net/http_loader.rs, line 370 [r2] (raw file): components/net/http_loader.rs, line 380 [r2] (raw file): components/net/http_loader.rs, line 381 [r2] (raw file): components/net/http_loader.rs, line 388 [r2] (raw file): components/net/http_loader.rs, line 391 [r2] (raw file): components/net/http_loader.rs, line 398 [r2] (raw file): components/net/http_loader.rs, line 401 [r2] (raw file): components/net/http_loader.rs, line 413 [r2] (raw file): components/net/http_loader.rs, line 416 [r2] (raw file): components/net/http_loader.rs, line 427 [r2] (raw file): components/net/http_loader.rs, line 412 [r4] (raw file): components/net_traits/lib.rs, line 90 [r2] (raw file): components/script/script_thread.rs, line 1886 [r2] (raw file): components/script/dom/document.rs, line 229 [r2] (raw file): components/script/dom/document.rs, line 1689 [r2] (raw file): components/script/dom/document.rs, line 1821 [r2] (raw file): components/script/dom/xmlhttprequest.rs, line 585 [r2] (raw file): tests/unit/net/http_loader.rs, line 1461 [r2] (raw file): tests/unit/net/http_loader.rs, line 1470 [r2] (raw file): fn assert_referer_header_matches(request_url: &str, referrer_url: &str, referrer_policy: Option<ReferrerPolicy>, expected_referrer: &str) {
// set up the URLs, create the LoadData, set the header value, call load
}Then we can either have a bunch of different #[test] functions that all delegate to that one, or just one that contains a bunch of tests. Comments from Reviewable |
|
|
|
Review status: all files reviewed at latest revision, 21 unresolved discussions, some commit checks failed. components/msg/constellation_msg.rs, line 420 [r4] (raw file): components/net/http_loader.rs, line 369 [r2] (raw file): components/net/http_loader.rs, line 381 [r2] (raw file): components/net/http_loader.rs, line 391 [r2] (raw file): components/net/http_loader.rs, line 398 [r2] (raw file): components/net/http_loader.rs, line 416 [r2] (raw file): components/net/http_loader.rs, line 427 [r2] (raw file): components/net/http_loader.rs, line 412 [r4] (raw file): components/script/script_thread.rs, line 1886 [r2] (raw file): components/script/dom/document.rs, line 229 [r2] (raw file): components/script/dom/document.rs, line 1689 [r2] (raw file): Comments from Reviewable |
|
FYI - code comments addressed. Test changes are still a todo. |
6c9f53c
to
b361838
|
Please re-review the strip_url method after the latest commit - looks like rust-url was updated, so that method is changed. Latest commit has that change and all comments to this point addressed. |
|
Looking great! Reviewed 11 of 15 files at r9, 4 of 4 files at r10. components/net/http_loader.rs, line 416 [r2] (raw file): components/net/http_loader.rs, line 369 [r10] (raw file): tests/unit/net/http_loader.rs, line 1565 [r10] (raw file): tests/unit/net/http_loader.rs, line 1575 [r10] (raw file): Comments from Reviewable |
|
Review status: all files reviewed at latest revision, 4 unresolved discussions. components/net/http_loader.rs, line 416 [r2] (raw file): components/net/http_loader.rs, line 369 [r10] (raw file): tests/unit/net/http_loader.rs, line 1565 [r10] (raw file): tests/unit/net/http_loader.rs, line 1575 [r10] (raw file): Comments from Reviewable |
|
A+ would review again. Go ahead and squash the commits into one! Reviewed 2 of 2 files at r11. Comments from Reviewable |
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
|
@bors-servo: r+ |
|
|
Referer header PR1 for #10311 This puts the code and data structures in place to set the Referer header based on the Referrer Policy for a given document. Note that document:: get_referrer_policy() always returns the 'No Referrer' option, so for now, this should have no impact on production code, and that policy requires that the Referer header is not added. Later PRs will determine the policy and edit that get_referrer_policy() accordingly. <!-- 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/10696) <!-- Reviewable:end -->
|
|
rebstar6 commentedApr 19, 2016
PR1 for #10311
This puts the code and data structures in place to set the Referer header based on the Referrer Policy for a given document. Note that document:: get_referrer_policy() always returns the 'No Referrer' option, so for now, this should have no impact on production code, and that policy requires that the Referer header is not added.
Later PRs will determine the policy and edit that get_referrer_policy() accordingly.
This change is