mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Tidyup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8143 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
999cd23cc9
commit
2ae159cbfd
6 changed files with 85 additions and 10 deletions
|
@ -53,6 +53,16 @@
|
|||
</desc>
|
||||
</method>
|
||||
|
||||
<method type="NSData*">
|
||||
<sel>data</sel>
|
||||
<desc>
|
||||
Return the data accumulated in the parser. If the parser is
|
||||
still parsing headers, this will be the header data read so far.
|
||||
If the parse has parsed the body of the message, this will be
|
||||
the data of the body, with any transfer encoding removed.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method type="BOOL">
|
||||
<sel>decodeData:</sel>
|
||||
<arg type="NSData*">sourceData</arg>
|
||||
|
@ -129,15 +139,15 @@
|
|||
contains -
|
||||
</p>
|
||||
<deflist>
|
||||
<term>HttpVersion</term>
|
||||
<desc>The full HTTP protocol version number</desc>
|
||||
<term>HttpMajorVersion</term>
|
||||
<desc>The first part of the version number</desc>
|
||||
<term>HttpMinorVersion</term>
|
||||
<desc>The second part of the version number</desc>
|
||||
<term>HttpStatus</term>
|
||||
<term>NSHTTPPropertyServerHTTPVersionKey</term>
|
||||
<desc>The full HTTP protocol version number</desc>
|
||||
<term>NSHTTPPropertyStatusCodeKey</term>
|
||||
<desc>The HTTP status code</desc>
|
||||
<term>Value</term>
|
||||
<term>NSHTTPPropertyStatusReasonKey</term>
|
||||
<desc>The text message (if any) after the status code</desc>
|
||||
</deflist>
|
||||
</desc>
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
unsigned lineEnd;
|
||||
unsigned input;
|
||||
BOOL inBody;
|
||||
BOOL complete;
|
||||
NSData *boundary;
|
||||
GSMimeDocument *document;
|
||||
GSMimeParser *child;
|
||||
|
@ -90,6 +91,7 @@
|
|||
+ (GSMimeParser*) mimeParser;
|
||||
|
||||
- (GSMimeCodingContext*) contextFor: (NSDictionary*)headerInfo;
|
||||
- (NSData*) data;
|
||||
- (BOOL) decodeData: (NSData*)sData
|
||||
fromRange: (NSRange)aRange
|
||||
intoData: (NSMutableData*)dData
|
||||
|
|
|
@ -37,6 +37,13 @@ GS_EXPORT NSString *NSHTTPPropertyServerHTTPVersionKey;
|
|||
GS_EXPORT NSString *NSHTTPPropertyRedirectionHeadersKey;
|
||||
GS_EXPORT NSString *NSHTTPPropertyErrorPageDataKey;
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
GS_EXPORT NSString *GSHTTPPropertyMethodKey;
|
||||
GS_EXPORT NSString *GSHTTPPropertyProxyHostKey;
|
||||
GS_EXPORT NSString *GSHTTPPropertyProxyPortKey;
|
||||
GS_EXPORT NSString *GSHTTPBodyKey;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NSURLHandleNotLoaded = 0,
|
||||
|
|
|
@ -327,6 +327,7 @@ NSURLHandle.h
|
|||
ifeq ($(HAVE_LIBXML),1)
|
||||
BASE_HEADERS += GSXML.h
|
||||
endif
|
||||
BASE_HEADERS += GSMime.h
|
||||
|
||||
UNICODE_HEADERS = \
|
||||
unicode/caseconv.h \
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSURL.h>
|
||||
#include <Foundation/NSURLHandle.h>
|
||||
#include <Foundation/GSMime.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -302,6 +305,11 @@ parseCharacterSet(NSString *token)
|
|||
return AUTORELEASE([[self alloc] init]);
|
||||
}
|
||||
|
||||
- (NSData*) data
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(data);
|
||||
|
@ -324,7 +332,6 @@ parseCharacterSet(NSString *token)
|
|||
}
|
||||
if (info == nil)
|
||||
{
|
||||
NSLog(@"contextFor: - nil header ... assumed binary encoding");
|
||||
return defaultContext;
|
||||
}
|
||||
|
||||
|
@ -775,7 +782,7 @@ parseCharacterSet(NSString *token)
|
|||
|
||||
- (BOOL) parse: (NSData*)d
|
||||
{
|
||||
if (data == nil)
|
||||
if (complete == YES)
|
||||
{
|
||||
return NO; /* Already completely parsed! */
|
||||
}
|
||||
|
@ -839,7 +846,7 @@ parseCharacterSet(NSString *token)
|
|||
*/
|
||||
result = [self parse: [NSData dataWithBytes: @"\r\n\r\n" length: 4]];
|
||||
}
|
||||
DESTROY(data);
|
||||
complete = YES; /* Finished parsing */
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1055,16 +1062,19 @@ parseCharacterSet(NSString *token)
|
|||
NSLog(@"Bad value for http status");
|
||||
return NO;
|
||||
}
|
||||
[info setObject: [NSString stringWithFormat: @"%d", major]
|
||||
forKey: @"HttpMajorVersion"];
|
||||
[info setObject: [NSString stringWithFormat: @"%d", minor]
|
||||
forKey: @"HttpMinorVersion"];
|
||||
[info setObject: [NSString stringWithFormat: @"%d.%d", major, minor]
|
||||
forKey: @"HttpVersion"];
|
||||
[info setObject: [NSString stringWithFormat: @"%d", major]
|
||||
forKey: NSHTTPPropertyServerHTTPVersionKey];
|
||||
[info setObject: [NSString stringWithFormat: @"%d", status]
|
||||
forKey: @"HttpStatus"];
|
||||
forKey: NSHTTPPropertyStatusCodeKey];
|
||||
[self scanPastSpace: scanner];
|
||||
value = [[scanner string] substringFromIndex: [scanner scanLocation]];
|
||||
[info setObject: value
|
||||
forKey: NSHTTPPropertyStatusReasonKey];
|
||||
value = nil;
|
||||
}
|
||||
else if ([name isEqualToString: @"content-transfer-encoding"] == YES
|
||||
|| [name isEqualToString: @"transfer-encoding"] == YES)
|
||||
|
@ -1507,6 +1517,8 @@ parseCharacterSet(NSString *token)
|
|||
|
||||
if ([context atEnd] == YES)
|
||||
{
|
||||
complete = YES;
|
||||
|
||||
/*
|
||||
* If no content type is supplied, we assume text.
|
||||
*/
|
||||
|
|
|
@ -269,6 +269,29 @@ NSString *NSConnectionLocalCount;
|
|||
|
||||
NSString *NSConnectionProxyCount;
|
||||
|
||||
/*
|
||||
* Keys for NSURLHandle
|
||||
*/
|
||||
NSString *NSHTTPPropertyStatusCodeKey;
|
||||
|
||||
NSString *NSHTTPPropertyStatusReasonKey;
|
||||
|
||||
NSString *NSHTTPPropertyServerHTTPVersionKey;
|
||||
|
||||
NSString *NSHTTPPropertyRedirectionHeadersKey;
|
||||
|
||||
NSString *NSHTTPPropertyErrorPageDataKey;
|
||||
|
||||
/* These are GNUstep extras */
|
||||
NSString *GSHTTPPropertyMethodKey;
|
||||
|
||||
NSString *GSHTTPPropertyProxyHostKey;
|
||||
|
||||
NSString *GSHTTPPropertyProxyPortKey;
|
||||
|
||||
NSString *GSHTTPBodyKey;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Setup function called when NSString is initialised.
|
||||
|
@ -475,6 +498,26 @@ GSBuildStrings()
|
|||
= [[SClass alloc] initWithCString: "PortBecameInvalidNotification"];
|
||||
StreamException
|
||||
= [[SClass alloc] initWithCString: "StreamException"];
|
||||
|
||||
NSHTTPPropertyStatusCodeKey
|
||||
= [[SClass alloc] initWithCString: "HTTPPropertyStatusCodeKey"];
|
||||
NSHTTPPropertyStatusReasonKey
|
||||
= [[SClass alloc] initWithCString: "HTTPPropertyStatusReasonKey"];
|
||||
NSHTTPPropertyServerHTTPVersionKey
|
||||
= [[SClass alloc] initWithCString: "HTTPPropertyServerHTTPVersionKey"];
|
||||
NSHTTPPropertyRedirectionHeadersKey
|
||||
= [[SClass alloc] initWithCString: "HTTPPropertyRedirectionHeadersKey"];
|
||||
NSHTTPPropertyErrorPageDataKey
|
||||
= [[SClass alloc] initWithCString: "HTTPPropertyErrorPageDataKey"];
|
||||
|
||||
GSHTTPPropertyMethodKey
|
||||
= [[SClass alloc] initWithCString: "GSHTTPPropertyMethodKey"];
|
||||
GSHTTPPropertyProxyHostKey
|
||||
= [[SClass alloc] initWithCString: "GSHTTPPropertyProxyHostKey"];
|
||||
GSHTTPPropertyProxyPortKey
|
||||
= [[SClass alloc] initWithCString: "GSHTTPPropertyProxyPortKey"];
|
||||
GSHTTPBodyKey
|
||||
= [[SClass alloc] initWithCString: "GSHTTPBodyKey"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue