@@ -741,6 +741,16 @@ options argument for +tcp.Server+ does.
741741The +request_listener+ is a function which is automatically
742742added to the +"request"+ event.
743743
744+ +server.setSecure(format_type, ca_certs, crl_list, private_key, certificate)+ ::
745+ Enable TLS for all incoming connections, with the specified credentials.
746+ +
747+ format_type currently has to be "X509_PEM", and each of the ca, crl, key and
748+ cert parameters are in the format of PEM strings.
749+ +
750+ The ca_certs is a string that holds a number of CA certificates for use in accepting
751+ client connections that authenticate themselves with a client certificate.
752+ The private_key is a PEM string of the unencrypted key for the server.
753+
744754+server.listen(port, hostname)+ ::
745755Begin accepting connections on the specified port and hostname.
746756If the hostname is omitted, the server will accept connections
@@ -927,6 +937,17 @@ the response. (This sounds convoluted but it provides a chance
927937for the user to stream a body to the server with
928938+request.sendBody()+.)
929939
940+ +client.setSecure(format_type, ca_certs, crl_list, private_key, certificate)+ ::
941+ Enable TLS for the client connection, with the specified credentials.
942+ +
943+ format_type currently has to be "X509_PEM", and each of the ca, crl, key and
944+ cert parameters are in the format of PEM strings, and optional.
945+ +
946+ The ca_certs is a string that holds a number of CA certificates for use in deciding the
947+ authenticity of the remote server. The private_key is a PEM string of the unencrypted
948+ key for the client, which together with the certificate allows the client to authenticate
949+ itself to the server.
950+
930951
931952==== +http.ClientRequest+
932953
@@ -1160,6 +1181,15 @@ Creates a new TCP server.
11601181The +connection_listener+ argument is automatically set as a listener for
11611182the +"connection"+ event.
11621183
1184+ +server.setSecure(format_type, ca_certs, crl_list, private_key, certificate)+ ::
1185+ Enable TLS for all incoming connections, with the specified credentials.
1186+ +
1187+ format_type currently has to be "X509_PEM", and each of the ca, crl, key and
1188+ cert parameters are in the format of PEM strings.
1189+ +
1190+ The ca_certs is a string that holds a number of CA certificates for use in accepting
1191+ client connections that authenticate themselves with a client certificate.
1192+ The private_key is a PEM string of the unencrypted key for the server.
11631193
11641194+server.listen(port, host=null, backlog=128)+ ::
11651195Tells the server to listen for TCP connections to +port+ and +host+.
@@ -1173,7 +1203,6 @@ connections for the server may grow.
11731203+
11741204This function is synchronous.
11751205
1176-
11771206+server.close()+::
11781207Stops the server from accepting new connections. This function is
11791208asynchronous, the server is finally closed when the server emits a +"close"+
@@ -1279,6 +1308,25 @@ Disables the Nagle algorithm. By default TCP connections use the Nagle
12791308algorithm, they buffer data before sending it off. Setting +noDelay+ will
12801309immediately fire off data each time +connection.send()+ is called.
12811310
1311+ +connection.verifyPeer()+::
1312+ Returns an integer indicating the trusted status of the peer in a TLS
1313+ connection.
1314+ +
1315+ Returns 1 if the peer's certificate is issued by one of the trusted CAs,
1316+ the certificate has not been revoked, is in the issued date range,
1317+ and if the peer is the server, matches the hostname.
1318+ +
1319+ Returns 0 if no certificate was presented by the peer, or negative result
1320+ if the verification fails (with a given reason code). This function is synchronous.
1321+
1322+ +connection.getPeerCertificate(format)+::
1323+ For a TLS connection, returns the peer's certificate information, as defined
1324+ by the given format.
1325+ +
1326+ A format of "DNstring" gives a single string with the combined Distinguished
1327+ Name (DN) from the certificate, as comma delimited name=value pairs as defined
1328+ in RFC2253. This function is synchronous.
1329+
12821330=== DNS module
12831331
12841332Use +require("dns")+ to access this module
0 commit comments