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

Side by Side Diff: net/url_request/url_request_redirect_job.h

Issue 348253002: Add CORS headers to URLRequestRedirectJob. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use a more efficient string concatenation method Created 6 years, 5 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_
6 #define NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/http/http_request_info.h"
12 #include "net/url_request/url_request_job.h" 13 #include "net/url_request/url_request_job.h"
13 14
14 class GURL; 15 class GURL;
15 16
16 namespace net { 17 namespace net {
17 18
18 // A URLRequestJob that will redirect the request to the specified 19 // A URLRequestJob that will redirect the request to the specified
19 // URL. This is useful to restart a request at a different URL based 20 // URL. This is useful to restart a request at a different URL based
20 // on the result of another job. 21 // on the result of another job.
Ryan Sleevi 2014/07/07 22:22:30 Because this (potentially) introduces security imp
21 class NET_EXPORT URLRequestRedirectJob : public URLRequestJob { 22 class NET_EXPORT URLRequestRedirectJob : public URLRequestJob {
22 public: 23 public:
23 // Valid status codes for the redirect job. Other 30x codes are theoretically 24 // Valid status codes for the redirect job. Other 30x codes are theoretically
24 // valid, but unused so far. Both 302 and 307 are temporary redirects, with 25 // valid, but unused so far. Both 302 and 307 are temporary redirects, with
25 // the difference being that 302 converts POSTs to GETs and removes upload 26 // the difference being that 302 converts POSTs to GETs and removes upload
26 // data. 27 // data.
27 enum StatusCode { 28 enum StatusCode {
28 REDIRECT_302_FOUND = 302, 29 REDIRECT_302_FOUND = 302,
29 REDIRECT_307_TEMPORARY_REDIRECT = 307, 30 REDIRECT_307_TEMPORARY_REDIRECT = 307,
30 }; 31 };
31 32
32 // Constructs a job that redirects to the specified URL. |redirect_reason| is 33 // Constructs a job that redirects to the specified URL. |redirect_reason| is
33 // logged for debugging purposes, and must not be an empty string. 34 // logged for debugging purposes, and must not be an empty string.
34 URLRequestRedirectJob(URLRequest* request, 35 URLRequestRedirectJob(URLRequest* request,
35 NetworkDelegate* network_delegate, 36 NetworkDelegate* network_delegate,
36 const GURL& redirect_destination, 37 const GURL& redirect_destination,
37 StatusCode http_status_code, 38 StatusCode http_status_code,
38 const std::string& redirect_reason); 39 const std::string& redirect_reason);
39 40
40 virtual void Start() OVERRIDE; 41 virtual void Start() OVERRIDE;
41 virtual bool IsRedirectResponse(GURL* location, 42 virtual bool IsRedirectResponse(GURL* location,
42 int* http_status_code) OVERRIDE; 43 int* http_status_code) OVERRIDE;
43 virtual bool CopyFragmentOnRedirect(const GURL& location) const OVERRIDE; 44 virtual bool CopyFragmentOnRedirect(const GURL& location) const OVERRIDE;
44 45 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE;
45 virtual void GetLoadTimingInfo( 46 virtual void GetLoadTimingInfo(
46 LoadTimingInfo* load_timing_info) const OVERRIDE; 47 LoadTimingInfo* load_timing_info) const OVERRIDE;
47 48
48 private: 49 private:
49 virtual ~URLRequestRedirectJob(); 50 virtual ~URLRequestRedirectJob();
50 51
51 void StartAsync(); 52 void StartAsync();
52 53
53 const GURL redirect_destination_; 54 const GURL redirect_destination_;
54 const int http_status_code_; 55 const int http_status_code_;
55 base::TimeTicks receive_headers_end_; 56 base::TimeTicks receive_headers_end_;
56 std::string redirect_reason_; 57 std::string redirect_reason_;
57 58
58 base::WeakPtrFactory<URLRequestRedirectJob> weak_factory_; 59 base::WeakPtrFactory<URLRequestRedirectJob> weak_factory_;
59 }; 60 };
60 61
61 } // namespace net 62 } // namespace net
62 63
63 #endif // NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_ 64 #endif // NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest/test_blocking.js ('k') | net/url_request/url_request_redirect_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698