Conforms to NSObject
Declared in CURLHandle.h

Overview

Protocol that should be implemented by delegates of CURLHandle.

Tasks

Instance Methods

handle:didFailWithError:

Optional method, called when the handle has failed.

- (void)handle:(CURLHandle *)handle didFailWithError:(NSError *)error

Parameters

handle

The handle that has failed.

error

The error that it failed with.

Discussion

Where possible errors are in NSURLErrorDomain or NSCocoaErrorDomain.

There will generally be a CURLcodeErrorDomain error present; either directly, or as an underlying error (KSError https://github.com/karelia/KSError is handy for querying underlying errors).

The key CURLINFO_RESPONSE_CODE (as an NSNumber) will be filled out with HTTP/FTP status code if appropriate.

At present all errors include NSURLErrorFailingURLErrorKey and NSURLErrorFailingURLStringErrorKey if applicable even though the docs say “This key is only present in the NSURLErrorDomain”. Should we respect that?

Declared In

CURLHandle.h

handle:didFindHostFingerprint:knownFingerprint:match:

Optional method, called to ask how to handle a host fingerprint.

- (enum curl_khstat)handle:(CURLHandle *)handle didFindHostFingerprint:(const struct curl_khkey *)foundKey knownFingerprint:(const struct curl_khkey *)knownkey match:(enum curl_khmatch)match

Parameters

handle

The handle that’s found the fingerprint

foundKey

The fingerprint.

knownkey

The known fingerprint for the host.

match

Whether the fingerprints matched.

Return Value

A status value indicating what to do.

Discussion

If not implemented, only matching keys are accepted; all else is rejected I’ve found that CURLKHSTAT_FINE_ADD_TO_FILE only bothers appending to the file if not already present

Declared In

CURLHandle.h

handle:didReceiveData:

Required protocol method, called when data is received.

- (void)handle:(CURLHandle *)handle didReceiveData:(NSData *)data

Parameters

handle

The handle receiving the data.

data

The new data.

Declared In

CURLHandle.h

handle:didReceiveDebugInformation:ofType:

Optional method, called to report debug/status information to the delegate.

- (void)handle:(CURLHandle *)handle didReceiveDebugInformation:(NSString *)string ofType:(curl_infotype)type

Parameters

handle

The handle that the information relates to.

string

The information string.

type

The type of information.

Declared In

CURLHandle.h

handle:didReceiveResponse:

Optional method, called when a response is received.

- (void)handle:(CURLHandle *)handle didReceiveResponse:(NSURLResponse *)response

Parameters

handle

The handle receiving the response.

response

The response.

Declared In

CURLHandle.h

handle:willSendBodyDataOfLength:

Optional method, called just before a handle sends some data.

- (void)handle:(CURLHandle *)handle willSendBodyDataOfLength:(NSUInteger)bytesWritten

Parameters

handle

The handle that is sending data.

bytesWritten

The amount of data to be sent. This will be zero when the last data has been written.

Discussion

Reports a length of 0 when the end of the data is written so you can get a nice heads up that an upload is about to complete.

Declared In

CURLHandle.h

handleDidFinish:

Optional method, called when the handle has successfully completed.

- (void)handleDidFinish:(CURLHandle *)handle

Parameters

handle

The handle that has completed.

Declared In

CURLHandle.h