{
  "source": "https.markdown",
  "modules": [
    {
      "textRaw": "HTTPS",
      "name": "https",
      "desc": "<pre><code>稳定度: 3 - 稳定</code></pre>\n<p>HTTPS is the HTTP protocol over TLS/SSL. In Node this is implemented as a\nseparate module.\n\n</p>\n<p>HTTPS 是建立在 TLS/SSL 之上的 HTTP 协议。在 Node 中被实现为单独的模块。\n\n</p>\n",
      "properties": [
        {
          "textRaw": "类: https.Server",
          "name": "Server",
          "desc": "<p>This class is a subclass of <code>tls.Server</code> and emits events same as\n<code>http.Server</code>. See <code>http.Server</code> for more information.\n\n</p>\n<p>该类是 <code>tls.Server</code> 的子类，并且发生和 <code>http.Server</code> 一样的事件。更多信息详见 <code>http.Server</code>。\n\n</p>\n",
          "methods": [
            {
              "textRaw": "server.setTimeout(msecs, callback)",
              "type": "method",
              "name": "setTimeout",
              "desc": "<p>See [http.Server#setTimeout()][].\n\n</p>\n<p>详见 [http.Server#setTimeout()][]。\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "msecs"
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            }
          ],
          "properties": [
            {
              "textRaw": "server.timeout",
              "name": "timeout",
              "desc": "<p>See [http.Server#timeout][].\n\n</p>\n<p>详见 [http.Server#timeout][]。\n\n</p>\n"
            }
          ]
        },
        {
          "textRaw": "类: https.Agent",
          "name": "Agent",
          "desc": "<p>An Agent object for HTTPS similar to [http.Agent][].  See [https.request()][]\nfor more information.\n\n</p>\n<p>类似于 [http.Agent][] 的 HTTPS Agent 对象。详见 [https.request()][]。\n\n</p>\n"
        },
        {
          "textRaw": "https.globalAgent",
          "name": "globalAgent",
          "desc": "<p>Global instance of [https.Agent][] for all HTTPS client requests.\n\n</p>\n<p>所有 HTTPS 客户端请求的全局 [https.Agent][] 实例。\n\n</p>\n"
        }
      ],
      "methods": [
        {
          "textRaw": "https.createServer(options, [requestListener])",
          "type": "method",
          "name": "createServer",
          "desc": "<p>Returns a new HTTPS web server object. The <code>options</code> is similar to\n[tls.createServer()][].  The <code>requestListener</code> is a function which is\nautomatically added to the <code>&apos;request&apos;</code> event.\n\n</p>\n<p>返回一个新的 HTTPS Web 服务器对象。其中 <code>options</code> 类似于 [tls.createServer()][]；<code>requestListener</code> 是一个会被自动添加到 <code>request</code> 事件的函数。\n\n</p>\n<p>Example:\n\n</p>\n<p>示例：\n\n</p>\n<pre><code>https.createServer(options, function (req, res) {\n  res.writeHead(200);\n  res.end(&quot;hello world\\n&quot;);\n}).listen(8000);</code></pre>\n<p>Or\n\n</p>\n<p>或者\n\n</p>\n<pre><code>https.createServer(options, function (req, res) {\n  res.writeHead(200);\n  res.end(&quot;hello world\\n&quot;);\n}).listen(8000);</code></pre>\n",
          "methods": [
            {
              "textRaw": "server.listen(path, [callback])",
              "type": "method",
              "name": "listen",
              "desc": "<p>See [http.listen()][] for details.\n\n</p>\n<p>详见 [http.listen()][]。\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "handle"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "path"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "server.listen(handle, [callback])",
              "type": "method",
              "name": "listen",
              "desc": "<p>See [http.listen()][] for details.\n\n</p>\n<p>详见 [http.listen()][]。\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "handle"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "server.close([callback])",
              "type": "method",
              "name": "close",
              "desc": "<p>See [http.close()][] for details.\n\n</p>\n<p>详见 [http.close()][]。\n\n</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ]
            }
          ],
          "signatures": [
            {
              "params": [
                {
                  "name": "options"
                },
                {
                  "name": "requestListener",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "https.request(options, callback)",
          "type": "method",
          "name": "request",
          "desc": "<p>Makes a request to a secure web server.\n\n</p>\n<p>向一个安全 Web 服务器发送请求。\n\n</p>\n<p><code>options</code> can be an object or a string. If <code>options</code> is a string, it is\nautomatically parsed with <a href=\"url.html#url.parse\">url.parse()</a>.\n\n</p>\n<p><code>options</code> 可以是一个对象或字符串。如果 <code>options</code> 是字符串，它会自动被 <a href=\"url.html#url.parse\">url.parse()</a> 解析。\n\n</p>\n<p>All options from [http.request()][] are valid.\n\n</p>\n<p>所有来自 [http.request()][] 的选项都是经过验证的。\n\n</p>\n<p>Example:\n\n</p>\n<p>示例：\n\n</p>\n<pre><code>req.on(&apos;error&apos;, function(e) {\n  console.error(e);\n});</code></pre>\n<p>The options argument has the following options\n\n</p>\n<p>options 参数有如下选项\n\n</p>\n<ul>\n<li><code>host</code>: A domain name or IP address of the server to issue the request to.\nDefaults to <code>&apos;localhost&apos;</code>.</li>\n<li><code>hostname</code>: To support <code>url.parse()</code> <code>hostname</code> is preferred over <code>host</code></li>\n<li><code>port</code>: Port of remote server. Defaults to 443.</li>\n<li><code>method</code>: A string specifying the HTTP request method. Defaults to <code>&apos;GET&apos;</code>.</li>\n<li><code>path</code>: Request path. Defaults to <code>&apos;/&apos;</code>. Should include query string if any.\nE.G. <code>&apos;/index.html?page=12&apos;</code></li>\n<li><code>headers</code>: An object containing request headers.</li>\n<li><code>auth</code>: Basic authentication i.e. <code>&apos;user:password&apos;</code> to compute an\nAuthorization header.</li>\n<li><p><code>agent</code>: Controls [Agent][] behavior. When an Agent is used request will\ndefault to <code>Connection: keep-alive</code>. Possible values:</p>\n<ul>\n<li><code>undefined</code> (default): use [globalAgent][] for this host and port.</li>\n<li><code>Agent</code> object: explicitly use the passed in <code>Agent</code>.</li>\n<li><code>false</code>: opts out of connection pooling with an Agent, defaults request to\n<code>Connection: close</code>.</li>\n</ul>\n</li>\n<li><p><code>host</code>：发送请求的服务器的域名或 IP 地址，缺省为 <code>&apos;localhost&apos;</code>。</p>\n</li>\n<li><code>hostname</code>：为了支持 <code>url.parse()</code>，<code>hostname</code> 优先于 <code>host</code>。</li>\n<li><code>port</code>：远程服务器的端口，缺省为 443。</li>\n<li><code>method</code>：指定 HTTP 请求方法的字符串，缺省为 `&apos;GET&apos;。</li>\n<li><code>path</code>：请求路径，缺省为 <code>&apos;/&apos;</code>。如有查询字串则应包含，比如 <code>&apos;/index.html?page=12&apos;</code>。</li>\n<li><code>headers</code>：包含请求头的对象。</li>\n<li><code>auth</code>：基本认证，如 <code>&apos;user:password&apos;</code> 来计算 Authorization 头。</li>\n<li><code>agent</code>：控制 [Agent][] 行为。当使用 Agent 时请求会缺省为 <code>Connection: keep-alive</code>。可选值有：<ul>\n<li><code>undefined</code>（缺省）：为该主机和端口使用 [globalAgent][]。</li>\n<li><code>Agent</code> 对象：明确使用传入的 <code>Agent</code>。</li>\n<li><code>false</code>：不使用 Agent 连接池，缺省请求 <code>Connection: close</code>。</li>\n</ul>\n</li>\n</ul>\n<p>The following options from [tls.connect()][] can also be specified. However, a\n[globalAgent][] silently ignores these.\n\n</p>\n<p>下列来自 [tls.connect()][] 的选项也能够被指定，但一个 [globalAgent][] 会忽略它们。\n\n</p>\n<ul>\n<li><code>pfx</code>: Certificate, Private key and CA certificates to use for SSL. Default <code>null</code>.</li>\n<li><code>key</code>: Private key to use for SSL. Default <code>null</code>.</li>\n<li><code>passphrase</code>: A string of passphrase for the private key or pfx. Default <code>null</code>.</li>\n<li><code>cert</code>: Public x509 certificate to use. Default <code>null</code>.</li>\n<li><code>ca</code>: An authority certificate or array of authority certificates to check\nthe remote host against.</li>\n<li><code>ciphers</code>: A string describing the ciphers to use or exclude. Consult\n<a href=\"http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT\">http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT</a> for\ndetails on the format.</li>\n<li><code>rejectUnauthorized</code>: If <code>true</code>, the server certificate is verified against\nthe list of supplied CAs. An <code>&apos;error&apos;</code> event is emitted if verification\nfails. Verification happens at the connection level, <em>before</em> the HTTP\nrequest is sent. Default <code>true</code>.</li>\n<li><p><code>secureProtocol</code>: The SSL method to use, e.g. <code>SSLv3_method</code> to force\nSSL version 3. The possible values depend on your installation of\nOpenSSL and are defined in the constant [SSL_METHODS][].</p>\n</li>\n<li><p><code>pfx</code>：证书，SSL 所用的私钥或 CA 证书。缺省为 <code>null</code>。</p>\n</li>\n<li><code>key</code>：SSL 所用私钥。缺省为 <code>null</code>。</li>\n<li><code>passphrase</code>：私钥或 pfx 的口令字符串，缺省为 <code>null</code>。</li>\n<li><code>cert</code>：所用公有 x509 证书，缺省为 <code>null</code>。</li>\n<li><code>ca</code>：用于检查远程主机的证书颁发机构或包含一系列证书颁发机构的数组。</li>\n<li><code>ciphers</code>：描述要使用或排除的密码的字符串，格式请参阅 <a href=\"http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT\">http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT</a>。</li>\n<li><code>rejectUnauthorized</code>：如为 <code>true</code> 则服务器证书会使用所给 CA 列表验证。如果验证失败则会触发 <code>&apos;error&apos;</code> 时间。验证过程发生于连接层，在 HTTP 请求发送<em>之前</em>。缺省为 <code>true</code>。</li>\n<li><code>secureProtocol</code>：所用 SSL 方法，比如 <code>SSLv3_method</code> 强制使用 SSL version 3。可取值取决于您安装的 OpenSSL 并被定义在 [SSL_METHODS][] 常量。</li>\n</ul>\n<p>In order to specify these options, use a custom <code>Agent</code>.\n\n</p>\n<p>要指定这些选项，使用一个自定义 <code>Agent</code>。\n\n</p>\n<p>Example:\n\n</p>\n<p>示例：\n\n</p>\n<pre><code>var req = https.request(options, function(res) {\n  ...\n}</code></pre>\n<p>Or does not use an <code>Agent</code>.\n\n</p>\n<p>或不使用 <code>Agent</code>。\n\n</p>\n<p>Example:\n\n</p>\n<p>示例：\n\n</p>\n<pre><code>var req = https.request(options, function(res) {\n  ...\n}</code></pre>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options"
                },
                {
                  "name": "callback"
                }
              ]
            }
          ]
        },
        {
          "textRaw": "https.get(options, callback)",
          "type": "method",
          "name": "get",
          "desc": "<p>Like <code>http.get()</code> but for HTTPS.\n\n</p>\n<p>类似 <code>http.get()</code> 但为 HTTPS。\n\n</p>\n<p><code>options</code> can be an object or a string. If <code>options</code> is a string, it is\nautomatically parsed with <a href=\"url.html#url.parse\">url.parse()</a>.\n\n</p>\n<p><code>options</code> 可以是一个对象或字符串。如果 <code>options</code> 是字符串，它会自动被 <a href=\"url.html#url.parse\">url.parse()</a> 解析。\n\n</p>\n<p>Example:\n\n</p>\n<p>示例：\n\n</p>\n<pre><code>}).on(&apos;error&apos;, function(e) {\n  console.error(e);\n});</code></pre>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options"
                },
                {
                  "name": "callback"
                }
              ]
            }
          ]
        }
      ],
      "type": "module",
      "displayName": "HTTPS"
    }
  ]
}