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

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

Issue 11420013: POSTs to HSTS domains are no longer converted to GETs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix stuff Created 8 years, 1 month 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 | Annotate | Revision Log
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 "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "net/base/net_export.h" 9 #include "net/base/net_export.h"
10 #include "net/url_request/url_request_job.h" 10 #include "net/url_request/url_request_job.h"
11 11
12 class GURL; 12 class GURL;
13 13
14 namespace net { 14 namespace net {
15 15
16 // A URLRequestJob that will redirect the request to the specified 16 // A URLRequestJob that will redirect the request to the specified
17 // URL. This is useful to restart a request at a different URL based 17 // URL. This is useful to restart a request at a different URL based
18 // on the result of another job. 18 // on the result of another job.
19 class NET_EXPORT URLRequestRedirectJob : public URLRequestJob { 19 class NET_EXPORT URLRequestRedirectJob : public URLRequestJob {
20 public: 20 public:
21 // Valid status codes for the redirect job. Other 30x codes are theoretically 21 // Valid status codes for the redirect job. Other 30x codes are theoretically
22 // valid, but unused so far. 22 // valid, but unused so far. Both 302 and 307 are temporary redirects, with
23 // the difference being that 302 converts POSTs to GETs and removes upload
24 // data.
23 enum StatusCode { 25 enum StatusCode {
24 REDIRECT_302_FOUND = 302, 26 REDIRECT_302_FOUND = 302,
25 REDIRECT_307_TEMPORARY_REDIRECT = 307, 27 REDIRECT_307_TEMPORARY_REDIRECT = 307,
26 }; 28 };
27 29
28 // Constructs a job that redirects to the specified URL. 30 // Constructs a job that redirects to the specified URL.
29 URLRequestRedirectJob(URLRequest* request, 31 URLRequestRedirectJob(URLRequest* request,
30 NetworkDelegate* network_delegate, 32 NetworkDelegate* network_delegate,
31 const GURL& redirect_destination); 33 const GURL& redirect_destination,
32 34 StatusCode http_status_code);
33 // Change the HTTP status code to use for the redirect. Default is
34 // REDIRECT_302_FOUND.
35 void set_redirect_code(StatusCode code) {
36 http_status_code_ = static_cast<int>(code);
37 }
38 35
39 virtual void Start() OVERRIDE; 36 virtual void Start() OVERRIDE;
40 virtual bool IsRedirectResponse(GURL* location, 37 virtual bool IsRedirectResponse(GURL* location,
41 int* http_status_code) OVERRIDE; 38 int* http_status_code) OVERRIDE;
42 39
43 private: 40 private:
44 virtual ~URLRequestRedirectJob(); 41 virtual ~URLRequestRedirectJob();
45 42
46 void StartAsync(); 43 void StartAsync();
47 44
48 GURL redirect_destination_; 45 GURL redirect_destination_;
49 int http_status_code_; 46 int http_status_code_;
willchan no longer on Chromium 2012/11/17 21:43:08 Nit: Make these member variables const? Up to you,
mmenke 2012/11/19 16:00:35 Done - I agree.
50 47
51 base::WeakPtrFactory<URLRequestRedirectJob> weak_factory_; 48 base::WeakPtrFactory<URLRequestRedirectJob> weak_factory_;
52 }; 49 };
53 50
54 } // namespace net 51 } // namespace net
55 52
56 #endif // NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_ 53 #endif // NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698