Sets the validation option for Secure HTTP (HTTPS) communications
Agent
Name | Type | Description |
---|---|---|
validation | Constant |
A validation option
|
Nothing
This method sets the validation option for an httpstream object created using http.poststream(), http.putstream() or http.requeststream() to prepare an an outgoing HTTPS stream. You must use it before sending data out on the stream with httpstream.send().
To indicate the level of validation required, pass one of the following constants into httpstream.setvalidation():
Validation Option Constant | Description |
---|---|
VALIDATE_NONE | No validation of the peer or host |
VALIDATE_USING_SYSTEM_CA_CERTS | Verifies the authenticity of the peer’s certificates and that they have been provided by the correct server |
By default, new httpstream objects’ validation is set to VALIDATE_NONE. In other words, neither the peer nor the host are validated. If the validation is set to VALIDATE_USING_SYSTEM_CA_CERTS before the request is sent, the authenticity of the remote server will be checked.
If the validation fails, the table passed to the callback function specified by the onErrorCallback parameter of http.poststream(), http.putstream() or http.requeststream() will have a statuscode value below 100. Typically this would be 60 (the peer certificate can’t be authenticated with known CA certificates) or 51 (the remote server’s SSL certificate or SSH MD5 fingerprint were not correct).
Note This method will throw a Squirrel error if you attempt to set validation options for any httpstream object set for non-HTTPS connections.