Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: simplify text in pull-requests.md #30458

Merged
merged 9 commits into from
Nov 15, 2019
13 changes: 5 additions & 8 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,14 @@ There are three support tiers:

* **Tier 1**: These platforms represent the majority of Node.js users. The
Node.js Build Working Group maintains infrastructure for full test coverage.
Maintenance is supported by the Node.js core team. All commits to the
Node.js repository are tested on multiple variants of these platforms. Test
All commits to the Node.js repository are tested on these platforms. Test
failures on tier 1 platforms will block releases.
* **Tier 2**: These platforms represent smaller segments of the Node.js user
base. The Node.js Build Working Group maintains infrastructure for full test
coverage. Maintenance is supported by smaller groups or individuals within
the Node.js core team, or the vendor of the platform itself. All commits to
the Node.js repository are tested on multiple variants of these platforms
where practical. Test failures on tier 2 platforms will block releases.
Delays in release of binaries for these platforms are acceptable
where necessary due to infrastructure concerns.
coverage. All commits to the Node.js repository are tested on these platforms.
Test failures on tier 2 platforms will block releases. Delays in release of
binaries for these platforms are acceptable where necessary due to
infrastructure concerns.
* **Experimental**: May not compile or test suite may not pass. The core team
does not create releases for these platforms. Test failures on experimental
platforms do not block releases. Contributions to improve support for these
Expand Down
Binary file modified deps/icu-small/source/data/in/icudt64l.dat.bz2
Binary file not shown.
33 changes: 0 additions & 33 deletions doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,6 @@ The following methods are exposed by the V8 engine in the general API but do
not display anything unless used in conjunction with the [inspector][]
(`--inspect` flag).

### console.markTimeline(\[label\])
<!-- YAML
added: v8.0.0
-->

* `label` {string} **Default:** `'default'`

This method does not display anything unless used in the inspector. The
`console.markTimeline()` method is the deprecated form of
[`console.timeStamp()`][].

### console.profile(\[label\])
<!-- YAML
added: v8.0.0
Expand Down Expand Up @@ -546,35 +535,13 @@ This method does not display anything unless used in the inspector. The
`console.timeStamp()` method adds an event with the label `'label'` to the
**Timeline** panel of the inspector.

### console.timeline(\[label\])
<!-- YAML
added: v8.0.0
-->

* `label` {string} **Default:** `'default'`

This method does not display anything unless used in the inspector. The
`console.timeline()` method is the deprecated form of [`console.time()`][].

### console.timelineEnd(\[label\])
<!-- YAML
added: v8.0.0
-->

* `label` {string} **Default:** `'default'`

This method does not display anything unless used in the inspector. The
`console.timelineEnd()` method is the deprecated form of
[`console.timeEnd()`][].

[`console.error()`]: #console_console_error_data_args
[`console.group()`]: #console_console_group_label
[`console.log()`]: #console_console_log_data_args
[`console.profile()`]: #console_console_profile_label
[`console.profileEnd()`]: #console_console_profileend_label
[`console.time()`]: #console_console_time_label
[`console.timeEnd()`]: #console_console_timeend_label
[`console.timeStamp()`]: #console_console_timestamp_label
[`process.stderr`]: process.html#process_process_stderr
[`process.stdout`]: process.html#process_process_stdout
[`util.format()`]: util.html#util_util_format_format_args
Expand Down
18 changes: 18 additions & 0 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,13 @@ deprecated: v13.0.0

See [`response.socket`][].

### response.cork()
<!-- YAML
added: REPLACEME
-->

See [`writable.cork()`][].

### response.end(\[data\[, encoding\]\]\[, callback\])
<!-- YAML
added: v0.1.90
Expand Down Expand Up @@ -1516,6 +1523,13 @@ response.statusMessage = 'Not found';
After response header was sent to the client, this property indicates the
status message which was sent out.

### response.uncork()
<!-- YAML
added: REPLACEME
-->

See [`writable.uncork()`][].

### response.writableEnded
<!-- YAML
added: v12.9.0
Expand Down Expand Up @@ -2133,6 +2147,7 @@ changes:
* `hostname` {string} Alias for `host`. To support [`url.parse()`][],
`hostname` will be used if both `host` and `hostname` are specified.
* `localAddress` {string} Local interface to bind for network connections.
* `lookup` {Function} Custom lookup function. **Default:** [`dns.lookup()`][].
* `method` {string} A string specifying the HTTP request method. **Default:**
`'GET'`.
* `path` {string} Request path. Should include query string if any.
Expand Down Expand Up @@ -2312,6 +2327,7 @@ not abort the request or do anything besides add a `'timeout'` event.
[`agent.createConnection()`]: #http_agent_createconnection_options_callback
[`agent.getName()`]: #http_agent_getname_options
[`destroy()`]: #http_agent_destroy
[`dns.lookup()`]: dns.html#dns_dns_lookup_hostname_options_callback
[`'finish'`]: #http_event_finish
[`getHeader(name)`]: #http_request_getheader_name
[`http.Agent`]: #http_class_http_agent
Expand Down Expand Up @@ -2356,3 +2372,5 @@ not abort the request or do anything besides add a `'timeout'` event.
[`socket.unref()`]: net.html#net_socket_unref
[`url.parse()`]: url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
[`HPE_HEADER_OVERFLOW`]: errors.html#errors_hpe_header_overflow
[`writable.cork()`]: stream.html#stream_writable_cork
[`writable.uncork()`]: stream.html#stream_writable_uncork
4 changes: 2 additions & 2 deletions doc/guides/contributing/pull-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $ git remote add upstream https://github.com/nodejs/node.git
$ git fetch upstream
```

It is recommended to configure `git` so that it knows who you are:
Configure `git` so that it knows who you are:

```text
$ git config user.name "J. Random User"
Expand Down Expand Up @@ -125,7 +125,7 @@ For contributing C++ code, you may want to look at the

### Step 4: Commit

It is a recommended best practice to keep your changes as logically grouped
It is a best practice to keep your changes as logically grouped
as possible within individual commits. There is no limit to the number of
commits any single Pull Request may have, and many contributors find it easier
to review changes that are split across multiple commits.
Expand Down
45 changes: 39 additions & 6 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const { validateString } = require('internal/validators');
const HIGH_WATER_MARK = getDefaultHighWaterMark();
const { CRLF, debug } = common;

const kCorked = Symbol('corked');

const RE_CONN_CLOSE = /(?:^|\W)close(?:$|\W)/i;
const RE_TE_CHUNKED = common.chunkExpression;

Expand Down Expand Up @@ -99,6 +101,7 @@ function OutgoingMessage() {

this.finished = false;
this._headerSent = false;
this[kCorked] = 0;

this.socket = null;
this._header = null;
Expand Down Expand Up @@ -137,6 +140,13 @@ Object.defineProperty(OutgoingMessage.prototype, 'writableHighWaterMark', {
}
});

Object.defineProperty(OutgoingMessage.prototype, 'writableCorked', {
get() {
const corked = this.socket ? this.socket.writableCorked : 0;
return corked + this[kCorked];
}
});

Object.defineProperty(OutgoingMessage.prototype, '_headers', {
get: internalUtil.deprecate(function() {
return this.getHeaders();
Expand Down Expand Up @@ -213,6 +223,21 @@ OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
return headers;
};

OutgoingMessage.prototype.cork = function() {
if (this.socket) {
this.socket.cork();
} else {
this[kCorked]++;
}
};

OutgoingMessage.prototype.uncork = function() {
if (this.socket) {
this.socket.uncork();
} else if (this[kCorked]) {
this[kCorked]--;
}
};

OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {

Expand Down Expand Up @@ -710,7 +735,10 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
return this;
}

var uncork;
if (this.socket) {
this.socket.cork();
}

if (chunk) {
if (typeof chunk !== 'string' && !(chunk instanceof Buffer)) {
throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
Expand All @@ -721,10 +749,6 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
else
this._contentLength = chunk.length;
}
if (this.socket) {
this.socket.cork();
uncork = true;
}
write_(this, chunk, encoding, null, true);
} else if (!this._header) {
this._contentLength = 0;
Expand All @@ -743,8 +767,12 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
this._send('', 'latin1', finish);
}

if (uncork)
if (this.socket) {
// Fully uncork connection on end().
this.socket._writableState.corked = 1;
this.socket.uncork();
}
this[kCorked] = 0;

this.finished = true;

Expand Down Expand Up @@ -805,6 +833,11 @@ OutgoingMessage.prototype._flush = function _flush() {
};

OutgoingMessage.prototype._flushOutput = function _flushOutput(socket) {
while (this[kCorked]) {
this[kCorked]--;
socket.cork();
}

const outputLength = this.outputData.length;
if (outputLength <= 0)
return undefined;
Expand Down
10 changes: 10 additions & 0 deletions lib/_stream_duplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ Object.defineProperty(Duplex.prototype, 'writableFinished', {
}
});

Object.defineProperty(Duplex.prototype, 'writableCorked', {
// Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get() {
return this._writableState ? this._writableState.corked : 0;
}
});

Object.defineProperty(Duplex.prototype, 'writableEnded', {
// Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/crypto/cipher.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ function rsaFunctionFor(method, defaultPadding, keyType) {
const publicEncrypt = rsaFunctionFor(_publicEncrypt, RSA_PKCS1_OAEP_PADDING,
'public');
const publicDecrypt = rsaFunctionFor(_publicDecrypt, RSA_PKCS1_PADDING,
'private');
'public');
const privateEncrypt = rsaFunctionFor(_privateEncrypt, RSA_PKCS1_PADDING,
'private');
const privateDecrypt = rsaFunctionFor(_privateDecrypt, RSA_PKCS1_OAEP_PADDING,
'public');
'private');

function getDecoder(decoder, encoding) {
encoding = normalizeEncoding(encoding);
Expand Down
12 changes: 12 additions & 0 deletions lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ class Http2ServerResponse extends Stream {
return this[kState].statusCode;
}

get writableCorked() {
return this[kStream].writableCorked;
}

set statusCode(code) {
code |= 0;
if (code >= 100 && code < 200)
Expand Down Expand Up @@ -627,6 +631,14 @@ class Http2ServerResponse extends Stream {
return this;
}

cork() {
this[kStream].cork();
}

uncork() {
this[kStream].uncork();
}

write(chunk, encoding, cb) {
if (typeof encoding === 'function') {
cb = encoding;
Expand Down
40 changes: 28 additions & 12 deletions test/parallel/test-crypto-key-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ const {
createPrivateKey,
KeyObject,
randomBytes,
publicDecrypt,
publicEncrypt,
privateDecrypt
privateDecrypt,
privateEncrypt
} = require('crypto');

const fixtures = require('../common/fixtures');
Expand Down Expand Up @@ -156,7 +158,16 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
assert(Buffer.isBuffer(privateDER));

const plaintext = Buffer.from('Hello world', 'utf8');
const ciphertexts = [
const testDecryption = (fn, ciphertexts, decryptionKeys) => {
for (const ciphertext of ciphertexts) {
for (const key of decryptionKeys) {
const deciphered = fn(key, ciphertext);
assert.deepStrictEqual(deciphered, plaintext);
}
}
};

testDecryption(privateDecrypt, [
// Encrypt using the public key.
publicEncrypt(publicKey, plaintext),
publicEncrypt({ key: publicKey }, plaintext),
Expand All @@ -173,20 +184,25 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
// DER-encoded data only.
publicEncrypt({ format: 'der', type: 'pkcs1', key: publicDER }, plaintext),
publicEncrypt({ format: 'der', type: 'pkcs1', key: privateDER }, plaintext)
];

const decryptionKeys = [
], [
privateKey,
{ format: 'pem', key: privatePem },
{ format: 'der', type: 'pkcs1', key: privateDER }
];
]);

for (const ciphertext of ciphertexts) {
for (const key of decryptionKeys) {
const deciphered = privateDecrypt(key, ciphertext);
assert(plaintext.equals(deciphered));
}
}
testDecryption(publicDecrypt, [
privateEncrypt(privateKey, plaintext)
], [
// Decrypt using the public key.
publicKey,
{ format: 'pem', key: publicPem },
{ format: 'der', type: 'pkcs1', key: publicDER },

// Decrypt using the private key.
privateKey,
{ format: 'pem', key: privatePem },
{ format: 'der', type: 'pkcs1', key: privateDER }
]);
}

{
Expand Down
Loading