ObjFW  Check-in [41480893fc]

Overview
Comment:Small conformance fix for OFHTTPServer + OFURL.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 41480893fc0aa7f7abb9f8c91ade1799e9eaeb326fd7b8424c4a285e0ef4d9e9
User & Date: js on 2012-12-12 18:57:22
Other Links: manifest | tags
Context
2012-12-12
22:02
OFSet: Add a few new methods to create new sets. check-in: 12fef9798a user: js tags: trunk
18:57
Small conformance fix for OFHTTPServer + OFURL. check-in: 41480893fc user: js tags: trunk
18:40
Coding style. check-in: 6ad5d3d8d6 user: js tags: trunk
Changes

Modified src/OFHTTPServer.m from [0de4511755] to [2f6eab66c7].

286
287
288
289
290
291
292
293
294
295
296
297

298
299
300
301
302
303
304
		requestType = OF_HTTP_REQUEST_TYPE_POST;
	else if ([type isEqual: @"HEAD"])
		requestType = OF_HTTP_REQUEST_TYPE_HEAD;
	else
		return [self sendErrorAndClose: 501];

	@try {
		path = [[line substringWithRange:
		    of_range(pos + 1, [line length] - pos - 10)] retain];
	} @catch (OFOutOfRangeException *e) {
		return [self sendErrorAndClose: 400];
	}


	if (![path hasPrefix: @"/"])
		return [self sendErrorAndClose: 400];

	headers = [[OFMutableDictionary alloc] init];
	state = PARSING_HEADERS;








|
|



>







286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
		requestType = OF_HTTP_REQUEST_TYPE_POST;
	else if ([type isEqual: @"HEAD"])
		requestType = OF_HTTP_REQUEST_TYPE_HEAD;
	else
		return [self sendErrorAndClose: 501];

	@try {
		path = [line substringWithRange:
		    of_range(pos + 1, [line length] - pos - 10)];
	} @catch (OFOutOfRangeException *e) {
		return [self sendErrorAndClose: 400];
	}
	path = [[path stringByDeletingEnclosingWhitespaces] retain];

	if (![path hasPrefix: @"/"])
		return [self sendErrorAndClose: 400];

	headers = [[OFMutableDictionary alloc] init];
	state = PARSING_HEADERS;

Modified src/OFURL.m from [3b200a0eea] to [f5ee6d65c8].

166
167
168
169
170
171
172



173
174
175
176
177
178
179
			portString = [OFString stringWithUTF8String: tmp2];

			if ([portString decimalValue] > 65535)
				@throw [OFInvalidFormatException
				    exceptionWithClass: [self class]];

			port = [portString decimalValue];




			objc_autoreleasePoolPop(pool);
		} else {
			host = [[OFString alloc]
			    initWithUTF8String: UTF8String];

			if ([scheme isEqual: @"http"])







>
>
>







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
			portString = [OFString stringWithUTF8String: tmp2];

			if ([portString decimalValue] > 65535)
				@throw [OFInvalidFormatException
				    exceptionWithClass: [self class]];

			port = [portString decimalValue];

			if (port == 0)
				port = 80;

			objc_autoreleasePoolPop(pool);
		} else {
			host = [[OFString alloc]
			    initWithUTF8String: UTF8String];

			if ([scheme isEqual: @"http"])