URLUtils.h
author Jens Alfke <jens@mooseyard.com>
Sun May 03 10:13:31 2009 -0700 (2009-05-03)
changeset 27 256370e8935a
parent 11 e5976864dfe9
permissions -rw-r--r--
* MYTask: Added -commandLine, overhauled logging.
* MYDirectoryWatcher: Overhauled logging.
* MYErrorUtils: Disabled use of Security API (so it'll build without linking against Security.framework.)
     1 //
     2 //  URLUtils.h
     3 //  MYUtilities
     4 //
     5 //  Created by Jens Alfke on 4/28/08.
     6 //  Copyright 2008 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import <Foundation/Foundation.h>
    10 
    11 
    12 @interface NSURL (MYUtilities)
    13 
    14 /** Smart/lenient version of +URLWithString:, for use with user-entered URLs.
    15     - Strips out any whitespace or newlines
    16     - Removes surrounding "<...>"
    17     - Adds a default scheme like http: if necessary, if one is provided
    18     - Checks against a list of allowed schemes, if one is provided */
    19 + (NSURL*) my_URLWithLenientString: (NSString*)string 
    20                      defaultScheme: (NSString*)defaultScheme
    21                     allowedSchemes: (NSArray*)allowedSchemes;
    22 @end
    23 
    24 
    25 @interface NSHTTPURLResponse (MYUtilities)
    26 
    27 - (NSError*) HTTPError;
    28 
    29 @end
    30 
    31 extern NSString* const MyHTTPErrorDomain;