author | snej@snej-mbp.mtv.corp.google.com |
Wed Apr 08 16:31:19 2009 -0700 (2009-04-08) | |
changeset 24 | 629c7605ab2a |
parent 11 | e5976864dfe9 |
permissions | -rw-r--r-- |
jens@7 | 1 |
// |
jens@7 | 2 |
// URLUtils.h |
jens@11 | 3 |
// MYUtilities |
jens@7 | 4 |
// |
jens@7 | 5 |
// Created by Jens Alfke on 4/28/08. |
jens@11 | 6 |
// Copyright 2008 Jens Alfke. All rights reserved. |
jens@7 | 7 |
// |
jens@7 | 8 |
|
jens@7 | 9 |
#import <Foundation/Foundation.h> |
jens@7 | 10 |
|
jens@7 | 11 |
|
jens@17 | 12 |
@interface NSURL (MYUtilities) |
jens@17 | 13 |
|
jens@17 | 14 |
/** Smart/lenient version of +URLWithString:, for use with user-entered URLs. |
jens@17 | 15 |
- Strips out any whitespace or newlines |
jens@17 | 16 |
- Removes surrounding "<...>" |
jens@17 | 17 |
- Adds a default scheme like http: if necessary, if one is provided |
jens@17 | 18 |
- Checks against a list of allowed schemes, if one is provided */ |
jens@17 | 19 |
+ (NSURL*) my_URLWithLenientString: (NSString*)string |
jens@17 | 20 |
defaultScheme: (NSString*)defaultScheme |
jens@17 | 21 |
allowedSchemes: (NSArray*)allowedSchemes; |
jens@17 | 22 |
@end |
jens@17 | 23 |
|
jens@17 | 24 |
|
jens@7 | 25 |
@interface NSHTTPURLResponse (MYUtilities) |
jens@7 | 26 |
|
jens@7 | 27 |
- (NSError*) HTTPError; |
jens@7 | 28 |
|
jens@7 | 29 |
@end |
jens@7 | 30 |
|
jens@7 | 31 |
extern NSString* const MyHTTPErrorDomain; |