Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtNetwork.QNetworkCookie Class Reference

The QNetworkCookie class holds one network cookie. More...

Inheritance diagram for QtNetwork.QNetworkCookie:
Collaboration diagram for QtNetwork.QNetworkCookie:

Public Types

enum  RawForm { Full = 1, NameAndValueOnly = 0 }
  More...
 

Public Member Functions

override bool Equals (object o)
 
override int GetHashCode ()
 
 QNetworkCookie ()
 
 
 QNetworkCookie (QNetworkCookie other)
 
 
 QNetworkCookie (QByteArray name)
 
 
 QNetworkCookie (QByteArray name, QByteArray value)
 
 
virtual void CreateProxy ()
 
new bool IsHttpOnly ()
 
 
new bool IsSecure ()
 
 
new bool IsSessionCookie ()
 
 
new void SetHttpOnly (bool enable)
 
 
new void SetSecure (bool enable)
 
 
new QByteArray ToRawForm (QNetworkCookie.RawForm form=QNetworkCookie.RawForm.Full)
 
 
new void Dispose ()
 

Static Public Member Functions

static bool operator!= (QNetworkCookie arg1, QNetworkCookie arg2)
 
 
static bool operator== (QNetworkCookie arg1, QNetworkCookie arg2)
 
 
static
System.Collections.Generic.List
< QNetworkCookie
ParseCookies (QByteArray cookieString)
 
 

Protected Member Functions

 QNetworkCookie (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

new string Domain [get, set]
 
 
new QDateTime ExpirationDate [get, set]
 
 
new QByteArray Name [get, set]
 
 
new string Path [get, set]
 
 
new QByteArray Value [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QNetworkCookie class holds one network cookie.

Cookies are small bits of information that stateless protocols like HTTP use to maintain some persistent information across requests.

A cookie is set by a remote server when it replies to a request and it expects the same cookie to be sent back when further requests are sent.

QNetworkCookie holds one such cookie as received from the network. A cookie has a name and a value, but those are opaque to the application (that is, the information stored in them has no meaning to the application). A cookie has an associated path name and domain, which indicate when the cookie should be sent again to the server.

A cookie can also have an expiration date, indicating its validity. If the expiration date is not present, the cookie is considered a "session cookie" and should be discarded when the application exits (or when its concept of session is over).

QNetworkCookie provides a way of parsing a cookie from the HTTP header format using the QNetworkCookie::parseCookies() function. However, when received in a QNetworkReply, the cookie is already parsed.

This class implements cookies as described by the initial cookie specification by Netscape, which is somewhat similar to the RFC 2109 specification, plus the "HttpOnly" extension. The more recent RFC 2965 specification (which uses the Set-Cookie2 header) is not supported.

See also QNetworkCookieJar, QNetworkRequest, and QNetworkReply.

Member Enumeration Documentation

This enum is used with the toRawForm() function to declare which form of a cookie shall be returned.

Note that only the Full form of the cookie can be parsed back into its original contents.

See also toRawForm() and parseCookies().

Enumerator:
Full 

Makes toRawForm() return the full cookie contents, as suitable for sending to a client in a server's "Set-Cookie:" header.

NameAndValueOnly 

Makes toRawForm() return only the "NAME=VALUE" part of the cookie, as suitable for sending back to a server in a client request's "Cookie:" header. Multiple cookies are separated by a semi-colon in the "Cookie:" header field.

Constructor & Destructor Documentation

QtNetwork.QNetworkCookie.QNetworkCookie ( System.Type  dummy)
protected
QtNetwork.QNetworkCookie.QNetworkCookie ( )

Create a new QNetworkCookie object, initializing the cookie name to name and its value to value.

A cookie is only valid if it has a name. However, the value is opaque to the application and being empty may have significance to the remote server.

QtNetwork.QNetworkCookie.QNetworkCookie ( QNetworkCookie  other)

Creates a new QNetworkCookie object by copying the contents of other.

QtNetwork.QNetworkCookie.QNetworkCookie ( QByteArray  name)

Create a new QNetworkCookie object, initializing the cookie name to name and its value to value.

A cookie is only valid if it has a name. However, the value is opaque to the application and being empty may have significance to the remote server.

QtNetwork.QNetworkCookie.QNetworkCookie ( QByteArray  name,
QByteArray  value 
)

Create a new QNetworkCookie object, initializing the cookie name to name and its value to value.

A cookie is only valid if it has a name. However, the value is opaque to the application and being empty may have significance to the remote server.

Member Function Documentation

virtual void QtNetwork.QNetworkCookie.CreateProxy ( )
virtual
new void QtNetwork.QNetworkCookie.Dispose ( )
override bool QtNetwork.QNetworkCookie.Equals ( object  o)
override int QtNetwork.QNetworkCookie.GetHashCode ( )
new bool QtNetwork.QNetworkCookie.IsHttpOnly ( )

Returns true if the "HttpOnly" flag is enabled for this cookie.

A cookie that is "HttpOnly" is only set and retrieved by the network requests and replies; i.e., the HTTP protocol. It is not accessible from scripts running on browsers.

This function was introduced in Qt 4.5.

See also isSecure().

new bool QtNetwork.QNetworkCookie.IsSecure ( )

Returns true if the "secure" option was specified in the cookie string, false otherwise.

Secure cookies may contain private information and should not be resent over unencrypted connections.

See also setSecure().

new bool QtNetwork.QNetworkCookie.IsSessionCookie ( )

Returns true if this cookie is a session cookie. A session cookie is a cookie which has no expiration date, which means it should be discarded when the application's concept of session is over (usually, when the application exits).

See also expirationDate() and setExpirationDate().

static bool QtNetwork.QNetworkCookie.operator!= ( QNetworkCookie  arg1,
QNetworkCookie  arg2 
)
static

Returns true if this cookie is not equal to other.

See also operator==().

static bool QtNetwork.QNetworkCookie.operator== ( QNetworkCookie  arg1,
QNetworkCookie  arg2 
)
static

Returns true if this cookie is equal to other. This function only returns true if all fields of the cookie are the same.

However, in some contexts, two cookies of the same name could be considered equal.

See also operator!=().

static System.Collections.Generic.List<QNetworkCookie> QtNetwork.QNetworkCookie.ParseCookies ( QByteArray  cookieString)
static

Parses the cookie string cookieString as received from a server response in the "Set-Cookie:" header. If there's a parsing error, this function returns an empty list.

Since the HTTP header can set more than one cookie at the same time, this function returns a QList<QNetworkCookie>, one for each cookie that is parsed.

See also toRawForm().

new void QtNetwork.QNetworkCookie.SetHttpOnly ( bool  enable)

Sets this cookie's "HttpOnly" flag to enable.

This function was introduced in Qt 4.5.

See also isHttpOnly().

new void QtNetwork.QNetworkCookie.SetSecure ( bool  enable)

Sets the secure flag of this cookie to enable.

Secure cookies may contain private information and should not be resent over unencrypted connections.

See also isSecure().

new QByteArray QtNetwork.QNetworkCookie.ToRawForm ( QNetworkCookie.RawForm  form = QNetworkCookie.RawForm.Full)

Returns the raw form of this QNetworkCookie. The QByteArray returned by this function is suitable for an HTTP header, either in a server response (the Set-Cookie header) or the client request (the Cookie header). You can choose from one of two formats, using form.

See also parseCookies().

Member Data Documentation

SmokeInvocation QtNetwork.QNetworkCookie.interceptor
protected

Property Documentation

new string QtNetwork.QNetworkCookie.Domain
getset

Returns the domain this cookie is associated with. This corresponds to the "domain" field of the cookie string.

Note that the domain here may start with a dot, which is not a valid hostname. However, it means this cookie matches all hostnames ending with that domain name.

Sets the domain associated with this cookie to be domain.

new QDateTime QtNetwork.QNetworkCookie.ExpirationDate
getset

Returns the expiration date for this cookie. If this cookie is a session cookie, the QDateTime returned will not be valid. If the date is in the past, this cookie has already expired and should not be sent again back to a remote server.

The expiration date corresponds to the parameters of the "expires" entry in the cookie string.

Sets the expiration date of this cookie to date. Setting an invalid expiration date to this cookie will mean it's a session cookie.

new QByteArray QtNetwork.QNetworkCookie.Name
getset

Returns the name of this cookie. The only mandatory field of a cookie is its name, without which it is not considered valid.

Sets the name of this cookie to be cookieName. Note that setting a cookie name to an empty QByteArray will make this cookie invalid.

new string QtNetwork.QNetworkCookie.Path
getset

Returns the path associated with this cookie. This corresponds to the "path" field of the cookie string.

Sets the path associated with this cookie to be path.

virtual System.IntPtr QtNetwork.QNetworkCookie.SmokeObject
getset
new QByteArray QtNetwork.QNetworkCookie.Value
getset

Returns this cookies value, as specified in the cookie string. Note that a cookie is still valid if its value is empty.

Cookie name-value pairs are considered opaque to the application: that is, their values don't mean anything.

Sets the value of this cookie to be value.