jens@7: // jens@7: // URLUtils.h jens@11: // MYUtilities jens@7: // jens@7: // Created by Jens Alfke on 4/28/08. jens@11: // Copyright 2008 Jens Alfke. All rights reserved. jens@7: // jens@7: jens@7: #import jens@7: jens@7: jens@17: @interface NSURL (MYUtilities) jens@17: jens@17: /** Smart/lenient version of +URLWithString:, for use with user-entered URLs. jens@17: - Strips out any whitespace or newlines jens@17: - Removes surrounding "<...>" jens@17: - Adds a default scheme like http: if necessary, if one is provided jens@17: - Checks against a list of allowed schemes, if one is provided */ jens@17: + (NSURL*) my_URLWithLenientString: (NSString*)string jens@17: defaultScheme: (NSString*)defaultScheme jens@17: allowedSchemes: (NSArray*)allowedSchemes; jens@17: @end jens@17: jens@17: jens@7: @interface NSHTTPURLResponse (MYUtilities) jens@7: jens@7: - (NSError*) HTTPError; jens@7: jens@7: @end jens@7: jens@7: extern NSString* const MyHTTPErrorDomain;