From 03acd994de8f78487f837b016208dd14c41dcfe7 Mon Sep 17 00:00:00 2001 From: CaS Date: Fri, 7 Dec 2001 14:32:22 +0000 Subject: [PATCH] Update to fix background posting. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11648 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Documentation/gsdoc/NSURLHandle.gsdoc | 4 ++++ Documentation/gsdoc/NSURLHandle.html | 4 ++++ Headers/gnustep/base/NSURLHandle.h | 1 + Source/GSHTTPURLHandle.m | 8 ++++++-- Source/externs.m | 4 ++++ 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68aafca05..001fc37b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-12-07 Richard Frith-Macdonald + + * Source/GSHTTPURLHandle.m: Understand GSHTPPropertyBodyKey so we + can set data to be posted in background. + 2001-12-06 Richard Frith-Macdonald * Source/GNUmakefile: Add library dependencies for SSL bundle ... diff --git a/Documentation/gsdoc/NSURLHandle.gsdoc b/Documentation/gsdoc/NSURLHandle.gsdoc index a1be3bb97..35ca650c3 100644 --- a/Documentation/gsdoc/NSURLHandle.gsdoc +++ b/Documentation/gsdoc/NSURLHandle.gsdoc @@ -529,6 +529,10 @@ The property is set as a header in the next request, unless it is one of the following - + + GSHTTPPropertyBodyKey - set an NSData item to be sent to + the server as the body of the request. + GSHTTPPropertyMethodKey - override the default method of the request (eg. "PUT"). diff --git a/Documentation/gsdoc/NSURLHandle.html b/Documentation/gsdoc/NSURLHandle.html index 3d2b32c3e..dad563514 100644 --- a/Documentation/gsdoc/NSURLHandle.html +++ b/Documentation/gsdoc/NSURLHandle.html @@ -543,6 +543,10 @@ Your subclass must override this abstract method.
The property is set as a header in the next request, unless it is one of the following -
    +
  • + GSHTTPPropertyBodyKey - set an NSData item to be sent to + the server as the body of the request. +
  • GSHTTPPropertyMethodKey - override the default method of the request (eg. "PUT"). diff --git a/Headers/gnustep/base/NSURLHandle.h b/Headers/gnustep/base/NSURLHandle.h index 85eac825b..43ab25784 100644 --- a/Headers/gnustep/base/NSURLHandle.h +++ b/Headers/gnustep/base/NSURLHandle.h @@ -38,6 +38,7 @@ 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; diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m index a7919a30f..49031e393 100644 --- a/Source/GSHTTPURLHandle.m +++ b/Source/GSHTTPURLHandle.m @@ -720,7 +720,7 @@ static void debugWrite(NSData *data) - (BOOL) writeData: (NSData*)d { - ASSIGN(wData, d); + [self writeProperty: d forKey: GSHTTPPropertyBodyKey]; [self loadInForeground]; return YES; } @@ -732,7 +732,11 @@ static void debugWrite(NSData *data) [NSException raise: NSInvalidArgumentException format: @"%@ with invalid key", NSStringFromSelector(_cmd)]; } - if ([propertyKey hasPrefix: @"GSHTTPProperty"]) + if ([propertyKey isEqual: GSHTTPPropertyBodyKey] == YES) + { + ASSIGN(wData, property); + } + else if ([propertyKey hasPrefix: @"GSHTTPProperty"]) { if (property == nil) { diff --git a/Source/externs.m b/Source/externs.m index bda2c2779..c1d852fb7 100644 --- a/Source/externs.m +++ b/Source/externs.m @@ -283,6 +283,8 @@ NSString *NSHTTPPropertyRedirectionHeadersKey; NSString *NSHTTPPropertyErrorPageDataKey; /* These are GNUstep extras */ +NSString *GSHTTPPropertyBodyKey; + NSString *GSHTTPPropertyMethodKey; NSString *GSHTTPPropertyProxyHostKey; @@ -517,6 +519,8 @@ GSBuildStrings() NSHTTPPropertyErrorPageDataKey = [[SClass alloc] initWithCString: "HTTPPropertyErrorPageDataKey"]; + GSHTTPPropertyBodyKey + = [[SClass alloc] initWithCString: "GSHTTPPropertyBodyKey"]; GSHTTPPropertyMethodKey = [[SClass alloc] initWithCString: "GSHTTPPropertyMethodKey"]; GSHTTPPropertyProxyHostKey