ObjFW  Diff

Differences From Artifact [269e3a7f9d]:

To Artifact [b25900c5f7]:


231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
		[self of_sendHeaders];

	if (!_chunked)
		return [_socket writeBuffer: buffer
				     length: length];

	pool = objc_autoreleasePoolPush();
	[_socket writeString: [OFString stringWithFormat: @"%zx\r\n", length]];
	objc_autoreleasePoolPop(pool);

	[_socket writeBuffer: buffer
		      length: length];
	[_socket writeBuffer: "\r\n"
		      length: 2];

	return length;
}

- (void)close
{
	if (_socket == nil)







|




|
<







231
232
233
234
235
236
237
238
239
240
241
242
243

244
245
246
247
248
249
250
		[self of_sendHeaders];

	if (!_chunked)
		return [_socket writeBuffer: buffer
				     length: length];

	pool = objc_autoreleasePoolPush();
	[_socket writeString: [OFString stringWithFormat: @"%zX\r\n", length]];
	objc_autoreleasePoolPop(pool);

	[_socket writeBuffer: buffer
		      length: length];
	[_socket writeString: @"\r\n"];


	return length;
}

- (void)close
{
	if (_socket == nil)
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
		range = [line rangeOfString: @";"];
		if (range.location != OF_NOT_FOUND)
			line = [line substringWithRange:
			    of_range(0, range.location)];

		if (line.length < 1) {
			/*
			 * We read the empty string because the socket is at
			 * end of stream.
			 */
			if (_socket.atEndOfStream &&
			    range.location == OF_NOT_FOUND)
				@throw [OFTruncatedDataException exception];
			else
				@throw [OFInvalidFormatException exception];
		}







|
|







705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
		range = [line rangeOfString: @";"];
		if (range.location != OF_NOT_FOUND)
			line = [line substringWithRange:
			    of_range(0, range.location)];

		if (line.length < 1) {
			/*
			 * We have read the empty string because the socket is
			 * at end of stream.
			 */
			if (_socket.atEndOfStream &&
			    range.location == OF_NOT_FOUND)
				@throw [OFTruncatedDataException exception];
			else
				@throw [OFInvalidFormatException exception];
		}