ObjFW  Check-in [b02b668f81]

Overview
Comment:Add -[request:didCreateSocket:] to OFHTTPRequestDelegate.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b02b668f810001a20fd2f7c157aa3927014ca776e0620ec0bf1f88dd8e4aef10
User & Date: js on 2011-12-13 15:01:22
Other Links: manifest | tags
Context
2011-12-21
19:40
Fix a bug that only happens with Clang + glibc + 64 bit. check-in: c944a32244 user: js tags: trunk
2011-12-13
15:01
Add -[request:didCreateSocket:] to OFHTTPRequestDelegate. check-in: b02b668f81 user: js tags: trunk
14:54
Add some sanity checks to -[OFXMLElement initWithSerialization:]. check-in: 9b5a35bd98 user: js tags: trunk
Changes

Modified src/OFHTTPRequest.h from [de1dce9f3b] to [4542ed27a0].

17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42














43
44
45
46
47
48
49
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64







+



















+
+
+
+
+
+
+
+
+
+
+
+
+
+







#import "OFObject.h"

@class OFString;
@class OFDictionary;
@class OFURL;
@class OFHTTPRequest;
@class OFHTTPRequestResult;
@class OFTCPSocket;
@class OFDataArray;

typedef enum of_http_request_type_t {
	OF_HTTP_REQUEST_TYPE_GET,
	OF_HTTP_REQUEST_TYPE_POST,
	OF_HTTP_REQUEST_TYPE_HEAD
} of_http_request_type_t;

/**
 * \brief A delegate for OFHTTPRequests.
 */
#ifndef OF_HTTP_REQUEST_M
@protocol OFHTTPRequestDelegate <OFObject>
#else
@protocol OFHTTPRequestDelegate
#endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional
#endif
/**
 * \brief A callback which is called when an OFHTTPRequest creates a socket.
 *
 * This is useful if the connection is using HTTPS and the server requires a
 * client certificate. This callback can then be used to tell the TLS socket
 * about the certificate. Another use case is to tell the socket about a SOCKS5
 * proxy it should use for this connection.
 *
 * \param request The OFHTTPRequest that created a socket
 * \param socket The socket created by the OFHTTPRequest
 */
-   (void)request: (OFHTTPRequest*)request
  didCreateSocket: (OFTCPSocket*)socket;

/**
 * \brief A callback which is called when an OFHTTPRequest received headers.
 *
 * \param request The OFHTTPRequest which received the headers
 * \param headers The headers received
 * \param statusCode The status code received
 */

Modified src/OFHTTPRequest.m from [58e168ad78] to [1e96eca6f0].

201
202
203
204
205
206
207



208
209
210
211
212
213
214
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217







+
+
+







			    exceptionWithClass: isa
					   URL: URL];

		sock = [[[of_http_request_tls_socket_class alloc] init]
		    autorelease];
	}

	[delegate request: self
	  didCreateSocket: sock];

	@try {
		OFString *line, *path;
		OFMutableDictionary *serverHeaders;
		OFDataArray *data;
		OFEnumerator *keyEnumerator, *objectEnumerator;
		OFString *key, *object, *contentLengthHeader;
		int status;
454
455
456
457
458
459
460





461
462
463
464
465
466
467
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475







+
+
+
+
+







- (OFDataArray*)data
{
	return [[data retain] autorelease];
}
@end

@implementation OFObject (OFHTTPRequestDelegate)
-   (void)request: (OFHTTPRequest*)request
  didCreateSocket: (OFTCPSocket*)socket
{
}

-     (void)request: (OFHTTPRequest*)request
  didReceiveHeaders: (OFDictionary*)headers
     withStatusCode: (int)statusCode
{
}

-  (void)request: (OFHTTPRequest*)request