ObjFW  Diff

Differences From Artifact [e321453562]:

To Artifact [703332cbc9]:


116
117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139

140
141
142
143
144
145
146
147
116
117
118
119
120
121
122

123

124
125
126
127
128
129
130
131
132
133
134
135
136
137

138

139
140
141
142
143
144
145







-
+
-














-
+
-







	return self;
}

- (void)dealloc
{
	[_URL release];
	[_headers release];
	[_POSTData release];
	[_entity release];
	[_MIMEType release];
	[_remoteAddress release];

	[super dealloc];
}

- copy
{
	OFHTTPRequest *copy = [[OFHTTPRequest alloc] init];

	@try {
		copy->_method = _method;
		copy->_protocolVersion = _protocolVersion;
		[copy setURL: _URL];
		[copy setHeaders: _headers];
		[copy setPOSTData: _POSTData];
		[copy setEntity: _entity];
		[copy setMIMEType: _MIMEType];
		[copy setRemoteAddress: _remoteAddress];
	} @catch (id e) {
		[copy release];
		@throw e;
	}

	return copy;
157
158
159
160
161
162
163
164

165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183

184
185
186
187
188
189
190
191
155
156
157
158
159
160
161

162

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

180

181
182
183
184
185
186
187







-
+
-

















-
+
-







	request = object;

	if (request->_method != _method ||
	    request->_protocolVersion.major != _protocolVersion.major ||
	    request->_protocolVersion.minor != _protocolVersion.minor ||
	    ![request->_URL isEqual: _URL] ||
	    ![request->_headers isEqual: _headers] ||
	    ![request->_POSTData isEqual: _POSTData] ||
	    ![request->_entity isEqual: _entity] ||
	    ![request->_MIMEType isEqual: _MIMEType] ||
	    ![request->_remoteAddress isEqual: _remoteAddress])
		return false;

	return true;
}

- (uint32_t)hash
{
	uint32_t hash;

	OF_HASH_INIT(hash);

	OF_HASH_ADD(hash, _method);
	OF_HASH_ADD(hash, _protocolVersion.major);
	OF_HASH_ADD(hash, _protocolVersion.minor);
	OF_HASH_ADD_HASH(hash, [_URL hash]);
	OF_HASH_ADD_HASH(hash, [_headers hash]);
	OF_HASH_ADD_HASH(hash, [_POSTData hash]);
	OF_HASH_ADD_HASH(hash, [_entity hash]);
	OF_HASH_ADD_HASH(hash, [_MIMEType hash]);
	OF_HASH_ADD_HASH(hash, [_remoteAddress hash]);

	OF_HASH_FINALIZE(hash);

	return hash;
}

261
262
263
264
265
266
267
268

269
270

271
272
273

274
275

276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302

303
304
305
306
307

308
309
310
311
312
313
314
315

316
317
318
319
320


321
322
323
324
325
326
257
258
259
260
261
262
263

264
265

266
267
268

269
270

271










272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287

288
289
290
291
292

293
294
295
296
297
298
299
300

301

302
303


304
305
306
307
308
309
310
311







-
+

-
+


-
+

-
+
-
-
-
-
-
-
-
-
-
-
















-
+




-
+







-
+
-


-
-
+
+






}

- (OFDictionary*)headers
{
	OF_GETTER(_headers, true)
}

- (void)setPOSTData: (OFDataArray*)POSTData
- (void)setEntity: (OFDataArray*)entity
{
	OF_SETTER(_POSTData, POSTData, true, 0)
	OF_SETTER(_entity, entity, true, 0)
}

- (OFDataArray*)POSTData
- (OFDataArray*)entity
{
	OF_GETTER(_POSTData, true)
	OF_GETTER(_entity, true)
}

- (void)setMIMEType: (OFString*)MIMEType
{
	OF_SETTER(_MIMEType, MIMEType, true, 1)
}

- (OFString*)MIMEType
{
	OF_GETTER(_MIMEType, true)
}

- (void)setRemoteAddress: (OFString*)remoteAddress
{
	OF_SETTER(_remoteAddress, remoteAddress, true, 1)
}

- (OFString*)remoteAddress
{
	OF_GETTER(_remoteAddress, true)
}

- (OFString*)description
{
	void *pool = objc_autoreleasePoolPush();
	const char *method = of_http_request_method_to_string(_method);
	OFString *indentedHeaders, *indentedPOSTData, *ret;
	OFString *indentedHeaders, *indentedEntity, *ret;

	indentedHeaders = [[_headers description]
	    stringByReplacingOccurrencesOfString: @"\n"
				      withString: @"\n\t"];
	indentedPOSTData = [[_POSTData description]
	indentedEntity = [[_entity description]
	    stringByReplacingOccurrencesOfString: @"\n"
				      withString: @"\n\t"];

	ret = [[OFString alloc] initWithFormat:
	    @"<%@:\n\tURL = %@\n"
	    @"\tMethod = %s\n"
	    @"\tHeaders = %@\n"
	    @"\tPOST data = %@\n"
	    @"\tEntity = %@\n"
	    @"\tPOST data MIME type = %@\n"
	    @"\tRemote address = %@\n"
	    @">",
	    [self class], _URL, method, indentedHeaders, indentedPOSTData,
	    _MIMEType, _remoteAddress];
	    [self class], _URL, method, indentedHeaders, indentedEntity,
	    _remoteAddress];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}
@end