RE:Send TCP Data ??CurlHandle.framework
RE:Send TCP Data ??CurlHandle.framework
- Subject: RE:Send TCP Data ??CurlHandle.framework
- From: James Mooney <email@hidden>
- Date: Tue, 25 Mar 2003 16:39:54 -0500
I am staring at a framework I downloaded from somewhere awhile ago.
I do not know if this is part of the MacOS framework.
CurlHandle.Framework
It is a complete Cocoa framework that does everything curl does.
These are the headers
It seems to me this will do what you want NO?
If it is .... the person who wrote it email address is
email@hidden
@interface CURLHandle : NSURLHandle
{
NSThread *mMainThread; /*" Reference to main thread so thread can
determine if it's a background thread or not "*/
CURL *mCURL; /*" Pointer to the actual CURL object that does all
the hard work "*/
char mErrorBuffer[CURL_ERROR_SIZE]; /*" Buffer to hold string
generated by CURL; this is then converted to an NSString. "*/
int mResult; /*" Result after performing a CURL operation; it is
displayed as an error code in case there was no error string generated.
"*/
NSURLHandleStatus mStatus; /*" local copy of status flag; in 10.0
we have to track this ourselves. In theory it ought to be the same as
what you get from calling #{[super status]} but it often isn't. "*/
NSURL *mNSURL; /*" The instance of #NSURL that is the URL to load
"*/
NSMutableData *mLocalData; /*" The buffer that is filled with data
from the body as the download progresses. This is used in Mac OS X
10.0 only; data gets stored in NSURLHandle for us under 10.1. "*/
NSMutableData *mHeaderBuffer; /*" The buffer that is filled with
data from the header as the download progresses; it's appended to one
line at a time. "*/
NSMutableDictionary *mStringOptions; /*" Dictionary of keys(ints) &
values (NSStrings) for performing curl_easy_setopt. We store the
options in a dictionary and then invoke #curl_easy_setopt on each
option right before the #curl_easy_perform so that we can retain their
memory until it is needed."*/
NSDictionary *mHTTPHeaders; /*" Dictionary of & values (NSStrings)
for additional HTTP headers. We store the options in a dictionary and
then make use of them right before the #curl_easy_perform so that we
can retain their memory until it is needed."*/
id mProgressIndicator; /*" A progress indicator, to animate
during foreground loads. This will help give some indication of
loading progress, though of course you're better off loading in the
background. "*/
// Backgrounding support
NSPort *mPort; /*" A port for communicating between the
background thread and the foreground thread. "*/
BOOL mAbortBackground; /*" A flag that is set by the foreground
thread and read by the background thread; it's an indicator that the
user has cancelled. "*/
FILE *mPutFile; /*" The FILE stream if putFile: is used. It's only
saved so it can be closed after perform "*/
}
/*" CURLHandle-specific interfaces. "*/
+ (void) curlGoodbye;
+ (void) curlHelloSignature:(OSType) inSignature
acceptAll:(BOOL)inAcceptAllHTTP;
+ (void)curlAcceptURL:(NSURL *)url;
+ (void)curlFlushEntireCache;
- (CURL *) curl;
- (void) setString:(NSString *)inString forKey:(CURLoption)
inCurlOption;
- (void) setURL:(NSURL *)inURL;
- (NSURL *)url;
- (void) setHTTPHeaders:(NSDictionary *)inDict;
+ (void) setProxyUserIDAndPassword:(NSString *)inString;
+ (void) setAllowsProxy:(BOOL) inBool;
- (void) setPutFile:(NSString *)path;
- (void) setPutFileOffset:(int)offset;
/*" NSURLHandle overrides "*/
+ (BOOL)canInitWithURL:(NSURL *)anURL;
+ (NSURLHandle *)cachedHandleForURL:(NSURL *)anURL;
- (NSData *)loadInForeground;
- (NSString *)failureReason;
- (id) initWithURL:(NSURL *)anURL cached:(BOOL)willCache;
- (id)propertyForKey:(NSString *)propertyKey;
- (id)propertyForKeyIfAvailable:(NSString *)propertyKey;
- (void) dealloc;
- (void)beginLoadInBackground;
- (void)cancelLoadInBackground;
- (void)endLoadInBackground;
/*" NSURLHandle Overrides specifically for 10.0 Compatibility "*/
- (NSURLHandleStatus)status;
- (void)didLoadBytes:(NSData *)newBytes loadComplete:(BOOL)yorn;
- (void)flushCachedData;
-(NSData *)availableResourceData;
-(NSData *)resourceData;
/*" Support Methods "*/
- (size_t) curlWritePtr:(void *)inPtr size:(size_t)inSize
number:(size_t)inNumber message:(int)inMessageID;
- (void) curlThreadBackgroundLoad:(id)inParam;
- (void) prepareAndPerformCurl;
- (void)handlePortMessage:(NSPortMessage *)portMessage;
@end
@interface NSDictionary ( CurlHTTPExtensions )
+ (NSDictionary *) dictionaryWithHTTPHeaders:(NSString *)inString;
- (NSArray *) cookies;
- (NSString *) formatForHTTP;
- (NSString *) formatForHTTPUsingEncoding:(NSStringEncoding)inEncoding;
- (NSString *) formatForHTTPUsingEncoding:(NSStringEncoding)inEncoding
ordering:(NSArray *)inOrdering;
@end
AND THEN AN ADDITIONAL header file with the following
- (void) setConnectionTimeout:(long) inSeconds;
- (void) setCookie:(NSString *)inCookie;
- (void) setFailsOnError:(BOOL)inFlag;
- (void) setFollowsRedirects:(BOOL)inFlag;
- (void) setPostString:(NSString *)inPostString;
- (void) setPostDictionary:(NSDictionary *)inDictionary;
- (void) setPostDictionary:(NSDictionary *)inDictionary
encoding:(NSStringEncoding) inEncoding;
- (void) setProxy:(NSString *)inProxy port:(int)inPort;
- (void) setReferer:(NSString *)inReferer;
- (void) setUserAgent:(NSString *)inUserAgent;
- (void) setUserName:(NSString*)inUserName password:(NSString
*)inPassword;
- (void) setNoBody:(BOOL)inNoBody;
- (void) setRange:(NSString *)inRange;
- (void) setIfModSince:(NSDate *)inModDate;
/*" Get information about the transfer "*/
- (double)downloadContentLength;
- (double)downloadSize;
- (double)downloadSpeed;
- (double)nameLookupTime;
- (double)pretransferTime;
- (double)totalTime;
- (double)uploadContentLength;
- (double)uploadSize;
- (double)uploadSpeed;
- (long)fileTime;
- (long)headerSize;
- (long)httpCode;
- (long)requestSize;
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.