Chromium Code Reviews| Index: net/url_request/url_request.h |
| diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h |
| index 61174192c89e6eb1cd5faa54b39f5871e2ea014b..4441b26c8e5efa0ed8a070dbd63392d9048734af 100644 |
| --- a/net/url_request/url_request.h |
| +++ b/net/url_request/url_request.h |
| @@ -94,14 +94,21 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), |
| // referrer header might be cleared, if the protocol changes from HTTPS to |
| // HTTP. This is the default behavior of URLRequest, corresponding to |
| // CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE. Alternatively, the |
| - // referrer policy can be set to never change the referrer header. This |
| - // behavior corresponds to NEVER_CLEAR_REFERRER. Embedders will want to use |
| - // NEVER_CLEAR_REFERRER when implementing the meta-referrer support |
| - // (http://wiki.whatwg.org/wiki/Meta_referrer) and sending requests with a |
| - // non-default referrer policy. Only the default referrer policy requires |
| - // the referrer to be cleared on transitions from HTTPS to HTTP. |
| + // referrer policy can be set to strip the referrer down to an origin upon |
| + // cross-origin navigation (ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN), or |
| + // never change the referrer header (NEVER_CLEAR_REFERRER). Embedders will |
| + // want to use these options when implementing referrer policy support |
| + // (https://w3c.github.io/webappsec/specs/referrer-policy/). |
| + // |
| + // REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN is a slight variant |
| + // on CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE: if the request is |
| + // redirected cross-origin, but does not degrade to an insecure connection, |
| + // the referrer will be delivered with reduced granularity (e.g. an origin |
| + // rather than a full URL). |
|
mmenke
2014/11/19 16:29:03
I don't think your last paragraph makes it suffici
Mike West
2014/11/20 10:45:30
Attempted to clarify. WDYT?
|
| enum ReferrerPolicy { |
| CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, |
| + REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN, |
| + ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN, |
| NEVER_CLEAR_REFERRER, |
| }; |
| @@ -294,6 +301,11 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), |
| const std::string& referrer() const { return referrer_; } |
| // Referrer is sanitized to remove URL fragment, user name and password. |
| void SetReferrer(const std::string& referrer); |
| + // Returns true if the referrer is invalid for this request, given its |
| + // referrer policy. This could mean that a secure referrer is set for a |
| + // request which should have dropped it, or that a full referrer url is set |
| + // for a request which should have trimmed it to an origin. |
| + bool IsReferrerInvalid() const; |
| // The referrer policy to apply when updating the referrer during redirects. |
| // The referrer policy may only be changed before Start() is called. |