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" |
11 #include "base/profiler/scoped_tracker.h" | 11 #include "base/profiler/scoped_tracker.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "net/base/auth.h" | 15 #include "net/base/auth.h" |
16 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
18 #include "net/base/load_states.h" | 18 #include "net/base/load_states.h" |
19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
20 #include "net/base/network_delegate.h" | 20 #include "net/base/network_delegate.h" |
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 scoped_ptr<base::Value> FiltersSetCallback( |
30 NetLogCaptureMode /* capture_mode */) { | 30 Filter* filter, |
| 31 NetLogCaptureMode /* capture_mode */) { |
31 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); | 32 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
32 event_params->SetString("filters", filter->OrderedFilterList()); | 33 event_params->SetString("filters", filter->OrderedFilterList()); |
33 return event_params.release(); | 34 return event_params.Pass(); |
34 } | 35 } |
35 | 36 |
36 std::string ComputeMethodForRedirect(const std::string& method, | 37 std::string ComputeMethodForRedirect(const std::string& method, |
37 int http_status_code) { | 38 int http_status_code) { |
38 // For 303 redirects, all request methods except HEAD are converted to GET, | 39 // 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 | 40 // 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 | 41 // 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 | 42 // 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 | 43 // 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 | 44 // requests, other than GET and HEAD requests, but IE omits these prompts and |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). | 866 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). |
866 redirect_info.new_referrer = | 867 redirect_info.new_referrer = |
867 ComputeReferrerForRedirect(request_->referrer_policy(), | 868 ComputeReferrerForRedirect(request_->referrer_policy(), |
868 request_->referrer(), | 869 request_->referrer(), |
869 redirect_info.new_url).spec(); | 870 redirect_info.new_url).spec(); |
870 | 871 |
871 return redirect_info; | 872 return redirect_info; |
872 } | 873 } |
873 | 874 |
874 } // namespace net | 875 } // namespace net |
OLD | NEW |