Class: NSHTTPCookie
Overview
An NSHTTPCookie object represents an HTTP cookie. It’s an immutable object initialized from a dictionary containing the cookie attributes.
Class Method Summary (collapse)
-
+ cookiesWithResponseHeaderFields:forURL:
Returns an array of NSHTTPCookie objects corresponding to the provided response header fields for the provided URL.
-
+ cookieWithProperties:
Creates and initializes an NSHTTPCookie object using the provided properties.
-
+ requestHeaderFieldsWithCookies:
Returns a dictionary of header fields corresponding to a provided array of cookies.
Instance Method Summary (collapse)
-
- comment
Returns the receiver's comment string.
-
- commentURL
Returns the receiver’s comment URL.
-
- domain
Returns the domain of the receiver’s cookie.
-
- expiresDate
Returns the receiver’s expiration date.
-
- initWithProperties:
Returns an initialized NSHTTPCookie object using the provided properties.
-
- isHTTPOnly
Returns whether the receiver should only be sent to HTTP servers per RFC 2965.
-
- isSecure
Returns whether his cookie should only be sent over secure channels.
-
- isSessionOnly
Returns whether the receiver should be discarded at the end of the session (regardless of expiration date).
-
- name
Returns the receiver’s name.
-
- path
Returns the receiver’s path.
-
- portList
Returns the receiver's port list.
-
- properties
Returns the receiver’s cookie properties.
-
- value
Returns the receiver’s value.
-
- version
Returns the receiver’s version.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (Array) cookiesWithResponseHeaderFields(headerFields, forURL:theURL)
Returns an array of NSHTTPCookie objects corresponding to the provided response header fields for the provided URL. This method ignores irrelevant header fields in headerFields, allowing dictionaries to contain additional data.If headerFields does not specify a domain for a given cookie, the cookie is created with a default domain value of theURL.If headerFields does not specify a path for a given cookie, the cookie is created with a default path value of “/”.
+ (Object) cookieWithProperties(properties)
Creates and initializes an NSHTTPCookie object using the provided properties. See “Constants” for more information on the available header field constants and the constraints imposed on the values in the dictionary.
+ (Hash) requestHeaderFieldsWithCookies(cookies)
Returns a dictionary of header fields corresponding to a provided array of cookies. See “Constants” for details on the header field keys and values in the returned dictionary.
Instance Method Details
- (String) comment
Returns the receiver's comment string.
- (NSURL) commentURL
Returns the receiver’s comment URL.
- (String) domain
Returns the domain of the receiver’s cookie. If the domain does not start with a dot, then the cookie is only sent to the exact host specified by the domain. If the domain does start with a dot, then the cookie is sent to other hosts in that domain as well, subject to certain restrictions. See RFC 2965 for more detail.
- (NSDate) expiresDate
Returns the receiver’s expiration date.
- (Object) initWithProperties(properties)
Returns an initialized NSHTTPCookie object using the provided properties. See “Constants” for more information on the available header field constants and the constraints imposed on the values in the dictionary.
- (Boolean) isHTTPOnly
Returns whether the receiver should only be sent to HTTP servers per RFC 2965. Cookies may be marked as HTTP only by a server (or by a javascript). Cookies marked as such must only be sent via HTTP Headers in HTTP requests for URL’s that match both the path and domain of the respective cookies. Important: Cookies specified as HTTP only should not be delivered to any javascript applications to prevent cross-site scripting vulnerabilities.
- (Boolean) isSecure
Returns whether his cookie should only be sent over secure channels.
- (Boolean) isSessionOnly
Returns whether the receiver should be discarded at the end of the session (regardless of expiration date).
- (String) name
Returns the receiver’s name.
- (String) path
Returns the receiver’s path. The cookie will be sent with requests for this path in the cookie’s domain, and all paths that have this prefix. A path of “/” means the cookie will be sent for all URLs in the domain.
- (Array) portList
Returns the receiver's port list.
- (Hash) properties
Returns the receiver’s cookie properties. This dictionary can be used with initWithProperties: or cookieWithProperties: to create an equivalent NSHTTPCookie object.See initWithProperties: for more information on the constraints imposed on the properties dictionary.
- (String) value
Returns the receiver’s value.
- (Integer) version
Returns the receiver’s version.