2016-10-18 17:41:26 +03:00
|
|
|
{
|
2017-12-05 03:07:53 +03:00
|
|
|
# 'force_load' means to include the static libs into the shared lib or
|
|
|
|
# executable. Therefore, it is enabled when building:
|
|
|
|
# 1. The executable and it uses static lib (cctest and node)
|
|
|
|
# 2. The shared lib
|
|
|
|
# Linker optimizes out functions that are not used. When force_load=true,
|
|
|
|
# --whole-archive,force_load and /WHOLEARCHIVE are used to include
|
|
|
|
# all obj files in static libs into the executable or shared lib.
|
|
|
|
'variables': {
|
|
|
|
'variables': {
|
|
|
|
'variables': {
|
|
|
|
'force_load%': 'true',
|
|
|
|
'current_type%': '<(_type)',
|
|
|
|
},
|
|
|
|
'force_load%': '<(force_load)',
|
|
|
|
'conditions': [
|
|
|
|
['current_type=="static_library"', {
|
|
|
|
'force_load': 'false',
|
|
|
|
}],
|
|
|
|
[ 'current_type=="executable" and node_target_type=="shared_library"', {
|
|
|
|
'force_load': 'false',
|
|
|
|
}]
|
|
|
|
],
|
|
|
|
},
|
|
|
|
'force_load%': '<(force_load)',
|
|
|
|
},
|
2016-10-18 17:41:26 +03:00
|
|
|
'conditions': [
|
|
|
|
[ 'node_shared=="false"', {
|
|
|
|
'msvs_settings': {
|
|
|
|
'VCManifestTool': {
|
|
|
|
'EmbedManifest': 'true',
|
|
|
|
'AdditionalManifestFiles': 'src/res/node.exe.extra.manifest'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
'defines': [
|
|
|
|
'NODE_SHARED_MODE',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'node_enable_d8=="true"', {
|
|
|
|
'dependencies': [ 'deps/v8/src/d8.gyp:d8' ],
|
|
|
|
}],
|
|
|
|
[ 'node_use_bundled_v8=="true"', {
|
|
|
|
'dependencies': [
|
|
|
|
'deps/v8/src/v8.gyp:v8',
|
|
|
|
'deps/v8/src/v8.gyp:v8_libplatform'
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'node_use_v8_platform=="true"', {
|
|
|
|
'defines': [
|
|
|
|
'NODE_USE_V8_PLATFORM=1',
|
|
|
|
],
|
|
|
|
}, {
|
|
|
|
'defines': [
|
|
|
|
'NODE_USE_V8_PLATFORM=0',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'node_tag!=""', {
|
|
|
|
'defines': [ 'NODE_TAG="<(node_tag)"' ],
|
|
|
|
}],
|
|
|
|
[ 'node_v8_options!=""', {
|
|
|
|
'defines': [ 'NODE_V8_OPTIONS="<(node_v8_options)"'],
|
|
|
|
}],
|
|
|
|
[ 'node_release_urlbase!=""', {
|
|
|
|
'defines': [
|
|
|
|
'NODE_RELEASE_URLBASE="<(node_release_urlbase)"',
|
|
|
|
]
|
|
|
|
}],
|
http2: introducing HTTP/2
At long last: The initial *experimental* implementation of HTTP/2.
This is an accumulation of the work that has been done in the nodejs/http2
repository, squashed down to a couple of commits. The original commit
history has been preserved in the nodejs/http2 repository.
This PR introduces the nghttp2 C library as a new dependency. This library
provides the majority of the HTTP/2 protocol implementation, with the rest
of the code here providing the mapping of the library into a usable JS API.
Within src, a handful of new node_http2_*.c and node_http2_*.h files are
introduced. These provide the internal mechanisms that interface with nghttp
and define the `process.binding('http2')` interface.
The JS API is defined within `internal/http2/*.js`.
There are two APIs provided: Core and Compat.
The Core API is HTTP/2 specific and is designed to be as minimal and as
efficient as possible.
The Compat API is intended to be as close to the existing HTTP/1 API as
possible, with some exceptions.
Tests, documentation and initial benchmarks are included.
The `http2` module is gated by a new `--expose-http2` command line flag.
When used, `require('http2')` will be exposed to users. Note that there
is an existing `http2` module on npm that would be impacted by the introduction
of this module, which is the main reason for gating this behind a flag.
When using `require('http2')` the first time, a process warning will be
emitted indicating that an experimental feature is being used.
To run the benchmarks, the `h2load` tool (part of the nghttp project) is
required: `./node benchmarks/http2/simple.js benchmarker=h2load`. Only
two benchmarks are currently available.
Additional configuration options to enable verbose debugging are provided:
```
$ ./configure --debug-http2 --debug-nghttp2
$ NODE_DEBUG=http2 ./node
```
The `--debug-http2` configuration option enables verbose debug statements
from the `src/node_http2_*` files. The `--debug-nghttp2` enables the nghttp
library's own verbose debug output. The `NODE_DEBUG=http2` enables JS-level
debug output.
The following illustrates as simple HTTP/2 server and client interaction:
(The HTTP/2 client and server support both plain text and TLS connections)
```jt client = http2.connect('http://localhost:80');
const req = client.request({ ':path': '/some/path' });
req.on('data', (chunk) => { /* do something with the data */ });
req.on('end', () => {
client.destroy();
});
// Plain text (non-TLS server)
const server = http2.createServer();
server.on('stream', (stream, requestHeaders) => {
stream.respond({ ':status': 200 });
stream.write('hello ');
stream.end('world');
});
server.listen(80);
```
```js
const http2 = require('http2');
const client = http2.connect('http://localhost');
```
Author: Anna Henningsen <anna@addaleax.net>
Author: Colin Ihrig <cjihrig@gmail.com>
Author: Daniel Bevenius <daniel.bevenius@gmail.com>
Author: James M Snell <jasnell@gmail.com>
Author: Jun Mukai
Author: Kelvin Jin
Author: Matteo Collina <matteo.collina@gmail.com>
Author: Robert Kowalski <rok@kowalski.gd>
Author: Santiago Gimeno <santiago.gimeno@gmail.com>
Author: Sebastiaan Deckers <sebdeckers83@gmail.com>
Author: Yosuke Furukawa <yosuke.furukawa@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/14239
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-07-17 20:17:16 +03:00
|
|
|
[
|
|
|
|
'debug_http2==1', {
|
|
|
|
'defines': [ 'NODE_DEBUG_HTTP2=1' ]
|
|
|
|
}],
|
2016-10-18 17:41:26 +03:00
|
|
|
[ 'v8_enable_i18n_support==1', {
|
|
|
|
'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
|
|
|
|
'dependencies': [
|
|
|
|
'<(icu_gyp_path):icui18n',
|
|
|
|
'<(icu_gyp_path):icuuc',
|
|
|
|
],
|
|
|
|
'conditions': [
|
|
|
|
[ 'icu_small=="true"', {
|
|
|
|
'defines': [ 'NODE_HAVE_SMALL_ICU=1' ],
|
|
|
|
}]],
|
|
|
|
}],
|
|
|
|
[ 'node_use_bundled_v8=="true" and \
|
|
|
|
node_enable_v8_vtunejit=="true" and (target_arch=="x64" or \
|
|
|
|
target_arch=="ia32" or target_arch=="x32")', {
|
|
|
|
'defines': [ 'NODE_ENABLE_VTUNE_PROFILING' ],
|
|
|
|
'dependencies': [
|
|
|
|
'deps/v8/src/third_party/vtune/v8vtune.gyp:v8_vtune'
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'node_no_browser_globals=="true"', {
|
|
|
|
'defines': [ 'NODE_NO_BROWSER_GLOBALS' ],
|
|
|
|
} ],
|
|
|
|
[ 'node_use_bundled_v8=="true" and v8_postmortem_support=="true"', {
|
|
|
|
'dependencies': [ 'deps/v8/src/v8.gyp:postmortem-metadata' ],
|
|
|
|
'conditions': [
|
|
|
|
# -force_load is not applicable for the static library
|
2017-12-05 03:07:53 +03:00
|
|
|
[ 'force_load=="true"', {
|
2016-10-18 17:41:26 +03:00
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_LDFLAGS': [
|
2017-10-16 16:34:42 +03:00
|
|
|
'-Wl,-force_load,<(v8_base)',
|
2016-10-18 17:41:26 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'node_shared_zlib=="false"', {
|
|
|
|
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
|
|
|
|
}],
|
|
|
|
|
|
|
|
[ 'node_shared_http_parser=="false"', {
|
|
|
|
'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
|
|
|
|
}],
|
|
|
|
|
|
|
|
[ 'node_shared_cares=="false"', {
|
|
|
|
'dependencies': [ 'deps/cares/cares.gyp:cares' ],
|
|
|
|
}],
|
|
|
|
|
|
|
|
[ 'node_shared_libuv=="false"', {
|
|
|
|
'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
|
|
|
|
}],
|
|
|
|
|
2017-11-06 11:59:01 +03:00
|
|
|
[ 'node_shared_nghttp2=="false"', {
|
|
|
|
'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ],
|
|
|
|
}],
|
|
|
|
|
2016-10-18 17:41:26 +03:00
|
|
|
[ 'OS=="mac"', {
|
|
|
|
# linking Corefoundation is needed since certain OSX debugging tools
|
|
|
|
# like Instruments require it for some features
|
|
|
|
'libraries': [ '-framework CoreFoundation' ],
|
|
|
|
'defines!': [
|
|
|
|
'NODE_PLATFORM="mac"',
|
|
|
|
],
|
|
|
|
'defines': [
|
|
|
|
# we need to use node's preferred "darwin" rather than gyp's preferred "mac"
|
|
|
|
'NODE_PLATFORM="darwin"',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'OS=="freebsd"', {
|
|
|
|
'libraries': [
|
|
|
|
'-lutil',
|
|
|
|
'-lkvm',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'OS=="aix"', {
|
|
|
|
'defines': [
|
|
|
|
'_LINUX_SOURCE_COMPAT',
|
|
|
|
],
|
2017-12-05 03:07:53 +03:00
|
|
|
'conditions': [
|
|
|
|
[ 'force_load=="true"', {
|
|
|
|
|
|
|
|
'actions': [
|
|
|
|
{
|
|
|
|
'action_name': 'expfile',
|
|
|
|
'inputs': [
|
2017-10-16 16:34:42 +03:00
|
|
|
'<(obj_dir)'
|
2017-12-05 03:07:53 +03:00
|
|
|
],
|
|
|
|
'outputs': [
|
|
|
|
'<(PRODUCT_DIR)/node.exp'
|
|
|
|
],
|
|
|
|
'action': [
|
|
|
|
'sh', 'tools/create_expfile.sh',
|
|
|
|
'<@(_inputs)', '<@(_outputs)'
|
|
|
|
],
|
|
|
|
}
|
|
|
|
],
|
|
|
|
'ldflags': ['-Wl,-bE:<(PRODUCT_DIR)/node.exp', '-Wl,-brtl'],
|
|
|
|
}],
|
|
|
|
],
|
2016-10-18 17:41:26 +03:00
|
|
|
}],
|
|
|
|
[ 'OS=="solaris"', {
|
|
|
|
'libraries': [
|
|
|
|
'-lkstat',
|
|
|
|
'-lumem',
|
|
|
|
],
|
|
|
|
'defines!': [
|
|
|
|
'NODE_PLATFORM="solaris"',
|
|
|
|
],
|
|
|
|
'defines': [
|
|
|
|
# we need to use node's preferred "sunos"
|
|
|
|
# rather than gyp's preferred "solaris"
|
|
|
|
'NODE_PLATFORM="sunos"',
|
|
|
|
],
|
|
|
|
}],
|
2017-12-05 03:07:53 +03:00
|
|
|
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
|
2018-01-27 09:35:35 +03:00
|
|
|
' and force_load=="true"', {
|
2016-10-18 17:41:26 +03:00
|
|
|
'ldflags': [ '-Wl,-z,noexecstack',
|
2017-10-16 16:34:42 +03:00
|
|
|
'-Wl,--whole-archive <(v8_base)',
|
2016-10-18 17:41:26 +03:00
|
|
|
'-Wl,--no-whole-archive' ]
|
|
|
|
}],
|
2018-01-27 09:35:35 +03:00
|
|
|
[ 'OS in "mac freebsd linux" and node_shared=="false"'
|
|
|
|
' and coverage=="true"', {
|
|
|
|
'ldflags': [ '--coverage',
|
2016-10-18 17:41:26 +03:00
|
|
|
'-g',
|
|
|
|
'-O0' ],
|
2018-01-27 09:35:35 +03:00
|
|
|
'cflags': [ '--coverage',
|
2016-10-18 17:41:26 +03:00
|
|
|
'-g',
|
2017-04-13 23:31:44 +03:00
|
|
|
'-O0' ],
|
2018-01-27 09:35:35 +03:00
|
|
|
'cflags!': [ '-O3' ],
|
2017-10-09 21:30:38 +03:00
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_LDFLAGS': [
|
|
|
|
'--coverage',
|
|
|
|
],
|
|
|
|
'OTHER_CFLAGS+': [
|
|
|
|
'--coverage',
|
|
|
|
'-g',
|
|
|
|
'-O0'
|
|
|
|
],
|
|
|
|
}
|
|
|
|
}],
|
2016-10-18 17:41:26 +03:00
|
|
|
[ 'OS=="sunos"', {
|
|
|
|
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
|
|
|
|
}],
|
2017-12-05 03:07:53 +03:00
|
|
|
|
|
|
|
[ 'node_use_openssl=="true"', {
|
|
|
|
'defines': [ 'HAVE_OPENSSL=1' ],
|
|
|
|
'conditions': [
|
|
|
|
['openssl_fips != ""', {
|
|
|
|
'defines': [ 'NODE_FIPS_MODE' ],
|
|
|
|
}],
|
|
|
|
[ 'node_shared_openssl=="false"', {
|
|
|
|
'dependencies': [
|
|
|
|
'./deps/openssl/openssl.gyp:openssl',
|
|
|
|
|
|
|
|
# For tests
|
|
|
|
'./deps/openssl/openssl.gyp:openssl-cli',
|
|
|
|
],
|
|
|
|
'conditions': [
|
|
|
|
# -force_load or --whole-archive are not applicable for
|
|
|
|
# the static library
|
|
|
|
[ 'force_load=="true"', {
|
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_LDFLAGS': [
|
2017-10-16 16:34:42 +03:00
|
|
|
'-Wl,-force_load,<(PRODUCT_DIR)/<(openssl_product)',
|
2017-12-05 03:07:53 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
'conditions': [
|
|
|
|
['OS in "linux freebsd" and node_shared=="false"', {
|
|
|
|
'ldflags': [
|
|
|
|
'-Wl,--whole-archive,'
|
2017-10-16 16:34:42 +03:00
|
|
|
'<(obj_dir)/deps/openssl/'
|
|
|
|
'<(openssl_product)',
|
2017-12-05 03:07:53 +03:00
|
|
|
'-Wl,--no-whole-archive',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
# openssl.def is based on zlib.def, zlib symbols
|
|
|
|
# are always exported.
|
|
|
|
['use_openssl_def==1', {
|
|
|
|
'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
|
|
|
|
}],
|
|
|
|
['OS=="win" and use_openssl_def==0', {
|
|
|
|
'sources': ['deps/zlib/win32/zlib.def'],
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}]]
|
|
|
|
|
|
|
|
}, {
|
|
|
|
'defines': [ 'HAVE_OPENSSL=0' ]
|
|
|
|
}],
|
|
|
|
|
2016-10-18 17:41:26 +03:00
|
|
|
],
|
|
|
|
}
|