nn::http::Connection Classclass Connection : private ADLFireWall::NonCopyable
Class that represents HTTP communication. A single instance of this class is used for a single HTTP communication session with a single URL.
| Initialization/Finalization | ||
|---|---|---|
Connection
|
Constructor. | |
| V |
~Connection
|
Destructor. |
Initialize
|
Initializes a Connection and assigns a URL and method to it. | |
Finalize
|
Finalizes communication. Call this function after Initialize is called and after all HTTP operations with the communication target have completed.(This function does not need to be called for instances where Initialize was not run. Although no problems result if it is called, it does nothing.)Once this function has been called on a given Connection instance, it is no longer possible to use that instance to retrieve information from the communication target. |
|
| Communications Settings | ||
SetProxy
|
Sets the proxy server to use for the connection. | |
SetBasicAuthorization
|
Sets the information used for basic authentication. | |
SetSocketBufferSize
|
Sets the size of the TCP receive buffer used by sockets during communication. | |
| Communication Control | ||
Connect
|
Starts a connection with the communication target. (This is the synchronous version of the function. In other words, if the maximum number of HTTP sessions are already in use, the function blocks until one of those sessions concludes.) | |
ConnectAsync
|
Starts a connection with the communication target. (This is the asynchronous version of the function. In other words, if the maximum number of HTTP sessions are already in use by the device, this function returns an error.」) | |
Cancel
|
Cancels the connection. The function does nothing and returns ResultSuccess when the connection has already been closed (including due to an error) or has already been canceled. |
|
GetStatus
|
Gets the connection status. (See the definitions in nn::http::Status for information about the statuses that can be obtained.) |
|
GetError
|
Gets errors that occurred during communication. (The value that is obtained indicates the last error that occurred. See the definitions in nn::http::ResultCode for information about the statuses that can be obtained.) |
|
GetProgress
|
Gets the progress of an operation to receive an HTTP response's message body data. | |
| Receiving Responses | ||
Read
|
Reads an HTTP response. | |
GetHeaderField
|
Gets the field value that matches the specified label. This field value is obtained from the message header of the HTTP response that was received. | |
GetHeaderAll
|
Gets the message header for the HTTP response that was received. | |
GetStatusCode
|
Gets the status code for the HTTP response that was received. | |
| Setting Outgoing Data (HTTP Request Headers, POST) | ||
AddHeaderField
|
Adds a field to the message header to be sent through an HTTP request. | |
AddPostDataAscii
|
Function used to configure POST data before Connecting (for ASCII strings). |
|
AddPostDataBinary
|
Function used to configure binary POST data before Connecting. |
|
AddPostDataRaw
|
Function used to configure raw POST data before Connecting. |
|
SetLazyPostDataSetting
|
Sets the "lazy" (delayed) POST data configuration mode. (Here, "lazy mode" refers to the mode used to specify data after Connect is called.) |
|
NotifyFinishSendPostData
|
In "lazy" (delayed) POST data configuration mode, sends notification that all POST data configuration is complete. | |
SetPostDataEncoding
|
Sets the encoding type for an HTTP request's POST data. | |
SendPostDataAscii
|
Function used to set POST data (as ASCII strings) in "lazy" (delayed) POST data configuration mode. | |
SendPostDataBinary
|
Function used to set POST data (as binary data) in "lazy" (delayed) POST data configuration mode. | |
SendPostDataRaw
|
Function used to set POST data (as raw data) in "lazy" (delayed) POST data configuration mode. | |
| HTTPS Configuration | ||
SetRootCa
|
Sets the CA certificate. Call this function multiple times to set multiple certificates. | |
SetRootCaStore
|
Sets the CA certificate store. (Use this to reuse the same set of CA certificates with multiple HTTPS communication sessions. Do not release the configured certificate store during HTTPS communication with the communication targets. | |
SetClientCert
|
Sets a client certificate based on certificate and private key data. | |
GetSslError
|
Gets errors that occurred during SSL communication. (Error codes are represented as nn::ssl::ResultCode values. The obtained value is the error code for the most recent error that occurred before this function was called.) |
|
SetVerifyOption
|
Sets options that relate to SSL server verification. ※ The authentication operations below are defined in the nn::ssl::VerifyOption enumerated type and implemented by default.・ CommonName authentication (nn::ssl::VERIFY_COMMON_NAME)・ RootCA authentication (nn::ssl::VERIFY_ROOT_CA)・ SubjectAlternativeName authentication (nn::ssl::VERIFY_SUBJECT_ALT_NAME) |
|
DisableVerifyOptionForDebug
|
Removes the SSL communication verification contents for the specified bits. | |
SetRootCaDefault
|
[Deprecated] This function will be eliminated in the future. Sets to use the device's default internal certificate as the CA certificate. | |
SetClientCertDefault
|
[Deprecated] This function will be eliminated in the future. Sets to use the device's default internal client certificate as the client certificate. | |
ADLFireWall::NonCopyable
nn::http::Connection
CONFIDENTIAL