mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix for background posting of data.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11710 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
04ef0e02ba
commit
d66a641c93
9 changed files with 125 additions and 66 deletions
|
@ -1,3 +1,11 @@
|
|||
2001-12-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSHTTPURLHandle.m: Remove GSHTPPropertyBodyKey ... make
|
||||
the ([writeData:]) method do nothing until the page is reloaded,
|
||||
so its behavior is consistent with ([writeProperty:forKey:]) and
|
||||
can be used in conjunction with background loading (ie all I/O
|
||||
is done during the load).
|
||||
|
||||
2001-12-11 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
|
||||
* Source/NSString.m: corrected bug in +stringByTrimmingSpaces
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<dl>
|
||||
<dt><a href ="http://www.gnustep.org/developers/whoiswho.html">Richard Frith-Macdonald</a>
|
||||
<dd>
|
||||
<dt>Pierre-Yves Rivaille
|
||||
<dt><a href ="">Pierre-Yves Rivaille</a>
|
||||
<dd>
|
||||
</dl>
|
||||
<p>Version: $Revision$</p>
|
||||
|
|
|
@ -45,9 +45,10 @@
|
|||
<li ><a href ="NSFileHandle.html#method-15">-seekToFileOffset:</a>
|
||||
<li ><a href ="NSFileHandle.html#method-16">-synchronizeFile</a>
|
||||
<li ><a href ="NSFileHandle.html#method-17">-truncateFileAtOffset:</a>
|
||||
<li ><a href ="NSFileHandle.html#method-18">-waitForDataInBackgroundAndNotify</a>
|
||||
<li ><a href ="NSFileHandle.html#method-19">-waitForDataInBackgroundAndNotifyForModes:</a>
|
||||
<li ><a href ="NSFileHandle.html#method-20">-writeData:</a>
|
||||
<li ><a href ="NSFileHandle.html#method-18">-useCompression</a>
|
||||
<li ><a href ="NSFileHandle.html#method-19">-waitForDataInBackgroundAndNotify</a>
|
||||
<li ><a href ="NSFileHandle.html#method-20">-waitForDataInBackgroundAndNotifyForModes:</a>
|
||||
<li ><a href ="NSFileHandle.html#method-21">-writeData:</a>
|
||||
</ul>
|
||||
<hr><h2>Instances Methods </h2>
|
||||
<h3><a name ="method-0">acceptConnectionInBackgroundAndNotify</a></h3>
|
||||
|
@ -140,17 +141,34 @@
|
|||
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-18">waitForDataInBackgroundAndNotify</a></h3>
|
||||
<h3><a name ="method-18">useCompression</a></h3>
|
||||
- (BOOL) <b>useCompression</b>;<br>
|
||||
|
||||
On systems which support it, this method may be called after
|
||||
a file handle has been initialised to turn on compression or
|
||||
decompression of the data being written/read.<br>
|
||||
Returns YES on success, NO on failure.<br>
|
||||
Reasons for failure are - <br>
|
||||
<ul>
|
||||
<li >Not supported/built in to GNUstep
|
||||
<li >File handle has been closed
|
||||
<li >File handle is open for both read and write
|
||||
<li >Failure in compression/decompression library
|
||||
</ul>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-19">waitForDataInBackgroundAndNotify</a></h3>
|
||||
- (void) <b>waitForDataInBackgroundAndNotify</b>;<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-19">waitForDataInBackgroundAndNotifyForModes:</a></h3>
|
||||
<h3><a name ="method-20">waitForDataInBackgroundAndNotifyForModes:</a></h3>
|
||||
- (void) <b>waitForDataInBackgroundAndNotifyForModes:</b> (NSArray*)modes;<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-20">writeData:</a></h3>
|
||||
<h3><a name ="method-21">writeData:</a></h3>
|
||||
- (void) <b>writeData:</b> (NSData*)data;<br>
|
||||
|
||||
|
||||
|
|
|
@ -249,8 +249,14 @@
|
|||
<sel>writeData:</sel>
|
||||
<arg type="NSData*">data</arg>
|
||||
<desc>
|
||||
Writes resource data to the handle. Returns YES on success,
|
||||
NO on failure.
|
||||
<p>
|
||||
Writes resource data to the handle. Returns YES on success,
|
||||
NO on failure.
|
||||
</p>
|
||||
<p>
|
||||
The GNUstep implementation sets the specified data as
|
||||
information to be POSTed to the URL next time it is loaded.
|
||||
</p>
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
|
@ -260,7 +266,16 @@
|
|||
<sel>forKey:</sel>
|
||||
<arg type="NSString*">key</arg>
|
||||
<desc>
|
||||
Attempts to set property for handle.
|
||||
<p>
|
||||
Sets a property for handle.
|
||||
Returns YES on success, NO on failure.
|
||||
</p>
|
||||
<p>
|
||||
The GNUstep implementation sets the property as a header
|
||||
to be sent the next time the URL is loaded, and recognizes
|
||||
some special property keys which control the behavior of
|
||||
the next load.
|
||||
</p>
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
|
|
|
@ -256,15 +256,38 @@ Your subclass <em>must </em> override this abstract method.<br>
|
|||
- (BOOL) <b>writeData:</b> (NSData*)data;<br>
|
||||
Your subclass <em>must </em> override this abstract method.<br>
|
||||
|
||||
Writes resource data to the handle. Returns YES on success,
|
||||
NO on failure.
|
||||
<p>
|
||||
|
||||
Writes resource data to the handle. Returns YES on success,
|
||||
NO on failure.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
The GNUstep implementation sets the specified data as
|
||||
information to be POSTed to the URL next time it is loaded.
|
||||
</p>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-18">writeProperty:forKey:</a></h3>
|
||||
- (BOOL) <b>writeProperty:</b> (id)propertyValue <b>forKey:</b> (NSString*)key;<br>
|
||||
Your subclass <em>must </em> override this abstract method.<br>
|
||||
|
||||
Attempts to set property for handle.
|
||||
<p>
|
||||
|
||||
Sets a property for handle.
|
||||
Returns YES on success, NO on failure.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
The GNUstep implementation sets the property as a header
|
||||
to be sent the next time the URL is loaded, and recognizes
|
||||
some special property keys which control the behavior of
|
||||
the next load.
|
||||
</p>
|
||||
|
||||
|
||||
<hr>
|
||||
<h2><a name ="NSURLHandleClient">NSURLHandleClient Protocol </a></h2>
|
||||
|
|
|
@ -38,7 +38,6 @@ GS_EXPORT NSString *NSHTTPPropertyRedirectionHeadersKey;
|
|||
GS_EXPORT NSString *NSHTTPPropertyErrorPageDataKey;
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
GS_EXPORT NSString *GSHTTPPropertyBodyKey;
|
||||
GS_EXPORT NSString *GSHTTPPropertyMethodKey;
|
||||
GS_EXPORT NSString *GSHTTPPropertyProxyHostKey;
|
||||
GS_EXPORT NSString *GSHTTPPropertyProxyPortKey;
|
||||
|
|
|
@ -720,8 +720,7 @@ static void debugWrite(NSData *data)
|
|||
|
||||
- (BOOL) writeData: (NSData*)d
|
||||
{
|
||||
[self writeProperty: d forKey: GSHTTPPropertyBodyKey];
|
||||
[self loadInForeground];
|
||||
ASSIGN(wData, d);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -732,11 +731,7 @@ static void debugWrite(NSData *data)
|
|||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ with invalid key", NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if ([propertyKey isEqual: GSHTTPPropertyBodyKey] == YES)
|
||||
{
|
||||
ASSIGN(wData, property);
|
||||
}
|
||||
else if ([propertyKey hasPrefix: @"GSHTTPProperty"])
|
||||
if ([propertyKey hasPrefix: @"GSHTTPProperty"])
|
||||
{
|
||||
if (property == nil)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Interface for NSMethodSignature for GNUStep
|
||||
/* Implementation of NSProtocolChecker for GNUStep
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Mike Kienenberger
|
||||
|
@ -30,33 +30,35 @@
|
|||
|
||||
@implementation NSProtocolChecker
|
||||
|
||||
// Allocates and initializes an NSProtocolChecker instance that will
|
||||
// forward any messages in the aProtocol protocol to anObject, its
|
||||
// target. Thus, the checker can be vended in lieu of anObject to
|
||||
// restrict the messages that can be sent to anObject. Returns the
|
||||
// new instance.
|
||||
/*
|
||||
* Allocates and initializes an NSProtocolChecker instance that will
|
||||
* forward any messages in the aProtocol protocol to anObject, its
|
||||
* target. Thus, the checker can be vended in lieu of anObject to
|
||||
* restrict the messages that can be sent to anObject. Returns the
|
||||
* new instance.
|
||||
*/
|
||||
|
||||
+ (id)protocolCheckerWithTarget: (NSObject *)anObject
|
||||
protocol: (Protocol *)aProtocol
|
||||
+ (id) protocolCheckerWithTarget: (NSObject*)anObject
|
||||
protocol: (Protocol*)aProtocol
|
||||
{
|
||||
return AUTORELEASE([[NSProtocolChecker alloc] initWithTarget: anObject
|
||||
protocol: aProtocol]);
|
||||
protocol: aProtocol]);
|
||||
}
|
||||
|
||||
// Forwards any message to the delegate if the method is declared in
|
||||
// the checker's protocol; otherwise raises an NSInvalidArgumentException.
|
||||
|
||||
- (void)forwardInvocation: (NSInvocation *)anInvocation
|
||||
/*
|
||||
* Forwards any message to the delegate if the method is declared in
|
||||
* the checker's protocol; otherwise raises an NSInvalidArgumentException.
|
||||
*/
|
||||
- (void) forwardInvocation: (NSInvocation*)anInvocation
|
||||
{
|
||||
unsigned int length;
|
||||
void *buffer;
|
||||
unsigned int length;
|
||||
void *buffer;
|
||||
|
||||
if ((struct objc_method_description *)NULL
|
||||
!= [self methodDescriptionForSelector: [anInvocation selector]])
|
||||
!= [self methodDescriptionForSelector: [anInvocation selector]])
|
||||
[[NSException exceptionWithName: NSInvalidArgumentException
|
||||
reason: @"Method not declared in current protocol"
|
||||
userInfo: nil]
|
||||
raise];
|
||||
userInfo: nil] raise];
|
||||
|
||||
[anInvocation invokeWithTarget: _myTarget];
|
||||
|
||||
|
@ -87,14 +89,15 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
// Initializes a newly allocated NSProtocolChecker instance that will
|
||||
// forward any messages in the aProtocol protocol to anObject, its
|
||||
// delegate. Thus, the checker can be vended in lieu of anObject to
|
||||
// restrict the messages that can be sent to anObject. If anObject is
|
||||
// allowed to be freed or dereferenced by clients, the free method
|
||||
// should be included in aProtocol. Returns the new instance.
|
||||
|
||||
- (id)initWithTarget: (NSObject *)anObject protocol: (Protocol *)aProtocol
|
||||
/*
|
||||
* Initializes a newly allocated NSProtocolChecker instance that will
|
||||
* forward any messages in the aProtocol protocol to anObject, its
|
||||
* delegate. Thus, the checker can be vended in lieu of anObject to
|
||||
* restrict the messages that can be sent to anObject. If anObject is
|
||||
* allowed to be freed or dereferenced by clients, the free method
|
||||
* should be included in aProtocol. Returns the new instance.
|
||||
*/
|
||||
- (id) initWithTarget: (NSObject*)anObject protocol: (Protocol*)aProtocol
|
||||
{
|
||||
[super init];
|
||||
|
||||
|
@ -105,33 +108,35 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
// Returns an Objective C description for a method in the checker's
|
||||
// protocol, or NULL if aSelector isn't declared as an instance method
|
||||
// in the protocol.
|
||||
|
||||
- (struct objc_method_description *)methodDescriptionForSelector: (SEL)aSelector
|
||||
/*
|
||||
* Returns an Objective C description for a method in the checker's
|
||||
* protocol, or NULL if aSelector isn't declared as an instance method
|
||||
* in the protocol.
|
||||
*/
|
||||
- (struct objc_method_description*) methodDescriptionForSelector: (SEL)aSelector
|
||||
{
|
||||
return [_myProtocol descriptionForInstanceMethod: aSelector];
|
||||
}
|
||||
|
||||
// Returns the protocol object the checker uses to verify whether a
|
||||
// given message should be forwarded to its delegate, or the protocol
|
||||
// checker should raise an NSInvalidArgumentException.
|
||||
|
||||
- (Protocol *)protocol
|
||||
/*
|
||||
* Returns the protocol object the checker uses to verify whether a
|
||||
* given message should be forwarded to its delegate, or the protocol
|
||||
* checker should raise an NSInvalidArgumentException.
|
||||
*/
|
||||
- (Protocol*) protocol
|
||||
{
|
||||
if (nil == _myProtocol)
|
||||
[[NSException exceptionWithName: NSInvalidArgumentException
|
||||
reason: @"No protocol specified"
|
||||
userInfo: nil]
|
||||
raise];
|
||||
userInfo: nil] raise];
|
||||
|
||||
return _myProtocol;
|
||||
}
|
||||
|
||||
// Returns the target of the NSProtocolChecker.
|
||||
|
||||
- (NSObject *)target
|
||||
/*
|
||||
* Returns the target of the NSProtocolChecker.
|
||||
*/
|
||||
- (NSObject*) target
|
||||
{
|
||||
return _myTarget;
|
||||
}
|
||||
|
|
|
@ -283,8 +283,6 @@ NSString *NSHTTPPropertyRedirectionHeadersKey;
|
|||
NSString *NSHTTPPropertyErrorPageDataKey;
|
||||
|
||||
/* These are GNUstep extras */
|
||||
NSString *GSHTTPPropertyBodyKey;
|
||||
|
||||
NSString *GSHTTPPropertyMethodKey;
|
||||
|
||||
NSString *GSHTTPPropertyProxyHostKey;
|
||||
|
@ -519,8 +517,6 @@ GSBuildStrings()
|
|||
NSHTTPPropertyErrorPageDataKey
|
||||
= [[SClass alloc] initWithCString: "HTTPPropertyErrorPageDataKey"];
|
||||
|
||||
GSHTTPPropertyBodyKey
|
||||
= [[SClass alloc] initWithCString: "GSHTTPPropertyBodyKey"];
|
||||
GSHTTPPropertyMethodKey
|
||||
= [[SClass alloc] initWithCString: "GSHTTPPropertyMethodKey"];
|
||||
GSHTTPPropertyProxyHostKey
|
||||
|
|
Loading…
Reference in a new issue