URLUtils.h
author snej@snej.local
Sun Apr 12 22:00:36 2009 -0700 (2009-04-12)
changeset 25 47d10ac2d04e
parent 11 e5976864dfe9
permissions -rw-r--r--
Fixed some incorrect CSSM error code strings. Removed a log call from MYError.
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;