OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/net/protocol_handler_util.h" | 5 #import "ios/net/protocol_handler_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/i18n/encoding_detection.h" | |
11 #include "base/i18n/icu_string_conversions.h" | |
12 #include "base/logging.h" | 10 #include "base/logging.h" |
13 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
14 #include "base/macros.h" | 12 #include "base/macros.h" |
15 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
16 #include "base/time/time.h" | 14 #include "base/time/time.h" |
17 #include "ios/net/crn_http_url_response.h" | 15 #include "ios/net/crn_http_url_response.h" |
18 #import "net/base/mac/url_conversions.h" | 16 #import "net/base/mac/url_conversions.h" |
19 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
20 #include "net/http/http_request_headers.h" | 18 #include "net/http/http_request_headers.h" |
21 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
22 #include "net/http/http_version.h" | 20 #include "net/http/http_version.h" |
23 #include "net/url_request/url_request.h" | 21 #include "net/url_request/url_request.h" |
24 #include "url/gurl.h" | 22 #include "url/gurl.h" |
25 #include "url/url_features.h" | 23 #include "url/url_features.h" |
26 | 24 |
| 25 #if !BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) |
| 26 #include "base/i18n/encoding_detection.h" // nogncheck |
| 27 #include "base/i18n/icu_string_conversions.h" // nogncheck |
| 28 #endif // !BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) |
| 29 |
27 namespace { | 30 namespace { |
28 | 31 |
29 // "Content-Type" HTTP header. | 32 // "Content-Type" HTTP header. |
30 NSString* const kContentType = @"Content-Type"; | 33 NSString* const kContentType = @"Content-Type"; |
31 | 34 |
32 } // namespace | 35 } // namespace |
33 | 36 |
34 namespace net { | 37 namespace net { |
35 | 38 |
36 NSError* GetIOSError(NSInteger ns_error_code, | 39 NSError* GetIOSError(NSInteger ns_error_code, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (out_request->has_upload() && out_request->method() == "POST") { | 213 if (out_request->has_upload() && out_request->method() == "POST") { |
211 DLOG_IF(WARNING, !net_headers.HasHeader(HttpRequestHeaders::kContentType)) | 214 DLOG_IF(WARNING, !net_headers.HasHeader(HttpRequestHeaders::kContentType)) |
212 << "Missing \"Content-Type\" header in POST request."; | 215 << "Missing \"Content-Type\" header in POST request."; |
213 net_headers.SetHeaderIfMissing(HttpRequestHeaders::kContentType, | 216 net_headers.SetHeaderIfMissing(HttpRequestHeaders::kContentType, |
214 "application/x-www-form-urlencoded"); | 217 "application/x-www-form-urlencoded"); |
215 } | 218 } |
216 out_request->SetExtraRequestHeaders(net_headers); | 219 out_request->SetExtraRequestHeaders(net_headers); |
217 } | 220 } |
218 | 221 |
219 } // namespace net | 222 } // namespace net |
OLD | NEW |