Up

NSHTTPCookie class documentation

Authors

Generated by fedor

Software documentation for the NSHTTPCookie class

NSHTTPCookie : NSObject

Declared in:
Foundation/NSHTTPCookie.h
Availability: MacOS-X 10.2.0, Base 1.13.0

An instance of the NSHTTPCookie class is a single, immutable http cookie. It can be initialised with properties from a dictionary and has accessor methods to obtain the cookie values.
The class supports unversioned cookies (sometimes referred to as version 0) as originally produced by netscape, as well as more recent standardised and versioned cookies.
Method summary

cookieWithProperties: 

+ (id) cookieWithProperties: (NSDictionary*)properties;
Availability: MacOS-X 10.2.0, Base 1.13.0

Allocates and returns an autoreleasd instance using -initWithProperties: to initialise it from properties.

cookiesWithResponseHeaderFields: forURL: 

+ (NSArray*) cookiesWithResponseHeaderFields: (NSDictionary*)headerFields forURL: (NSURL*)URL;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns an array of cookies parsed from the headerFields and URL (assuming that the headerFields came from a response to a request sent to the URL).
The headerFields dictionary must contain at least all the headers relevant to cookie setting... other headers are ignored.

requestHeaderFieldsWithCookies: 

+ (NSDictionary*) requestHeaderFieldsWithCookies: (NSArray*)cookies;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns a dictionary of header fields that can be used to add the specified cookies to a request.

comment 

- (NSString*) comment;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns a string which may be used to describe the cookie to the user, or nil if no comment is set.

commentURL 

- (NSURL*) commentURL;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns a URL where the user can find out about the cookie, or nil if no comment URL is set.

domain 

- (NSString*) domain;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the domain to which the cookie should be sent.
If there is a leading dot then subdomains should also receive the cookie as specified in RFC 2965.

expiresDate 

- (NSDate*) expiresDate;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the expiry date of the receiver or nil if there is no such date.

initWithProperties: 

- (id) initWithProperties: (NSDictionary*)properties;
Availability: MacOS-X 10.2.0, Base 1.13.0

This is a designated initialiser for the class.
Initialises the receiver with a dictionary of properties.
Unrecognised keys are ignored.
Returns nil if a required key is missing or if an illegal value is specified for a key.
NSHTTPCookieComment
The NSString comment for the cookie (if any).
This is nil by default and for unversioned cookies.
NSHTTPCookieCommentURL
The NSString or NSURL URL to get the comment for the cookie.
This is nil by default and for unversioned cookies.
NSHTTPCookieDomain
The NSString specified the domain to which the cookie applies.
This is extracted from NSHTTPCookieOriginURL if not specified.
NSHTTPCookieDiscard
A NSString (either TRUE or FALSE) saying whether the cookie is to be discarded when the session ends.
Defaults to FALSE except for versioned cookies where NSHTTPCookieMaximumAge is unspecified.
NSHTTPCookieExpires
The NSDate or NSString (format Wdy, DD-Mon-YYYY HH:MM:SS GMT) specifying when an unversioned cookie expires and ignored for versioned cookies.
NSHTTPCookieMaximumAge
An NSString containing an integer value specifying the longest time (in seconds) for which the cookie is valid.
This defaults to zero and is only meaningful for versioned cookies.
NSHTTPCookieName
An NSString ... obvious... no default value.
NSHTTPCookieOriginURL
An NSString or NSURL specifying the URL which set the cookie.
Must be supplied if NSHTTPCookieDomain is not.
NSHTTPCookiePath
An NSString specifying the path from the cookie.
If unspecified this value is determined from NSHTTPCookieOriginURL or defaults to '/'.
NSHTTPCookiePort
An NSString containing a comma separated list of integer port numbers. This is valid for versioned cookies and defaults to an empty string.
NSHTTPCookieSecure
An NSString saying whether the cookie may be sent over insecure connections.
The default is FALSE meaning that it may be sent insecurely.
NSHTTPCookieValue
An NSString containing the whole value of the cooke.
This parameter must be provided.
NSHTTPCookieVersion
An NSString specifying the cookie version... for an unversioned cookie (the default) this is '0'.
Also supports version '1'.

isSecure 

- (BOOL) isSecure;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns whether the receiver should only be sent over secure connections.

isSessionOnly 

- (BOOL) isSessionOnly;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns whether the receiver should be destroyed at the end of the session.

name 

- (NSString*) name;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the name of the receiver.

path 

- (NSString*) path;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the URL path within the cookie's domain for which this cookie must be sent.

portList 

- (NSArray*) portList;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the list of ports to which the receiver should be sent, or nil if the cookie can be used for any port.

properties 

- (NSDictionary*) properties;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns a dictionary representation of the receiver which could be used as the argument for -initWithProperties: to recreate a copy of the receiver.

value 

- (NSString*) value;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the value of the receiver.

version 

- (NSUInteger) version;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns 0 for an unversioned Netscape style cookie or a positive integer for a versioned cookie.


Up