ObjFW  Diff

Differences From Artifact [b25900c5f7]:

To Artifact [0402f29968]:


411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
		bool chunked = [[_headers objectForKey: @"Transfer-Encoding"]
		    isEqual: @"chunked"];
		OFString *contentLengthString =
		    [_headers objectForKey: @"Content-Length"];
		intmax_t contentLength = 0;

		if (contentLengthString != nil) {
			if (chunked)
				return [self sendErrorAndClose: 400];

			@try {
				contentLength =
				    contentLengthString.decimalValue;
			} @catch (OFInvalidFormatException *e) {
				return [self sendErrorAndClose: 400];







|







411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
		bool chunked = [[_headers objectForKey: @"Transfer-Encoding"]
		    isEqual: @"chunked"];
		OFString *contentLengthString =
		    [_headers objectForKey: @"Content-Length"];
		intmax_t contentLength = 0;

		if (contentLengthString != nil) {
			if (chunked || contentLengthString.length == 0)
				return [self sendErrorAndClose: 400];

			@try {
				contentLength =
				    contentLengthString.decimalValue;
			} @catch (OFInvalidFormatException *e) {
				return [self sendErrorAndClose: 400];
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
			if (_socket.atEndOfStream &&
			    range.location == OF_NOT_FOUND)
				@throw [OFTruncatedDataException exception];
			else
				@throw [OFInvalidFormatException exception];
		}

		_toRead = line.hexadecimalValue;
		if (_toRead < 0)
			@throw [OFOutOfRangeException exception];

		if (_toRead == 0) {
			_setAtEndOfStream = true;
			_toRead = -2;
		}








|
<







715
716
717
718
719
720
721
722

723
724
725
726
727
728
729
			if (_socket.atEndOfStream &&
			    range.location == OF_NOT_FOUND)
				@throw [OFTruncatedDataException exception];
			else
				@throw [OFInvalidFormatException exception];
		}

		if ((_toRead = line.hexadecimalValue) < 0)

			@throw [OFOutOfRangeException exception];

		if (_toRead == 0) {
			_setAtEndOfStream = true;
			_toRead = -2;
		}