ObjFW  Check-in [e2877b3d28]

Overview
Comment:Coding style.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e2877b3d2837a28c6ab97fff7d3b0527915e9f9aee7e88fd56808c70771cd12b
User & Date: js on 2012-12-11 11:54:55
Other Links: manifest | tags
Context
2012-12-11
12:12
Make creating OFHTTPRequestResults public. check-in: 020cedb44b user: js tags: trunk
11:54
Coding style. check-in: e2877b3d28 user: js tags: trunk
2012-12-09
12:33
OFHTTPClient: Don't depend on OFString internals. check-in: 6888885299 user: js tags: trunk
Changes

Modified src/OFHTTPClient.m from [c9133990ba] to [f50e1c393f].

41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55







-
+








#import "autorelease.h"
#import "macros.h"

Class of_http_client_tls_socket_class = Nil;

static OF_INLINE void
normalizeKey(char *str)
normalize_key(char *str)
{
	BOOL firstLetter = YES;

	while (*str != '\0') {
		if (!isalnum(*str)) {
			firstLetter = YES;
			str++;
243
244
245
246
247
248
249
250
251


252
253
254
255
256
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
243
244
245
246
247
248
249


250
251
252
253
254
255
256
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







-
-
+
+















-
+

-
+



-
+


-
+

-
-
-
+
+
+


-
+


-
+








	status = (int)[[line substringWithRange: of_range(9, 3)] decimalValue];

	serverHeaders = [OFMutableDictionary dictionary];

	for (;;) {
		OFString *key, *value;
		const char *line_c, *tmp;
		char *key_c;
		const char *lineC, *tmp;
		char *keyC;

		@try {
			line = [sock readLine];
		} @catch (OFInvalidEncodingException *e) {
			@throw [OFInvalidServerReplyException
			    exceptionWithClass: [self class]];
		}

		if (line == nil)
			@throw [OFInvalidServerReplyException
			    exceptionWithClass: [self class]];

		if ([line isEqual: @""])
			break;

		line_c = [line UTF8String];
		lineC = [line UTF8String];

		if ((tmp = strchr(line_c, ':')) == NULL)
		if ((tmp = strchr(lineC, ':')) == NULL)
			@throw [OFInvalidServerReplyException
			    exceptionWithClass: [self class]];

		if ((key_c = malloc(tmp - line_c + 1)) == NULL)
		if ((keyC = malloc(tmp - lineC + 1)) == NULL)
			@throw [OFOutOfMemoryException
			    exceptionWithClass: [self class]
				 requestedSize: tmp - line_c + 1];
				 requestedSize: tmp - lineC + 1];

		memcpy(key_c, line_c, tmp - line_c);
		key_c[tmp - line_c] = '\0';
		normalizeKey(key_c);
		memcpy(keyC, lineC, tmp - lineC);
		keyC[tmp - lineC] = '\0';
		normalize_key(keyC);

		@try {
			key = [OFString stringWithUTF8StringNoCopy: key_c
			key = [OFString stringWithUTF8StringNoCopy: keyC
						      freeWhenDone: YES];
		} @catch (id e) {
			free(key_c);
			free(keyC);
		}

		do {
			tmp++;
		} while (*tmp == ' ');

		value = [OFString stringWithUTF8String: tmp];