OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/url_request/url_request_job.h" | 5 #include "net/url_request/url_request_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "net/filter/filter.h" | 21 #include "net/filter/filter.h" |
22 #include "net/http/http_response_headers.h" | 22 #include "net/http/http_response_headers.h" |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Callback for TYPE_URL_REQUEST_FILTERS_SET net-internals event. | 28 // Callback for TYPE_URL_REQUEST_FILTERS_SET net-internals event. |
29 base::Value* FiltersSetCallback(Filter* filter, | 29 base::Value* FiltersSetCallback(Filter* filter, |
30 NetLogCaptureMode /* capture_mode */) { | 30 NetLogCaptureMode /* capture_mode */) { |
31 base::DictionaryValue* event_params = new base::DictionaryValue(); | 31 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
32 event_params->SetString("filters", filter->OrderedFilterList()); | 32 event_params->SetString("filters", filter->OrderedFilterList()); |
33 return event_params; | 33 return event_params.release(); |
34 } | 34 } |
35 | 35 |
36 std::string ComputeMethodForRedirect(const std::string& method, | 36 std::string ComputeMethodForRedirect(const std::string& method, |
37 int http_status_code) { | 37 int http_status_code) { |
38 // For 303 redirects, all request methods except HEAD are converted to GET, | 38 // For 303 redirects, all request methods except HEAD are converted to GET, |
39 // as per the latest httpbis draft. The draft also allows POST requests to | 39 // as per the latest httpbis draft. The draft also allows POST requests to |
40 // be converted to GETs when following 301/302 redirects, for historical | 40 // be converted to GETs when following 301/302 redirects, for historical |
41 // reasons. Most major browsers do this and so shall we. Both RFC 2616 and | 41 // reasons. Most major browsers do this and so shall we. Both RFC 2616 and |
42 // the httpbis draft say to prompt the user to confirm the generation of new | 42 // the httpbis draft say to prompt the user to confirm the generation of new |
43 // requests, other than GET and HEAD requests, but IE omits these prompts and | 43 // requests, other than GET and HEAD requests, but IE omits these prompts and |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). | 861 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). |
862 redirect_info.new_referrer = | 862 redirect_info.new_referrer = |
863 ComputeReferrerForRedirect(request_->referrer_policy(), | 863 ComputeReferrerForRedirect(request_->referrer_policy(), |
864 request_->referrer(), | 864 request_->referrer(), |
865 redirect_info.new_url).spec(); | 865 redirect_info.new_url).spec(); |
866 | 866 |
867 return redirect_info; | 867 return redirect_info; |
868 } | 868 } |
869 | 869 |
870 } // namespace net | 870 } // namespace net |
OLD | NEW |