Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSHTTPCookieMBS class.

NSHTTPCookieMBS.Constructor(properties as dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacControls Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates an initialized NSHTTPCookie object using the provided properties.
Example
// create dictionary with properties:
dim prop as new Dictionary
dim d as new date
d.Year = d.Year + 1

prop.Value(NSHTTPCookieMBS.NSHTTPCookieVersion)="0"
prop.Value(NSHTTPCookieMBS.NSHTTPCookieName)="test"
prop.Value(NSHTTPCookieMBS.NSHTTPCookieValue)="some value"
prop.Value(NSHTTPCookieMBS.NSHTTPCookieOriginURL)="http://www.mbsplugins.de/"
prop.Value(NSHTTPCookieMBS.NSHTTPCookieDomain)="www.mbsplugins.de"
prop.Value(NSHTTPCookieMBS.NSHTTPCookiePath)="/"
prop.Value(NSHTTPCookieMBS.NSHTTPCookieExpires)=d

// create cookie from properties
dim cookie as new NSHTTPCookieMBS(prop)

// and display properties
dim dic as Dictionary = cookie.properties
dim list(-1) as string

for each key as Variant in dic.keys
List.Append key.StringValue+": "+dic.Value(key).StringValue
next

MsgBox Join(list,EndOfLine)

properties: The properties for the new cookie object, expressed as key value pairs.

Handle is non zero on success.

NSHTTPCookieMBS.portList as Integer()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacControls Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the receiver's port list.
Example
// query list of all cookies in shared storage
dim cookies(-1) as NSHTTPCookieMBS = NSHTTPCookieStorageMBS.sharedHTTPCookieStorage.cookies

// pick first one
dim cookie as NSHTTPCookieMBS = cookies(0)

// display port list

dim PortList(-1) as Integer = cookie.portList
if UBound(PortList)=-1 then
MsgBox "Port List: all ports."
else
dim list(-1) as string
for each port as Integer in portList
List.Append str(port)
next

MsgBox "Port List: "+Join(list, ", ")
end if

The list of ports for the cookie, returned as an array of integers. If the cookie has no port list this method returns nil and the cookie will be sent to any port. Otherwise, the cookie is only sent to ports specified in the port list.

The items on this page are in the following plugins: MBS MacControls Plugin.


The biggest plugin in space...