ObjFW  Check-in [d3d4d34dad]

Overview
Comment:OFHTTPClient: Add request performed callback

This is in preparation for making OFHTTPClient asynchronous.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d3d4d34dad257e0b2539fd2616d00982556c77dac0e6ad39aa02b6aa2f7f7cd7
User & Date: js on 2017-09-23 19:02:10
Other Links: manifest | tags
Context
2017-09-23
20:35
ofhttp: Refactor for asynchronous OFHTTPClient check-in: c26c8ca746 user: js tags: trunk
19:02
OFHTTPClient: Add request performed callback check-in: d3d4d34dad user: js tags: trunk
18:43
OFHTTPClient: Factor out server header handling check-in: 845273bf5d user: js tags: trunk
Changes

Modified src/OFHTTPClient.h from [45c3b5270f] to [b02049e5b7].

91
92
93
94
95
96
97











98
99
100
101
102
103
104
 * @return A boolean whether the OFHTTPClient should follow the redirect
 */
-	  (bool)client: (OFHTTPClient *)client
  shouldFollowRedirect: (OFURL *)URL
	    statusCode: (int)statusCode
	       request: (OFHTTPRequest *)request
	      response: (OFHTTPResponse *)response;











@end

/*!
 * @class OFHTTPClient OFHTTPClient.h ObjFW/OFHTTPClient.h
 *
 * @brief A class for performing HTTP requests.
 */







>
>
>
>
>
>
>
>
>
>
>







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
 * @return A boolean whether the OFHTTPClient should follow the redirect
 */
-	  (bool)client: (OFHTTPClient *)client
  shouldFollowRedirect: (OFURL *)URL
	    statusCode: (int)statusCode
	       request: (OFHTTPRequest *)request
	      response: (OFHTTPResponse *)response;

/*!
 * @brief A callback which is called when an OFHTTPClient performed a request.
 *
 * @param client The OFHTTPClient which performed the request
 * @param request The request the OFHTTPClient performed
 * @param response The response to the request performed
 */
-      (void)client: (OFHTTPClient *)client
  didPerformRequest: (OFHTTPRequest *)request
	   response: (OFHTTPResponse *)response;
@end

/*!
 * @class OFHTTPClient OFHTTPClient.h ObjFW/OFHTTPClient.h
 *
 * @brief A class for performing HTTP requests.
 */

Modified src/OFHTTPClient.m from [1f63af9bb9] to [aa3131b9d1].

729
730
731
732
733
734
735






736
737
738
739
740
741
742
	objc_autoreleasePoolPop(pool);
	[response autorelease];

	if (status / 100 != 2)
		@throw [OFHTTPRequestFailedException
		    exceptionWithRequest: request
				response: response];







	return response;
}

- (void)close
{
	[_socket close];







>
>
>
>
>
>







729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
	objc_autoreleasePoolPop(pool);
	[response autorelease];

	if (status / 100 != 2)
		@throw [OFHTTPRequestFailedException
		    exceptionWithRequest: request
				response: response];

	if ([_delegate respondsToSelector: @selector(client:didPerformRequest:
					       response:)])
		[_delegate     client: self
		    didPerformRequest: request
			     response: response];

	return response;
}

- (void)close
{
	[_socket close];