forked from AlanQuatermain/aqtoolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Brought in changes from Kobo application, including a few new feature…
…s and many bug fixes. AQXMLParser in particular is much more resistant to stream errors and timeouts now, and there is a subclass available which allows the caller to explicitly specify a timeout.
- Loading branch information
Jim Dovey
committed
Dec 14, 2010
1 parent
081d518
commit 2bb3a90
Showing
12 changed files
with
449 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// NSStream+HTTPMessage.h | ||
// Kobov3 | ||
// | ||
// Created by Jim Dovey on 10-04-08. | ||
// Copyright 2010 Kobo Inc. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "HTTPMessage.h" | ||
|
||
@interface NSStream (HTTPMessage) | ||
|
||
- (HTTPMessage *) finalRequestMessage; | ||
- (HTTPMessage *) responseMessageHeader; | ||
|
||
- (NSURL *) finalURL; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// NSStream+HTTPMessage.m | ||
// Kobov3 | ||
// | ||
// Created by Jim Dovey on 10-04-08. | ||
// Copyright 2010 Kobo Inc. All rights reserved. | ||
// | ||
|
||
#import "NSStream+HTTPMessage.h" | ||
|
||
#if TARGET_OS_IPHONE | ||
#import <CFNetwork/CFNetwork.h> | ||
#else | ||
#import <CoreServices/CoreServices.h> | ||
#endif | ||
|
||
@implementation NSStream (HTTPMessage) | ||
|
||
- (HTTPMessage *) finalRequestMessage | ||
{ | ||
CFHTTPMessageRef cf = NULL; | ||
if ( [self isKindOfClass: [NSInputStream class]] ) | ||
cf = (CFHTTPMessageRef)CFReadStreamCopyProperty( (CFReadStreamRef)self, kCFStreamPropertyHTTPFinalRequest ); | ||
else | ||
cf = (CFHTTPMessageRef)CFWriteStreamCopyProperty( (CFWriteStreamRef)self, kCFStreamPropertyHTTPFinalRequest ); | ||
if ( cf == NULL ) | ||
return ( nil ); | ||
|
||
HTTPMessage * result = [[HTTPMessage alloc] initWithCFHTTPMessageRef: cf]; | ||
CFRelease( cf ); | ||
|
||
return ( [result autorelease] ); | ||
} | ||
|
||
- (HTTPMessage *) responseMessageHeader | ||
{ | ||
CFHTTPMessageRef cf = NULL; | ||
if ( [self isKindOfClass: [NSInputStream class]] ) | ||
cf = (CFHTTPMessageRef)CFReadStreamCopyProperty( (CFReadStreamRef)self, kCFStreamPropertyHTTPResponseHeader ); | ||
else | ||
cf = (CFHTTPMessageRef)CFWriteStreamCopyProperty( (CFWriteStreamRef)self, kCFStreamPropertyHTTPResponseHeader ); | ||
if ( cf == NULL ) | ||
return ( nil ); | ||
|
||
HTTPMessage * result = [[HTTPMessage alloc] initWithCFHTTPMessageRef: cf]; | ||
CFRelease( cf ); | ||
|
||
return ( [result autorelease] ); | ||
} | ||
|
||
- (NSURL *) finalURL | ||
{ | ||
return ( (NSURL *)[self propertyForKey: (NSString *)kCFStreamPropertyHTTPFinalURL] ); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.