Avi Drissman | ea1be23 | 2022-09-14 23:29:06 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
droger | 476922e0 | 2015-03-10 17:17:52 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef IOS_NET_PROTOCOL_HANDLER_UTIL_H_ |
| 6 | #define IOS_NET_PROTOCOL_HANDLER_UTIL_H_ |
| 7 | |
| 8 | #import <Foundation/Foundation.h> |
| 9 | |
| 10 | namespace base { |
| 11 | class Time; |
| 12 | } // namespace base |
| 13 | |
| 14 | namespace net { |
| 15 | class URLRequest; |
| 16 | } // namespace net |
| 17 | |
| 18 | namespace net { |
| 19 | |
David Benjamin | c0ea9aa | 2018-04-28 00:21:48 | [diff] [blame] | 20 | // The error domain for network NSErrors. |
| 21 | extern NSString* const kNSErrorDomain; |
| 22 | |
droger | 476922e0 | 2015-03-10 17:17:52 | [diff] [blame] | 23 | // Creates a network NSError. |ns_error_code| is the iOS error code, |
| 24 | // |net_error_code| is the network error from net/base/net_error_list.h. |
| 25 | // |creation_time| is the time when the failing request was started and must be |
| 26 | // valid. |
| 27 | NSError* GetIOSError(NSInteger ns_error_code, |
| 28 | int net_error_code, |
| 29 | NSString* url, |
| 30 | const base::Time& creation_time); |
| 31 | |
| 32 | // Builds a NSURLResponse from the response data in |request|. |
| 33 | NSURLResponse* GetNSURLResponseForRequest(URLRequest* request); |
| 34 | |
| 35 | // Copy HTTP headers from |in_request| to |out_request|. |
| 36 | void CopyHttpHeaders(NSURLRequest* in_request, URLRequest* out_request); |
| 37 | |
Sylvain Defresne | cc2980bd | 2025-01-22 22:39:04 | [diff] [blame] | 38 | } // namespace net |
droger | 476922e0 | 2015-03-10 17:17:52 | [diff] [blame] | 39 | |
| 40 | #endif // IOS_NET_PROTOCOL_HANDLER_UTIL_H_ |