1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
|
|
1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
@throw [OFInvalidArgumentException exception];
}
@implementation OFHTTPRequest
@synthesize URL = _URL, method = _method, headers = _headers;
+ (instancetype)request
{
return [[[self alloc] init] autorelease];
}
+ (instancetype)requestWithURL: (OFURL *)URL
{
return [[[self alloc] initWithURL: URL] autorelease];
}
- (instancetype)init
{
self = [super init];
_method = OFHTTPRequestMethodGet;
_protocolVersion.major = 1;
_protocolVersion.minor = 1;
return self;
}
- (instancetype)initWithURL: (OFURL *)URL
{
self = [self init];
@try {
_URL = [URL copy];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_URL release];
[_headers release];
[super dealloc];
|
<
<
<
<
<
|
>
>
|
|
|
<
<
<
<
<
<
<
<
<
<
>
>
>
>
>
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
@throw [OFInvalidArgumentException exception];
}
@implementation OFHTTPRequest
@synthesize URL = _URL, method = _method, headers = _headers;
+ (instancetype)requestWithURL: (OFURL *)URL
{
return [[[self alloc] initWithURL: URL] autorelease];
}
- (instancetype)initWithURL: (OFURL *)URL
{
self = [super init];
@try {
_URL = [URL copy];
_method = OFHTTPRequestMethodGet;
_protocolVersion.major = 1;
_protocolVersion.minor = 1;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (void)dealloc
{
[_URL release];
[_headers release];
[super dealloc];
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
return &_remoteAddress;
return NULL;
}
- (id)copy
{
OFHTTPRequest *copy = [[OFHTTPRequest alloc] init];
@try {
copy->_method = _method;
copy->_protocolVersion = _protocolVersion;
copy.URL = _URL;
copy.headers = _headers;
copy.remoteAddress = self.remoteAddress;
} @catch (id e) {
[copy release];
@throw e;
}
|
|
<
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
return &_remoteAddress;
return NULL;
}
- (id)copy
{
OFHTTPRequest *copy = [[OFHTTPRequest alloc] initWithURL: _URL];
@try {
copy->_method = _method;
copy->_protocolVersion = _protocolVersion;
copy.headers = _headers;
copy.remoteAddress = self.remoteAddress;
} @catch (id e) {
[copy release];
@throw e;
}
|