2011-02-01 09:51:02 -06:00
|
|
|
//
|
|
|
|
// MGMURLConnectionManager.h
|
|
|
|
// MGMUsers
|
|
|
|
//
|
2011-12-04 16:57:04 -06:00
|
|
|
// Created by Mr. Gecko on 2/21/11.
|
2011-02-01 09:51:02 -06:00
|
|
|
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
2011-12-04 16:57:04 -06:00
|
|
|
@class MGMURLConnectionManager;
|
2011-02-01 09:51:02 -06:00
|
|
|
|
2011-12-04 16:57:04 -06:00
|
|
|
@protocol MGMURLConnectionHandler <NSObject>
|
|
|
|
- (void)setManager:(MGMURLConnectionManager *)theManager;
|
|
|
|
- (void)setConnection:(NSURLConnection *)theConnection;
|
|
|
|
- (NSURLConnection *)connection;
|
|
|
|
- (void)setRequest:(NSMutableURLRequest *)theRequest;
|
|
|
|
- (NSMutableURLRequest *)request;
|
|
|
|
- (BOOL)synchronous;
|
|
|
|
- (NSURLCredential *)credentailsForChallenge:(NSURLAuthenticationChallenge *)theChallenge;
|
|
|
|
- (void)uploaded:(unsigned long)theBytes totalBytes:(unsigned long)theTotalBytes totalBytesExpected:(unsigned long)theExpectedBytes;
|
|
|
|
- (NSURLRequest *)willSendRequest:(NSURLRequest *)theRequest redirectResponse:(NSHTTPURLResponse *)theResponse;
|
|
|
|
- (void)didReceiveResponse:(NSHTTPURLResponse *)theResponse;
|
|
|
|
- (void)didReceiveData:(NSData *)theData;
|
|
|
|
- (void)didFailWithError:(NSError *)theError;
|
|
|
|
- (void)didFinishLoading;
|
|
|
|
@end
|
2011-02-01 09:51:02 -06:00
|
|
|
|
|
|
|
@interface MGMURLConnectionManager : NSObject {
|
|
|
|
NSHTTPCookieStorage *cookieStorage;
|
2011-12-04 16:57:04 -06:00
|
|
|
NSString *userAgent;
|
2011-02-01 09:51:02 -06:00
|
|
|
NSURLCredential *credentials;
|
2011-12-04 16:57:04 -06:00
|
|
|
NSMutableArray *handlers;
|
|
|
|
|
|
|
|
BOOL runningSynchronousConnection;
|
2011-02-01 09:51:02 -06:00
|
|
|
}
|
2011-12-04 16:57:04 -06:00
|
|
|
+ (id)manager;
|
2011-02-01 09:51:02 -06:00
|
|
|
+ (id)managerWithCookieStorage:(id)theCookieStorage;
|
|
|
|
- (id)initWithCookieStorage:(id)theCookieStorage;
|
2011-12-04 16:57:04 -06:00
|
|
|
|
|
|
|
- (void)setCookieStorage:(id)theCookieStorage;
|
2011-02-01 09:51:02 -06:00
|
|
|
- (NSHTTPCookieStorage *)cookieStorage;
|
2011-12-04 16:57:04 -06:00
|
|
|
- (void)setUserAgent:(NSString *)theUserAgent;
|
|
|
|
- (NSString *)userAgent;
|
2011-02-01 09:51:02 -06:00
|
|
|
- (void)setCredentials:(NSURLCredential *)theCredentials;
|
2011-12-04 16:57:04 -06:00
|
|
|
- (void)setUser:(NSString *)theUser password:(NSString *)thePassword;
|
2011-02-01 09:51:02 -06:00
|
|
|
- (NSURLCredential *)credentials;
|
2011-12-04 16:57:04 -06:00
|
|
|
|
|
|
|
- (void)addHandler:(id)theHandler;
|
|
|
|
- (void)cancelHandler:(id)theHandler;
|
2011-02-01 09:51:02 -06:00
|
|
|
- (void)cancelAll;
|
|
|
|
@end
|