OLD | NEW |
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 "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
13 #include "net/http/http_response_info.h" | 13 #include "net/http/http_response_info.h" |
14 #include "net/url_request/url_request_job.h" | 14 #include "net/url_request/url_request_job.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 // A URLRequestJob that will redirect the request to the specified | 20 // A URLRequestJob that will redirect the request to the specified URL. This is |
21 // URL. This is useful to restart a request at a different URL based | 21 // useful to restart a request at a different URL based on the result of another |
22 // on the result of another job. | 22 // job. The redirect URL could be visible to scripts if the redirect points to |
| 23 // a same-origin URL, or if the redirection target is served with CORS response |
| 24 // headers. |
23 class NET_EXPORT URLRequestRedirectJob : public URLRequestJob { | 25 class NET_EXPORT URLRequestRedirectJob : public URLRequestJob { |
24 public: | 26 public: |
25 // Valid status codes for the redirect job. Other 30x codes are theoretically | 27 // Valid status codes for the redirect job. Other 30x codes are theoretically |
26 // valid, but unused so far. Both 302 and 307 are temporary redirects, with | 28 // valid, but unused so far. Both 302 and 307 are temporary redirects, with |
27 // the difference being that 302 converts POSTs to GETs and removes upload | 29 // the difference being that 302 converts POSTs to GETs and removes upload |
28 // data. | 30 // data. |
29 enum ResponseCode { | 31 enum ResponseCode { |
30 REDIRECT_302_FOUND = 302, | 32 REDIRECT_302_FOUND = 302, |
31 REDIRECT_307_TEMPORARY_REDIRECT = 307, | 33 REDIRECT_307_TEMPORARY_REDIRECT = 307, |
32 }; | 34 }; |
(...skipping 26 matching lines...) Expand all Loading... |
59 std::string redirect_reason_; | 61 std::string redirect_reason_; |
60 | 62 |
61 scoped_refptr<HttpResponseHeaders> fake_headers_; | 63 scoped_refptr<HttpResponseHeaders> fake_headers_; |
62 | 64 |
63 base::WeakPtrFactory<URLRequestRedirectJob> weak_factory_; | 65 base::WeakPtrFactory<URLRequestRedirectJob> weak_factory_; |
64 }; | 66 }; |
65 | 67 |
66 } // namespace net | 68 } // namespace net |
67 | 69 |
68 #endif // NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_ | 70 #endif // NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_ |
OLD | NEW |