blob: 7b28481733a4fb892570bb1af174b84b76c40551 [file] [log] [blame]
Avi Drissmanea1be232022-09-14 23:29:061// Copyright 2012 The Chromium Authors
droger476922e02015-03-10 17:17:522// 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
10namespace base {
11class Time;
12} // namespace base
13
14namespace net {
15class URLRequest;
16} // namespace net
17
18namespace net {
19
David Benjaminc0ea9aa2018-04-28 00:21:4820// The error domain for network NSErrors.
21extern NSString* const kNSErrorDomain;
22
droger476922e02015-03-10 17:17:5223// 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.
27NSError* 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|.
33NSURLResponse* GetNSURLResponseForRequest(URLRequest* request);
34
35// Copy HTTP headers from |in_request| to |out_request|.
36void CopyHttpHeaders(NSURLRequest* in_request, URLRequest* out_request);
37
Sylvain Defresnecc2980bd2025-01-22 22:39:0438} // namespace net
droger476922e02015-03-10 17:17:5239
40#endif // IOS_NET_PROTOCOL_HANDLER_UTIL_H_