ObjFW  Check-in [112085f4bc]

Overview
Comment:OFHTTPClient: Make sure requestString stays around
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 112085f4bca412bb6deec9e005b2561233ecebf89eb47a49b9ffb1beaef7b293
User & Date: js on 2017-09-24 15:57:15
Other Links: manifest | tags
Context
2017-09-24
16:34
Minor documentation fix check-in: a0394db776 user: js tags: trunk
15:57
OFHTTPClient: Make sure requestString stays around check-in: 112085f4bc user: js tags: trunk
15:42
OFRunLoop: Move #ifdef to the right place check-in: 1e3159ac95 user: js tags: trunk
Changes

Modified src/OFHTTPClient.m from [4e36f61b7a] to [bea7b309df].

584
585
586
587
588
589
590




591
592
593
594
595
596
597
598
599
600
601
602
603
	 */

	@try {
		OFString *requestString = constructRequestString(_request);
		const char *UTF8String = [requestString UTF8String];
		size_t UTF8StringLength = [requestString UTF8StringLength];





		[socket asyncWriteBuffer: UTF8String
				  length: UTF8StringLength
				  target: self
				selector: @selector(socket:didWriteRequest:
					      length:context:exception:)
				 context: nil];
	} @catch (id e) {
		[_client->_delegate client: _client
		     didEncounterException: e
				forRequest: _request];
		return;
	}
}







>
>
>
>





|







584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
	 */

	@try {
		OFString *requestString = constructRequestString(_request);
		const char *UTF8String = [requestString UTF8String];
		size_t UTF8StringLength = [requestString UTF8StringLength];

		/*
		 * Pass requestString as context to retain it so that the
		 * underlying buffer lives long enough.
		 */
		[socket asyncWriteBuffer: UTF8String
				  length: UTF8StringLength
				  target: self
				selector: @selector(socket:didWriteRequest:
					      length:context:exception:)
				 context: requestString];
	} @catch (id e) {
		[_client->_delegate client: _client
		     didEncounterException: e
				forRequest: _request];
		return;
	}
}