| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cd3c478 commit a2ae089
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -534,6 +534,14 @@ deprecated. Please use `ServerResponse.prototype.writeHead()` instead. | |||
| 534 | 534 | *Note*: The `ServerResponse.prototype.writeHeader()` method was never documented | |
| 535 | 535 | as an officially supported API. | |
| 536 | 536 | ||
| 537 | + <a id="DEP0064"></a> | ||
| 538 | + ### DEP0064: tls.createSecurePair() | ||
| 539 | + | ||
| 540 | + Type: Runtime | ||
| 541 | + | ||
| 542 | + The `tls.createSecurePair()` API was deprecated in documentation in Node.js | ||
| 543 | + 0.11.3. Users should use `tls.Socket` instead. | ||
| 544 | + | ||
| 537 | 545 | [alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding | |
| 538 | 546 | [alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size | |
| 539 | 547 | [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,15 +3,17 @@ | |||
| 3 | 3 | require('internal/util').assertCrypto(); | |
| 4 | 4 | ||
| 5 | 5 | const assert = require('assert'); | |
| 6 | + const Buffer = require('buffer').Buffer; | ||
| 7 | + const common = require('_tls_common'); | ||
| 8 | + const Connection = process.binding('crypto').Connection; | ||
| 6 | 9 | const EventEmitter = require('events'); | |
| 10 | + const internalUtil = require('internal/util'); | ||
| 7 | 11 | const stream = require('stream'); | |
| 12 | + const Timer = process.binding('timer_wrap').Timer; | ||
| 8 | 13 | const tls = require('tls'); | |
| 9 | 14 | const util = require('util'); | |
| 10 | - const common = require('_tls_common'); | ||
| 15 | + | ||
| 11 | 16 | const debug = util.debuglog('tls-legacy'); | |
| 12 | - const Buffer = require('buffer').Buffer; | ||
| 13 | - const Timer = process.binding('timer_wrap').Timer; | ||
| 14 | - const Connection = process.binding('crypto').Connection; | ||
| 15 | 17 | ||
| 16 | 18 | function SlabBuffer() { | |
| 17 | 19 | this.create(); | |
@@ -787,18 +789,11 @@ function securePairNT(self, options) { | |||
| 787 | 789 | } | |
| 788 | 790 | ||
| 789 | 791 | ||
| 790 | - exports.createSecurePair = function(context, | ||
| 791 | - isServer, | ||
| 792 | - requestCert, | ||
| 793 | - rejectUnauthorized, | ||
| 794 | - options) { | ||
| 795 | - var pair = new SecurePair(context, | ||
| 796 | - isServer, | ||
| 797 | - requestCert, | ||
| 798 | - rejectUnauthorized, | ||
| 799 | - options); | ||
| 800 | - return pair; | ||
| 801 | - }; | ||
| 792 | + function createSecurePair(context, isServer, requestCert, | ||
| 793 | + rejectUnauthorized, options) { | ||
| 794 | + return new SecurePair(context, isServer, requestCert, | ||
| 795 | + rejectUnauthorized, options); | ||
| 796 | + } | ||
| 802 | 797 | ||
| 803 | 798 | ||
| 804 | 799 | SecurePair.prototype.maybeInitFinished = function() { | |
@@ -868,7 +863,7 @@ SecurePair.prototype.error = function(returnOnly) { | |||
| 868 | 863 | }; | |
| 869 | 864 | ||
| 870 | 865 | ||
| 871 | - exports.pipe = function pipe(pair, socket) { | ||
| 866 | + function pipe(pair, socket) { | ||
| 872 | 867 | pair.encrypted.pipe(socket); | |
| 873 | 868 | socket.pipe(pair.encrypted); | |
| 874 | 869 | ||
@@ -918,7 +913,7 @@ exports.pipe = function pipe(pair, socket) { | |||
| 918 | 913 | socket.on('timeout', ontimeout); | |
| 919 | 914 | ||
| 920 | 915 | return cleartext; | |
| 921 | - }; | ||
| 916 | + } | ||
| 922 | 917 | ||
| 923 | 918 | ||
| 924 | 919 | function pipeCloseNT(pair, socket) { | |
@@ -927,3 +922,11 @@ function pipeCloseNT(pair, socket) { | |||
| 927 | 922 | pair.encrypted.unpipe(socket); | |
| 928 | 923 | socket.destroySoon(); | |
| 929 | 924 | } | |
| 925 | + | ||
| 926 | + module.exports = { | ||
| 927 | + createSecurePair: | ||
| 928 | + internalUtil.deprecate(createSecurePair, | ||
| 929 | + 'tls.createSecurePair() is deprecated. Please use ' + | ||
| 930 | + 'tls.Socket instead.', 'DEP0064'), | ||
| 931 | + pipe | ||
| 932 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -235,4 +235,6 @@ exports.TLSSocket = require('_tls_wrap').TLSSocket; | |||
| 235 | 235 | exports.Server = require('_tls_wrap').Server; | |
| 236 | 236 | exports.createServer = require('_tls_wrap').createServer; | |
| 237 | 237 | exports.connect = require('_tls_wrap').connect; | |
| 238 | + | ||
| 239 | + // Deprecated: DEP0064 | ||
| 238 | 240 | exports.createSecurePair = require('_tls_legacy').createSecurePair; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + // Flags: --no-warnings | ||
| 2 | + 'use strict'; | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const tls = require('tls'); | ||
| 6 | + | ||
| 7 | + common.expectWarning( | ||
| 8 | + 'DeprecationWarning', | ||
| 9 | + 'tls.createSecurePair() is deprecated. Please use tls.Socket instead.' | ||
| 10 | + ); | ||
| 11 | + | ||
| 12 | + assert.doesNotThrow(() => tls.createSecurePair()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments