// Request body - only used when the whole body is stored in memory (shouldStreamPostDataFromDisk is false)
NSMutableData*postBody;
// gzipped request body used when shouldCompressRequestBody is YES
NSData*compressedPostBody;
// When true, post body will be streamed from a file on disk, rather than loaded into memory at once (useful for large uploads)
// Automatically set to true in ASIFormDataRequests when using setFile:forKey:
BOOLshouldStreamPostDataFromDisk;
// Path to file used to store post body (when shouldStreamPostDataFromDisk is true)
// You can set this yourself - useful if you want to PUT a file from local disk
NSString*postBodyFilePath;
// Path to a temporary file used to store a deflated post body (when shouldCompressPostBody is YES)
NSString*compressedPostBodyFilePath;
// Set to true when ASIHTTPRequest automatically created a temporary file containing the request body (when true, the file at postBodyFilePath will be deleted at the end of the request)
BOOLdidCreateTemporaryPostDataFile;
// Used when writing to the post body when shouldStreamPostDataFromDisk is true (via appendPostData: or appendPostDataFromFile:)
NSOutputStream*postBodyWriteStream;
// Used for reading from the post body when sending the request
NSInputStream*postBodyReadStream;
// Dictionary for custom HTTP request headers
NSMutableDictionary*requestHeaders;
// Set to YES when the request header dictionary has been populated, used to prevent this happening more than once
BOOLhaveBuiltRequestHeaders;
// Will be populated with HTTP response headers from the server
NSDictionary*responseHeaders;
// Can be used to manually insert cookie headers to a request, but it's more likely that sessionCookies will do this for you
NSMutableArray*requestCookies;
// Will be populated with cookies
NSArray*responseCookies;
// If use useCookiePersistence is true, network requests will present valid cookies from previous requests
BOOLuseCookiePersistence;
// If useKeychainPersistence is true, network requests will attempt to read credentials from the keychain, and will save them in the keychain when they are successfully presented
BOOLuseKeychainPersistence;
// If useSessionPersistence is true, network requests will save credentials and reuse for the duration of the session (until clearSession is called)
BOOLuseSessionPersistence;
// If allowCompressedResponse is true, requests will inform the server they can accept compressed data, and will automatically decompress gzipped responses. Default is true.
BOOLallowCompressedResponse;
// If shouldCompressRequestBody is true, the request body will be gzipped. Default is false.
// You will probably need to enable this feature on your webserver to make this work. Tested with apache only.
BOOLshouldCompressRequestBody;
// When downloadDestinationPath is set, the result of this request will be downloaded to the file at this location
// If downloadDestinationPath is not set, download data will be stored in memory
// The location that files will be downloaded to. Once a download is complete, files will be decompressed (if necessary) and moved to downloadDestinationPath
// If the response is gzipped and shouldWaitToInflateCompressedResponses is NO, a file will be created at this path containing the inflated response as it comes in
// When the request fails or completes successfully, complete will be true
BOOLcomplete;
// external "finished" indicator, subject of KVO notifications; updates after 'complete'
BOOLfinished;
// True if our 'cancel' selector has been called
BOOLcancelled;
// If an error occurs, error will contain an NSError
// If error code is = ASIConnectionFailureErrorType (1, Connection failure occurred) - inspect [[error userInfo] objectForKey:NSUnderlyingErrorKey] for more information
// Username and password used for proxy authentication
NSString*proxyUsername;
NSString*proxyPassword;
// Domain used for NTLM proxy authentication
NSString*proxyDomain;
// Delegate for displaying upload progress (usually an NSProgressIndicator, but you can supply a different object and handle this yourself)
id<ASIProgressDelegate>uploadProgressDelegate;
// Delegate for displaying download progress (usually an NSProgressIndicator, but you can supply a different object and handle this yourself)
id<ASIProgressDelegate>downloadProgressDelegate;
// Whether we've seen the headers of the response yet
BOOLhaveExaminedHeaders;
// Data we receive will be stored here. Data may be compressed unless allowCompressedResponse is false - you should use [request responseData] instead in most cases
// If you are using Basic authentication and want to force ASIHTTPRequest to send an authorization header without waiting for a 401, you must set this to (NSString *)kCFHTTPAuthenticationSchemeBasic
// Realm for authentication when credentials are required
NSString*authenticationRealm;
// When YES, ASIHTTPRequest will present a dialog allowing users to enter credentials when no-matching credentials were found for a server that requires authentication
// The dialog will not be shown if your delegate responds to authenticationNeededForRequest:
// Default is NO.
BOOLshouldPresentAuthenticationDialog;
// When YES, ASIHTTPRequest will present a dialog allowing users to enter credentials when no-matching credentials were found for a proxy server that requires authentication
// The dialog will not be shown if your delegate responds to proxyAuthenticationNeededForRequest:
// Default is YES (basically, because most people won't want the hassle of adding support for authenticating proxies to their apps)
BOOLshouldPresentProxyAuthenticationDialog;
// Used for proxy authentication
CFHTTPAuthenticationRefproxyAuthentication;
NSDictionary*proxyCredentials;
// Used during authentication with an NTLM proxy
intproxyAuthenticationRetryCount;
// Authentication scheme for the proxy (Basic, Digest, NTLM)
NSString*proxyAuthenticationScheme;
// Realm for proxy authentication when credentials are required
NSString*proxyAuthenticationRealm;
// HTTP status code, eg: 200 = OK, 404 = Not found etc
intresponseStatusCode;
// Description of the HTTP status code
NSString*responseStatusMessage;
// Size of the response
unsignedlonglongcontentLength;
// Size of the partially downloaded content
unsignedlonglongpartialDownloadSize;
// Size of the POST payload
unsignedlonglongpostLength;
// The total amount of downloaded data
unsignedlonglongtotalBytesRead;
// The total amount of uploaded data
unsignedlonglongtotalBytesSent;
// Last amount of data read (used for incrementing progress)
unsignedlonglonglastBytesRead;
// Last amount of data sent (used for incrementing progress)
unsignedlonglonglastBytesSent;
// This lock prevents the operation from being cancelled at an inopportune moment
NSRecursiveLock*cancelledLock;
// Called on the delegate (if implemented) when the request starts. Default is requestStarted:
// Called on the delegate (if implemented) when the request completes successfully. Default is requestFinished:
SELdidFinishSelector;
// Called on the delegate (if implemented) when the request fails. Default is requestFailed:
SELdidFailSelector;
// Called on the delegate (if implemented) when the request receives data. Default is request:didReceiveData:
// If you set this and implement the method in your delegate, you must handle the data yourself - ASIHTTPRequest will not populate responseData or write the data to downloadDestinationPath
SELdidReceiveDataSelector;
// Used for recording when something last happened during the request, we will compare this value with the current date to time out requests when appropriate
NSDate*lastActivityTime;
// Number of seconds to wait before timing out - default is 10
NSTimeIntervaltimeOutSeconds;
// Will be YES when a HEAD request will handle the content-length before this request starts
BOOLshouldResetUploadProgress;
BOOLshouldResetDownloadProgress;
// Used by HEAD requests when showAccurateProgress is YES to preset the content-length for this request
ASIHTTPRequest*mainRequest;
// When NO, this request will only update the progress indicator when it completes
// When YES, this request will update the progress indicator according to how much data it has received so far
// The default for requests is YES
// Also see the comments in ASINetworkQueue.h
BOOLshowAccurateProgress;
// Used to ensure the progress indicator is only incremented once when showAccurateProgress = NO
BOOLupdatedProgress;
// Prevents the body of the post being built more than once (largely for subclasses)
BOOLhaveBuiltPostBody;
// Used internally, may reflect the size of the internal buffer used by CFNetwork
// POST / PUT operations with body sizes greater than uploadBufferSize will not timeout unless more than uploadBufferSize bytes have been sent
// Likely to be 32KB on iPhone 3.0, 128KB on Mac OS X Leopard and iPhone 2.2.x
unsignedlonglonguploadBufferSize;
// Text encoding for responses that do not send a Content-Type with a charset value. Defaults to NSISOLatin1StringEncoding
NSStringEncodingdefaultResponseEncoding;
// The text encoding of the response, will be defaultResponseEncoding if the server didn't specify. Can't be set.
NSStringEncodingresponseEncoding;
// Tells ASIHTTPRequest not to delete partial downloads, and allows it to use an existing file to resume a download. Defaults to NO.
// Use HTTP 1.0 rather than 1.1 (defaults to false)
BOOLuseHTTPVersionOne;
// When YES, requests will automatically redirect when they get a HTTP 30x header (defaults to YES)
BOOLshouldRedirect;
// Used internally to tell the main loop we need to stop and retry with a new url
BOOLneedsRedirect;
// Incremented every time this request redirects. When it reaches 5, we give up
intredirectCount;
// When NO, requests will not check the secure certificate is valid (use for self-signed certificates during development, DO NOT USE IN PRODUCTION) Default is YES
BOOLvalidatesSecureCertificate;
// If not nil and the URL scheme is https, CFNetwork configured to supply a client certificate
SecIdentityRefclientCertificateIdentity;
NSArray*clientCertificates;
// Details on the proxy to use - you could set these yourself, but it's probably best to let ASIHTTPRequest detect the system proxy settings
NSString*proxyHost;
intproxyPort;
// ASIHTTPRequest will assume kCFProxyTypeHTTP if the proxy type could not be automatically determined
// Set to kCFProxyTypeSOCKS if you are manually configuring a SOCKS proxy
NSString*proxyType;
// URL for a PAC (Proxy Auto Configuration) file. If you want to set this yourself, it's probably best if you use a local file
NSURL*PACurl;
// See ASIAuthenticationState values above. 0 == default == No authentication needed yet
ASIAuthenticationStateauthenticationNeeded;
// When YES, ASIHTTPRequests will present credentials from the session store for requests to the same server before being asked for them
// This avoids an extra round trip for requests after authentication has succeeded, which is much for efficient for authenticated requests with large bodies, or on slower connections
// Set to NO to only present credentials when explicitly asked for them
// This only affects credentials stored in the session cache when useSessionPersistence is YES. Credentials from the keychain are never presented unless the server asks for them
// For requests using Basic authentication, set authenticationScheme to (NSString *)kCFHTTPAuthenticationSchemeBasic, and credentials can be sent on the very first request when shouldPresentCredentialsBeforeChallenge is YES
// YES when the request hasn't finished yet. Will still be YES even if the request isn't doing anything (eg it's waiting for delegate authentication). READ-ONLY
BOOLinProgress;
// Used internally to track whether the stream is scheduled on the run loop or not
// Bandwidth throttling can unschedule the stream to slow things down while a request is in progress
BOOLreadStreamIsScheduled;
// Set to allow a request to automatically retry itself on timeout
// Default is zero - timeout will stop the request
intnumberOfTimesToRetryOnTimeout;
// The number of times this request has retried (when numberOfTimesToRetryOnTimeout > 0)
// When YES, requests will keep the connection to the server alive for a while to allow subsequent requests to re-use it for a substantial speed-boost
// Persistent connections will not be used if the server explicitly closes the connection
// Default is YES
BOOLshouldAttemptPersistentConnection;
// Number of seconds to keep an inactive persistent connection open on the client side
// Default is 60
// If we get a keep-alive header, this is this value is replaced with how long the server told us to keep the connection around
// A future date is created from this and used for expiring the connection, this is stored in connectionInfo's expires value
NSTimeIntervalpersistentConnectionTimeoutSeconds;
// Set to yes when an appropriate keep-alive header is found
BOOLconnectionCanBeReused;
// Stores information about the persistent connection that is currently in use.
// It may contain:
// * The id we set for a particular connection, incremented every time we want to specify that we need a new connection
// * The date that connection should expire
// * A host, port and scheme for the connection. These are used to determine whether that connection can be reused by a subsequent request (all must match the new request)
// * An id for the request that is currently using the connection. This is used for determining if a connection is available or not (we store a number rather than a reference to the request so we don't need to hang onto a request until the connection expires)
// * A reference to the stream that is currently using the connection. This is necessary because we need to keep the old stream open until we've opened a new one.
// The stream will be closed + released either when another request comes to use the connection, or when the timer fires to tell the connection to expire
NSMutableDictionary*connectionInfo;
// When set to YES, 301 and 302 automatic redirects will use the original method and and body, according to the HTTP 1.1 standard
// Default is NO (to follow the behaviour of most browsers)
BOOLshouldUseRFC2616RedirectBehaviour;
// Used internally to record when a request has finished downloading data
BOOLdownloadComplete;
// An ID that uniquely identifies this request - primarily used for debugging persistent connections
NSNumber*requestID;
// Will be ASIHTTPRequestRunLoopMode for synchronous requests, NSDefaultRunLoopMode for all other requests
NSString*runLoopMode;
// This timer checks up on the request every 0.25 seconds, and updates progress
NSTimer*statusTimer;
// The download cache that will be used for this request (use [ASIHTTPRequest setDefaultCache:cache] to configure a default cache
id<ASICacheDelegate>downloadCache;
// The cache policy that will be used for this request - See ASICacheDelegate.h for possible values
ASICachePolicycachePolicy;
// The cache storage policy that will be used for this request - See ASICacheDelegate.h for possible values
ASICacheStoragePolicycacheStoragePolicy;
// Will be true when the response was pulled from the cache rather than downloaded
BOOLdidUseCachedResponse;
// Set secondsToCache to use a custom time interval for expiring the response when it is stored in a cache
// When downloading a gzipped response, the request will use this helper object to inflate the response
ASIDataDecompressor*dataDecompressor;
// Controls how responses with a gzipped encoding are inflated (decompressed)
// When set to YES (This is the default):
// * gzipped responses for requests without a downloadDestinationPath will be inflated only when [request responseData] / [request responseString] is called
// * gzipped responses for requests with a downloadDestinationPath set will be inflated only when the request completes
//
// When set to NO
// All requests will inflate the response as it comes in
// * If the request has no downloadDestinationPath set, the raw (compressed) response is discarded and rawResponseData will contain the decompressed response
// * If the request has a downloadDestinationPath, the raw response will be stored in temporaryFileDownloadPath as normal, the inflated response will be stored in temporaryUncompressedDataDownloadPath
// Once the request completes successfully, the contents of temporaryUncompressedDataDownloadPath are moved into downloadDestinationPath
//
// Setting this to NO may be especially useful for users using ASIHTTPRequest in conjunction with a streaming parser, as it will allow partial gzipped responses to be inflated and passed on to the parser while the request is still running
BOOLshouldWaitToInflateCompressedResponses;
// Will be YES if this is a request created behind the scenes to download a PAC file - these requests do not attempt to configure their own proxies
BOOLisPACFileRequest;
// Used for downloading PAC files from http / https webservers
ASIHTTPRequest*PACFileRequest;
// Used for asynchronously reading PAC files from file:// URLs
NSInputStream*PACFileReadStream;
// Used for storing PAC data from file URLs as it is downloaded
NSMutableData*PACFileData;
// Set to YES in startSynchronous. Currently used by proxy detection to download PAC files synchronously when appropriate
BOOLisSynchronous;
#if NS_BLOCKS_AVAILABLE
//block to execute when request starts
ASIBasicBlockstartedBlock;
//block to execute when headers are received
ASIHeadersBlockheadersReceivedBlock;
//block to execute when request completes successfully
// Attempt to obtain credentials for this request from the URL, username and password or keychain
-(NSMutableDictionary*)findCredentials;
-(NSMutableDictionary*)findProxyCredentials;
// Unlock (unpause) the request thread so it can resume the request
// Should be called by delegates when they have populated the authentication information after an authentication challenge
-(void)retryUsingSuppliedCredentials;
// Should be called by delegates when they wish to cancel authentication and stop
-(void)cancelAuthentication;
// Apply authentication information and resume the request after an authentication challenge
-(void)attemptToApplyCredentialsAndResume;
-(void)attemptToApplyProxyCredentialsAndResume;
// Attempt to show the built-in authentication dialog, returns YES if credentials were supplied, NO if user cancelled dialog / dialog is disabled / running on main thread
// Currently only used on iPhone OS
-(BOOL)showProxyAuthenticationDialog;
-(BOOL)showAuthenticationDialog;
// Construct a basic authentication header from the username and password supplied, and add it to the request headers
// Used when shouldPresentCredentialsBeforeChallenge is YES