ObjFW  Diff

Differences From Artifact [79b7aacf76]:

  • File src/OFHTTPServer.m — part of check-in [13ee56edf3] at 2014-06-21 21:43:43 on branch trunk — Move all macros from OFObject.h to macros.h

    This means that OFObject.h imports macros.h now, making it unnecessary
    to manually import macros.h in almost every file. And while at it, also
    import autorelease.h in OFObject.h, so that this doesn't need to be
    manually imported in almost every file as well. (user: js, size: 15354) [annotate] [blame] [check-ins using]

To Artifact [3efdaebeee]:


381
382
383
384
385
386
387

388
389
390
391
392
393
394

	abort();
}

- (bool)parseProlog: (OFString*)line
{
	OFString *method;

	size_t pos;

	@try {
		OFString *version = [line
		    substringWithRange: of_range([line length] - 9, 9)];
		of_unichar_t tmp;








>







381
382
383
384
385
386
387
388
389
390
391
392
393
394
395

	abort();
}

- (bool)parseProlog: (OFString*)line
{
	OFString *method;
	OFMutableString *path;
	size_t pos;

	@try {
		OFString *version = [line
		    substringWithRange: of_range([line length] - 9, 9)];
		of_unichar_t tmp;

413
414
415
416
417
418
419


420
421
422
423
424

425
426
427
428
429



430

431
432
433
434
435
436
437
		_method = of_http_request_method_from_string(
		    [method UTF8String]);
	} @catch (OFInvalidFormatException *e) {
		return [self sendErrorAndClose: 405];
	}

	@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;

	return true;
}

- (bool)parseHeaders: (OFString*)line
{







>
>
|
|



>
|

|


>
>
>

>







414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
		_method = of_http_request_method_from_string(
		    [method UTF8String]);
	} @catch (OFInvalidFormatException *e) {
		return [self sendErrorAndClose: 405];
	}

	@try {
		of_range_t range = of_range(pos + 1, [line length] - pos - 10);

		path = [[[line substringWithRange:
		    range] mutableCopy] autorelease];
	} @catch (OFOutOfRangeException *e) {
		return [self sendErrorAndClose: 400];
	}

	[path deleteEnclosingWhitespaces];

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

	[path deleteCharactersInRange: of_range(0, 1)];
	[path makeImmutable];

	_headers = [[OFMutableDictionary alloc] init];
	_path = [path copy];
	_state = PARSING_HEADERS;

	return true;
}

- (bool)parseHeaders: (OFString*)line
{