Bundle Shared networking types used across all HTTP libraries: Url (parsing and construction), Response (status code, headers, body), Cookie, and WebDownloader for streaming downloads. Compile with -lib net.
Cookie
HTTP cookie
Operations
- New
- AddAttrib
- Expire
- GetAttrib
- GetName
- GetValue
- RemoveAttrib
- SetExpiration
- SetName
- SetValue
- ToShortString
- ToString
AddAttrib #
Adds a cookie attribute
method : public : AddAttrib(name:String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| name | String | attribute name |
Return
| Type | Description |
|---|---|
| Bool | true if added, false otherwise |
AddAttrib #
Adds a cookie attribute
method : public : AddAttrib(name:String, value:String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| name | String | attribute name |
| value | String | attribute value |
Return
| Type | Description |
|---|---|
| Bool | true if added, false otherwise |
Example
cookie := Web.HTTP.Cookie->New("id", "42");
cookie->AddAttrib("Path", "/");
cookie->AddAttrib("HttpOnly", Nil);
cookie->ToString()->PrintLine(); # id=42; Path=/; HttpOnlyGetAttrib #
Get cookie attribute
method : public : GetAttrib(name:String) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| name | String | attribute name |
Return
| Type | Description |
|---|---|
| String | cookie attribute value |
GetValue #
Get cookie value
method : public : GetValue() ~ StringReturn
| Type | Description |
|---|---|
| String | cookie value |
New # constructor
Constructor
New(name:String, value:String, is_debug:Bool)Parameters
| Name | Type | Description |
|---|---|---|
| name | String | cookie name |
| value | String | cookie value |
| is_debug | Bool | true to display debug information |
Example
cookie := Web.HTTP.Cookie->New("session", "abc123", false);
cookie->GetName()->PrintLine(); # session
cookie->GetValue()->PrintLine(); # abc123
cookie->ToString()->PrintLine(); # session=abc123New # constructor
Constructor
New(name:String, value:String)Parameters
| Name | Type | Description |
|---|---|---|
| name | String | cookie name |
| value | String | cookie value |
New # constructor
Constructor
New(cookie_str:String)Parameters
| Name | Type | Description |
|---|---|---|
| cookie_str | String | cookie string |
New # constructor
Constructor
New(cookie_str:String, is_debug:Bool)Parameters
| Name | Type | Description |
|---|---|---|
| cookie_str | String | cookie string |
| is_debug | Bool | true to display debug information |
RemoveAttrib #
Removes an attribute
method : public : RemoveAttrib(name:String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| name | String | attribute name |
Return
| Type | Description |
|---|---|
| Bool | true if added, false otherwise |
SetExpiration #
Sets the cookie to expiration date
method : public : SetExpiration(expires:System.Time.Date) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| expires | Date | expiration date |
SetName #
Set cookie name
method : public : SetName(name:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| name | String | cookie name |
SetValue #
Set cookie value
method : public : SetValue(value:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| value | String | cookie value |