Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: content/browser/net/insecure_request_interceptor.h

Issue 2053693002: WIP: Move 'Upgrade-Insecure-Requests' to the browser process. Base URL: https://chromium.googlesource.com/chromium/src.git@replicate
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_NET_INSECURE_REQUEST_INTERCEPTOR_H_
6 #define CONTENT_BROWSER_NET_INSECURE_REQUEST_INTERCEPTOR_H_
7
8 #include <stdint.h>
9
10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h"
12 #include "content/common/content_export.h"
13 #include "net/url_request/url_request_interceptor.h"
14
15 class GURL;
16
17 namespace net {
18 class URLRequest;
19 class NetworkDelegate;
20 }
21
22 namespace content {
23 // An interceptor which implements 'upgrade-insecure-requests' by grabbing
24 // insecure
25 // requests which ought to be upgraded, and redirecting them to secure variants.
26 //
27 // https://w3c.github.io/webappsec-upgrade-insecure-requests/
28 class CONTENT_EXPORT InsecureRequestInterceptor
29 : public net::URLRequestInterceptor {
30 public:
31 InsecureRequestInterceptor();
32 ~InsecureRequestInterceptor() override;
33
34 protected:
35 // Override from net::URLRequestInterceptor:
36 net::URLRequestJob* MaybeInterceptRequest(
37 net::URLRequest* request,
38 net::NetworkDelegate* delegate) const override;
39 net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request,
40 net::NetworkDelegate* delegate,
41 const GURL& url) const override;
42
43 private:
44 FRIEND_TEST_ALL_PREFIXES(InsecureRequestInterceptorTest,
45 UpgradeInsecureRequest);
46 FRIEND_TEST_ALL_PREFIXES(InsecureRequestInterceptorTest,
47 UpgradeSecureRequest);
48 FRIEND_TEST_ALL_PREFIXES(InsecureRequestInterceptorTest,
49 UpgradeInsecureRedirect);
50 FRIEND_TEST_ALL_PREFIXES(InsecureRequestInterceptorTest,
51 UpgradeSecureRedirect);
52
53 // Returns a 'net::URLRequestRedirectJob' to the new, secure URL if the
54 // request should be upgraded, and 'nullptr' otherwise.
55 static net::URLRequestJob* MaybeUpgradeRequest(net::URLRequest* request,
56 net::NetworkDelegate* delegate,
57 const GURL& url);
58
59 DISALLOW_COPY_AND_ASSIGN(InsecureRequestInterceptor);
60 };
61
62 } // namespace content
63
64 #endif // CONTENT_BROWSER_NET_INSECURE_REQUEST_INTERCEPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698