代码拉取完成,页面将自动刷新
IoT.js provides HTTPS to support HTTPS clients enabling users to send HTTPS requests easily.
options
{Object} Accepts the same options
as tls.createServer and http.createServer methods.requestListener
{Function}
To create a server the certificates should be specified via the options
object.
The requestListener
is a function which is automatically added to the 'request'
event.
Example
var options = {
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.cert')
};
var server = https.createServer(options, function(request, response) {
...
});
options
{Object}
host
{string} A domain name or IP address of the server to issue the request to. Default: 'localhost'.hostname
{string} Alias for host.port
{number} Port of remote server. Default: 443.method
{string} A string specifying the HTTPS request method. Default: 'GET'.path
{string} Request path. Default: '/'. Should include query string if any. E.G. '/index.html?page=12'. An exception is thrown when the request path contains illegal characters. Currently, only spaces are rejected but that may change in the future.headers
{Object} An object containing request headers.auth
{string} Optional Basic Authentication in the form username:password
. Used to compute HTTPS Basic Authentication header.ca
{string} Optional file path to CA certificate. Allows to override system trusted CA certificates.cert
{string} Optional file path to client authentication certificate in PEM format.key
{string} Optional file path to private keys for client cert in PEM format.rejectUnauthorized
{boolean} Optional Specify whether to verify the Server's certificate against CA certificates. WARNING - Making this false
may be a security risk. Default: true
callback
{Function}
response
{http.IncomingMessage}Example:
var https = require('https');
var request = https.request({
method: 'POST',
port: 443,
headers: {'Content-Length': 3}
});
...
request.end();
Note that in the example req.end()
was called. With https.request()
one must always call req.end()
to signify that you're done with the request - even if there is no data being written to the request body.
options
{Object}
host
{string} A domain name or IP address of the server to issue the request to. Default: 'localhost'.hostname
{string} Alias for host.port
{number} Port of remote server. Default: 443.method
{string} A string specifying the HTTPS request method. Default: 'GET'.path
{string} Request path. Default: '/'. Should include query string if any. E.G. '/index.html?page=12'. An exception is thrown when the request path contains illegal characters. Currently, only spaces are rejected but that may change in the future.headers
{Object} An object containing request headers.auth
{string} Optional Basic Authentication in the form username:password
. Used to compute HTTPS Basic Authentication header.ca
{string} Optional file path to CA certificate. Allows to override system trusted CA certificates.cert
{string} Optional file path to client authentication certificate in PEM format.key
{string} Optional file path to private keys for client cert in PEM format.rejectUnauthorized
{boolean} Optional Specify whether to verify the Server's certificate against CA certificates. WARNING - Making this false
may be a security risk. Default: true
callback
{Function}
response
{http.IncomingMessage}Same as https.request
except that https.get
automatically call req.end()
at the end.
Example:
var https = require('https');
https.get({
port: 443,
}, function(res) {
...
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。