mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Macos compatibility tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27739 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b326420a1a
commit
34e8be56be
3 changed files with 27 additions and 20 deletions
|
@ -1,6 +1,10 @@
|
|||
2009-01-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSURL.m: For file URL, make relative path absolute.
|
||||
* Source/GSHTTPURLHandle.m:
|
||||
* Source/Additions/GSMime.m:
|
||||
Change HTTP status code to be an NSNumber rather than NSString
|
||||
for MacOS-X compatibility
|
||||
|
||||
2009-01-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -1524,12 +1524,12 @@ wordData(NSString *word)
|
|||
info = [[document headersNamed: @"http"] lastObject];
|
||||
if (info != nil && flags.isHttp == 1)
|
||||
{
|
||||
NSString *val;
|
||||
NSNumber *num;
|
||||
|
||||
val = [info objectForKey: NSHTTPPropertyStatusCodeKey];
|
||||
if (val != nil)
|
||||
num = [info objectForKey: NSHTTPPropertyStatusCodeKey];
|
||||
if (num != nil)
|
||||
{
|
||||
int v = [val intValue];
|
||||
int v = [num intValue];
|
||||
|
||||
if (v >= 100 && v < 200)
|
||||
{
|
||||
|
@ -1612,7 +1612,7 @@ wordData(NSString *word)
|
|||
* <term>NSHTTPPropertyServerHTTPVersionKey</term>
|
||||
* <desc>The full HTTP protocol version number</desc>
|
||||
* <term>NSHTTPPropertyStatusCodeKey</term>
|
||||
* <desc>The HTTP status code</desc>
|
||||
* <desc>The HTTP status code (numeric)</desc>
|
||||
* <term>NSHTTPPropertyStatusReasonKey</term>
|
||||
* <desc>The text message (if any) after the status code</desc>
|
||||
* </deflist>
|
||||
|
@ -1881,7 +1881,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
forKey: @"HttpVersion"];
|
||||
[info setObject: [NSStringClass stringWithFormat: @"%d", major]
|
||||
forKey: NSHTTPPropertyServerHTTPVersionKey];
|
||||
[info setObject: [NSStringClass stringWithFormat: @"%d", status]
|
||||
[info setObject: [NSNumber numberWithInt: status]
|
||||
forKey: NSHTTPPropertyStatusCodeKey];
|
||||
[self scanPastSpace: scanner];
|
||||
value = [[scanner string] substringFromIndex: [scanner scanLocation]];
|
||||
|
|
|
@ -593,12 +593,12 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
GSMimeHeader *info;
|
||||
NSString *enc;
|
||||
NSString *len;
|
||||
NSString *status;
|
||||
int status;
|
||||
float ver;
|
||||
|
||||
info = [document headerNamed: @"http"];
|
||||
ver = [[info value] floatValue];
|
||||
status = [info objectForKey: NSHTTPPropertyStatusCodeKey];
|
||||
status = [[info objectForKey: NSHTTPPropertyStatusCodeKey] intValue];
|
||||
len = [[document headerNamed: @"content-length"] value];
|
||||
enc = [[document headerNamed: @"content-transfer-encoding"] value];
|
||||
if (enc == nil)
|
||||
|
@ -606,7 +606,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
enc = [[document headerNamed: @"transfer-encoding"] value];
|
||||
}
|
||||
|
||||
if ([status isEqual: @"204"] || [status isEqual: @"304"])
|
||||
if (status == 204 || status == 304)
|
||||
{
|
||||
complete = YES; // No body expected.
|
||||
}
|
||||
|
@ -623,6 +623,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
{
|
||||
GSMimeHeader *info;
|
||||
NSString *val;
|
||||
NSNumber *num;
|
||||
float ver;
|
||||
int code;
|
||||
|
||||
|
@ -642,8 +643,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
* Retrieve essential keys from document
|
||||
*/
|
||||
info = [document headerNamed: @"http"];
|
||||
val = [info objectForKey: NSHTTPPropertyStatusCodeKey];
|
||||
code = [val intValue];
|
||||
num = [info objectForKey: NSHTTPPropertyStatusCodeKey];
|
||||
code = [num intValue];
|
||||
if (code == 401 && self->challenged < 2)
|
||||
{
|
||||
GSMimeHeader *ah;
|
||||
|
@ -720,9 +721,9 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (val != nil)
|
||||
if (num != nil)
|
||||
{
|
||||
[pageInfo setObject: val forKey: NSHTTPPropertyStatusCodeKey];
|
||||
[pageInfo setObject: num forKey: NSHTTPPropertyStatusCodeKey];
|
||||
}
|
||||
val = [info objectForKey: NSHTTPPropertyServerHTTPVersionKey];
|
||||
if (val != nil)
|
||||
|
@ -818,15 +819,16 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
{
|
||||
GSMimeHeader *info;
|
||||
NSString *val;
|
||||
NSNumber *num;
|
||||
|
||||
[p parse: nil];
|
||||
info = [[p mimeDocument] headerNamed: @"http"];
|
||||
val = [info objectForKey: NSHTTPPropertyServerHTTPVersionKey];
|
||||
if (val != nil)
|
||||
[pageInfo setObject: val forKey: NSHTTPPropertyServerHTTPVersionKey];
|
||||
val = [info objectForKey: NSHTTPPropertyStatusCodeKey];
|
||||
if (val != nil)
|
||||
[pageInfo setObject: val forKey: NSHTTPPropertyStatusCodeKey];
|
||||
num = [info objectForKey: NSHTTPPropertyStatusCodeKey];
|
||||
if (num != nil)
|
||||
[pageInfo setObject: num forKey: NSHTTPPropertyStatusCodeKey];
|
||||
val = [info objectForKey: NSHTTPPropertyStatusReasonKey];
|
||||
if (val != nil)
|
||||
[pageInfo setObject: val forKey: NSHTTPPropertyStatusReasonKey];
|
||||
|
@ -926,7 +928,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
NSTimeInterval limit = 0.01;
|
||||
NSData *buf;
|
||||
NSDate *when;
|
||||
NSString *status;
|
||||
int status;
|
||||
NSString *version;
|
||||
|
||||
version = [request objectForKey: NSHTTPPropertyServerHTTPVersionKey];
|
||||
|
@ -949,7 +951,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
* Set up default status for if connection is lost.
|
||||
*/
|
||||
[pageInfo setObject: @"1.0" forKey: NSHTTPPropertyServerHTTPVersionKey];
|
||||
[pageInfo setObject: @"503" forKey: NSHTTPPropertyStatusCodeKey];
|
||||
[pageInfo setObject: [NSNumber numberWithInt: 503]
|
||||
forKey: NSHTTPPropertyStatusCodeKey];
|
||||
[pageInfo setObject: @"Connection dropped by proxy server"
|
||||
forKey: NSHTTPPropertyStatusReasonKey];
|
||||
|
||||
|
@ -978,8 +981,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
}
|
||||
RELEASE(when);
|
||||
|
||||
status = [pageInfo objectForKey: NSHTTPPropertyStatusCodeKey];
|
||||
if ([status isEqual: @"200"] == NO)
|
||||
status = [[pageInfo objectForKey: NSHTTPPropertyStatusCodeKey] intValue];
|
||||
if (status != 200)
|
||||
{
|
||||
[self endLoadInBackground];
|
||||
[self backgroundLoadDidFailWithReason: @"Failed proxy tunneling"];
|
||||
|
|
Loading…
Reference in a new issue