Bug 1026609 - HTTP/2 draft 13 part 2 - test updates. r=mcmanus

This commit is contained in:
Nicholas Hurley 2014-06-25 17:33:17 -07:00
Родитель 77d6c29a3a
Коммит 6c7038956c
19 изменённых файлов: 600 добавлений и 498 удалений

Просмотреть файл

@ -25,7 +25,7 @@ var bigListenerMD5 = '8f607cfdd2c87d6a7eedb657dafbd836';
function checkIsHttp2(request) {
try {
if (request.getResponseHeader("X-Firefox-Spdy") == "h2-12") {
if (request.getResponseHeader("X-Firefox-Spdy") == "h2-13") {
if (request.getResponseHeader("X-Connection-Http2") == "yes") {
return true;
}

Просмотреть файл

@ -1,6 +1,25 @@
Version history
===============
### 2.6.0 (2014-06-18) ###
* Upgrade to the latest draft: [draft-ietf-httpbis-http2-13]
[draft-ietf-httpbis-http2-13]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13
### 2.5.3 (2014-06-15) ###
* Exposing API to send ALTSVC frames
### 2.5.2 (2014-05-25) ###
* Fix a bug that occurs when the ALPN negotiation is unsuccessful
### 2.5.1 (2014-05-25) ###
* Support for node 0.11.x
* New cipher suite priority list with comformant ciphers on the top (only available in node >=0.11.x)
### 2.5.0 (2014-04-24) ###
* Upgrade to the latest draft: [draft-ietf-httpbis-http2-12]

Просмотреть файл

@ -1,7 +1,7 @@
node-http2
==========
An HTTP/2 ([draft-ietf-httpbis-http2-12](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12))
An HTTP/2 ([draft-ietf-httpbis-http2-13](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13))
client and server implementation for node.js.
Installation
@ -114,12 +114,12 @@ point to understand the code.
### Test coverage ###
To generate a code coverage report, run `npm test --coverage` (which runs very slowly, be patient).
Code coverage summary as of version 2.4.0:
Code coverage summary as of version 2.5.3:
```
Statements : 93.19% ( 397/426 )
Branches : 79.88% ( 131/164 )
Functions : 93.75% ( 60/64 )
Lines : 93.19% ( 397/426 )
Statements : 92.64% ( 403/435 )
Branches : 79.41% ( 135/170 )
Functions : 92.31% ( 60/65 )
Lines : 92.64% ( 403/435 )
```
There's a hosted version of the detailed (line-by-line) coverage report

Просмотреть файл

@ -121,7 +121,7 @@
//
// [1]: http://nodejs.org/api/https.html
// [2]: http://nodejs.org/api/http.html
// [3]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-8.1.3.2
// [3]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-8.1.3.2
// [expect-continue]: https://github.com/http2/http2-spec/issues/18
// [connect]: https://github.com/http2/http2-spec/issues/230
@ -143,6 +143,7 @@ var https = require('https');
exports.STATUS_CODES = http.STATUS_CODES;
exports.IncomingMessage = IncomingMessage;
exports.OutgoingMessage = OutgoingMessage;
exports.PROTOCOL_VERSION = implementedVersion;
var deprecatedHeaders = [
'connection',
@ -157,6 +158,47 @@ var deprecatedHeaders = [
// When doing NPN/ALPN negotiation, HTTP/1.1 is used as fallback
var supportedProtocols = [implementedVersion, 'http/1.1', 'http/1.0'];
// Ciphersuite list based on the recommendations of http://wiki.mozilla.org/Security/Server_Side_TLS
// The only modification is that kEDH+AESGCM were placed after DHE and ECDHE suites
var cipherSuites = [
'ECDHE-RSA-AES128-GCM-SHA256',
'ECDHE-ECDSA-AES128-GCM-SHA256',
'ECDHE-RSA-AES256-GCM-SHA384',
'ECDHE-ECDSA-AES256-GCM-SHA384',
'DHE-RSA-AES128-GCM-SHA256',
'DHE-DSS-AES128-GCM-SHA256',
'ECDHE-RSA-AES128-SHA256',
'ECDHE-ECDSA-AES128-SHA256',
'ECDHE-RSA-AES128-SHA',
'ECDHE-ECDSA-AES128-SHA',
'ECDHE-RSA-AES256-SHA384',
'ECDHE-ECDSA-AES256-SHA384',
'ECDHE-RSA-AES256-SHA',
'ECDHE-ECDSA-AES256-SHA',
'DHE-RSA-AES128-SHA256',
'DHE-RSA-AES128-SHA',
'DHE-DSS-AES128-SHA256',
'DHE-RSA-AES256-SHA256',
'DHE-DSS-AES256-SHA',
'DHE-RSA-AES256-SHA',
'kEDH+AESGCM',
'AES128-GCM-SHA256',
'AES256-GCM-SHA384',
'ECDHE-RSA-RC4-SHA',
'ECDHE-ECDSA-RC4-SHA',
'AES128',
'AES256',
'RC4-SHA',
'HIGH',
'!aNULL',
'!eNULL',
'!EXPORT',
'!DES',
'!3DES',
'!MD5',
'!PSK'
].join(':');
// Logging
// -------
@ -204,7 +246,7 @@ function IncomingMessage(stream) {
}
IncomingMessage.prototype = Object.create(PassThrough.prototype, { constructor: { value: IncomingMessage } });
// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-8.1.3.1)
// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-8.1.3.1)
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series
// of key-value pairs. This includes the target URI for the request, the status code for the
// response, as well as HTTP header fields.
@ -368,6 +410,8 @@ function Server(options) {
this._mode = 'tls';
options.ALPNProtocols = supportedProtocols;
options.NPNProtocols = supportedProtocols;
options.ciphers = options.ciphers || cipherSuites;
options.honorCipherOrder = (options.honorCipherOrder != false);
this._server = https.createServer(options);
this._originalSocketListeners = this._server.listeners('secureConnection');
this._server.removeAllListeners('secureConnection');
@ -516,7 +560,7 @@ function IncomingRequest(stream) {
}
IncomingRequest.prototype = Object.create(IncomingMessage.prototype, { constructor: { value: IncomingRequest } });
// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-8.1.3.1)
// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-8.1.3.1)
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series
// of key-value pairs. This includes the target URI for the request, the status code for the
// response, as well as HTTP header fields.
@ -633,6 +677,13 @@ OutgoingResponse.prototype.push = function push(options) {
return new OutgoingResponse(pushStream);
};
OutgoingResponse.prototype.altsvc = function altsvc(host, port, protocolID, maxAge, origin) {
if (origin === undefined) {
origin = "";
}
this.stream.altsvc(host, port, protocolID, maxAge, origin);
};
// Overriding `EventEmitter`'s `on(event, listener)` method to forward certain subscriptions to
// `request`. See `Server.prototype.on` for explanation.
OutgoingResponse.prototype.on = function on(event, listener) {
@ -739,12 +790,13 @@ Agent.prototype.request = function request(options, callback) {
options.NPNProtocols = supportedProtocols;
options.servername = options.host; // Server Name Indication
options.agent = this._httpsAgent;
options.ciphers = options.ciphers || cipherSuites;
var httpsRequest = https.request(options);
httpsRequest.on('socket', function(socket) {
var negotiatedProtocol = socket.alpnProtocol || socket.npnProtocol;
if (negotiatedProtocol !== undefined) {
negotiated();
if (negotiatedProtocol != null) { // null in >=0.11.0, undefined in <0.11.0
negotiated()
} else {
socket.on('secureConnect', negotiated);
}
@ -947,7 +999,7 @@ function IncomingResponse(stream) {
}
IncomingResponse.prototype = Object.create(IncomingMessage.prototype, { constructor: { value: IncomingResponse } });
// [Response Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-8.1.3.2)
// [Response Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-8.1.3.2)
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series
// of key-value pairs. This includes the target URI for the request, the status code for the
// response, as well as HTTP header fields.

Просмотреть файл

@ -1,4 +1,4 @@
// [node-http2][homepage] is an [HTTP/2 (draft 12)][http2] implementation for [node.js][node].
// [node-http2][homepage] is an [HTTP/2 (draft 13)][http2] implementation for [node.js][node].
//
// The core of the protocol is implemented by the [http2-protocol] module. This module provides
// two important features on top of http2-protocol:
@ -11,7 +11,7 @@
//
// [homepage]: https://github.com/molnarg/node-http2
// [http2-protocol]: https://github.com/molnarg/node-http2-protocol
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-12
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13
// [node]: http://nodejs.org/
// [node-https]: http://nodejs.org/api/https.html
// [node-http]: http://nodejs.org/api/http.html

18
testing/xpcshell/node-http2/node_modules/http2-protocol/HISTORY.md сгенерированный поставляемый
Просмотреть файл

@ -1,6 +1,24 @@
Version history
===============
### 0.13.0 (2014-06-18) ###
* Upgrade to the latest draft: [draft-ietf-httpbis-http2-13][draft-13]
[draft-13]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13
### 0.12.3 (2014-06-15) ###
* Exposing API to send ALTSVC frames
### 0.12.2 (2014-05-25) ###
* Support for node 0.11.x
### 0.12.1 (2014-04-26) ###
* Support for sending BLOCKED frame
### 0.12.0 (2014-04-24) ###
* Upgrade to the latest draft: [draft-ietf-httpbis-http2-12][draft-12]

12
testing/xpcshell/node-http2/node_modules/http2-protocol/README.md сгенерированный поставляемый
Просмотреть файл

@ -1,7 +1,7 @@
node-http2-protocol
===================
An HTTP/2 ([draft-ietf-httpbis-http2-12](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12))
An HTTP/2 ([draft-ietf-httpbis-http2-13](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13))
framing layer implementaion for node.js.
Installation
@ -50,12 +50,12 @@ point to understand the code.
### Test coverage ###
To generate a code coverage report, run `npm test --coverage` (it may be slow, be patient).
Code coverage summary as of version 0.12.0:
Code coverage summary as of version 0.13.0:
```
Statements : 91.6% ( 1352/1476 )
Branches : 85.15% ( 562/660 )
Functions : 92.5% ( 148/160 )
Lines : 91.69% ( 1346/1468 )
Statements : 92.23% ( 1341/1454 )
Branches : 86% ( 553/643 )
Functions : 91.93% ( 148/161 )
Lines : 92.32% ( 1335/1446 )
```
There's a hosted version of the detailed (line-by-line) coverage report

446
testing/xpcshell/node-http2/node_modules/http2-protocol/lib/compressor.js сгенерированный поставляемый
Просмотреть файл

@ -170,7 +170,7 @@ HeaderTable.staticTable = [
[ ':status' , '404' ],
[ ':status' , '500' ],
[ 'accept-charset' , '' ],
[ 'accept-encoding' , '' ],
[ 'accept-encoding' , 'gzip, deflate'],
[ 'accept-language' , '' ],
[ 'accept-ranges' , '' ],
[ 'accept' , '' ],
@ -708,263 +708,263 @@ HuffmanTable.prototype.decode = function decode(buffer) {
// sed -e "s/^.* [|]//g" -e "s/|//g" -e "s/ .*//g" -e "s/^/ '/g" -e "s/$/',/g"
HuffmanTable.huffmanTable = new HuffmanTable([
'11111111111111111110111010',
'11111111111111111110111011',
'11111111111111111110111100',
'11111111111111111110111101',
'11111111111111111110111110',
'11111111111111111110111111',
'11111111111111111111000000',
'11111111111111111111000001',
'11111111111111111111000010',
'11111111111111111111000011',
'11111111111111111111000100',
'11111111111111111111000101',
'11111111111111111111000110',
'11111111111111111111000111',
'11111111111111111111001000',
'11111111111111111111001001',
'11111111111111111111001010',
'11111111111111111111001011',
'11111111111111111111001100',
'11111111111111111111001101',
'11111111111111111111001110',
'11111111111111111111001111',
'11111111111111111111010000',
'11111111111111111111010001',
'11111111111111111111010010',
'11111111111111111111010011',
'11111111111111111111010100',
'11111111111111111111010101',
'11111111111111111111010110',
'11111111111111111111010111',
'11111111111111111111011000',
'11111111111111111111011001',
'00110',
'1111111111100',
'111110000',
'11111111111100',
'111111111111100',
'011110',
'1100100',
'1111111111101',
'1111111111000',
'11111111111111111011000',
'1111111111111111111111100010',
'1111111111111111111111100011',
'1111111111111111111111100100',
'1111111111111111111111100101',
'1111111111111111111111100110',
'1111111111111111111111100111',
'1111111111111111111111101000',
'111111111111111111101010',
'111111111111111111111111111100',
'1111111111111111111111101001',
'1111111111111111111111101010',
'111111111111111111111111111101',
'1111111111111111111111101011',
'1111111111111111111111101100',
'1111111111111111111111101101',
'1111111111111111111111101110',
'1111111111111111111111101111',
'1111111111111111111111110000',
'1111111111111111111111110001',
'1111111111111111111111110010',
'111111111111111111111111111110',
'1111111111111111111111110011',
'1111111111111111111111110100',
'1111111111111111111111110101',
'1111111111111111111111110110',
'1111111111111111111111110111',
'1111111111111111111111111000',
'1111111111111111111111111001',
'1111111111111111111111111010',
'1111111111111111111111111011',
'010100',
'1111111000',
'1111111001',
'111111111010',
'1111111111001',
'010101',
'11111000',
'11111111010',
'1111111010',
'111110001',
'1111111011',
'11111001',
'11111111011',
'11111010',
'010110',
'010111',
'011000',
'00000',
'00001',
'00010',
'011001',
'011010',
'011011',
'011100',
'011101',
'011110',
'011111',
'1011100',
'11111011',
'111111111111100',
'100000',
'111111111011',
'1111111100',
'1111111111010',
'100001',
'1011101',
'1011110',
'1011111',
'1100000',
'1100001',
'1100010',
'1100011',
'1100100',
'1100101',
'1100110',
'011111',
'00111',
'0000',
'0001',
'0010',
'01000',
'100000',
'100001',
'100010',
'100011',
'100100',
'100101',
'100110',
'11101100',
'11111111111111100',
'100111',
'111111111111101',
'1111111101',
'111111111111110',
'1100111',
'11101101',
'11101110',
'1101000',
'11101111',
'1101001',
'1101010',
'111110010',
'11110000',
'111110011',
'111110100',
'111110101',
'1101011',
'1101100',
'11110001',
'11110010',
'111110110',
'111110111',
'1101101',
'101000',
'11110011',
'111111000',
'111111001',
'11110100',
'111111010',
'111111011',
'11111111100',
'11111111111111111111011010',
'11111111101',
'11111111111101',
'1101110',
'111111111111111110',
'01001',
'1101111',
'01010',
'101001',
'01011',
'1110000',
'101010',
'101011',
'01100',
'11110101',
'11110110',
'101100',
'101101',
'101110',
'01101',
'101111',
'111111100',
'110000',
'110001',
'01110',
'1110001',
'1110010',
'11111100',
'1110011',
'11111101',
'1111111111011',
'1111111111111110000',
'1111111111100',
'11111111111100',
'100010',
'111111111111101',
'00011',
'100011',
'00100',
'100100',
'00101',
'100101',
'100110',
'100111',
'00110',
'1110100',
'1110101',
'11110111',
'11111111111111101',
'111111111100',
'11111111111111110',
'111111111101',
'11111111111111111111011011',
'11111111111111111111011100',
'11111111111111111111011101',
'11111111111111111111011110',
'11111111111111111111011111',
'101000',
'101001',
'101010',
'00111',
'101011',
'1110110',
'101100',
'01000',
'01001',
'101101',
'1110111',
'1111000',
'1111001',
'1111010',
'1111011',
'111111111111110',
'11111111100',
'11111111111101',
'1111111111101',
'1111111111111111111111111100',
'11111111111111100110',
'1111111111111111010010',
'11111111111111100111',
'11111111111111101000',
'1111111111111111010011',
'1111111111111111010100',
'1111111111111111010101',
'11111111111111111011001',
'1111111111111111010110',
'11111111111111111011010',
'11111111111111111011011',
'11111111111111111011100',
'11111111111111111011101',
'11111111111111111011110',
'111111111111111111101011',
'11111111111111111011111',
'111111111111111111101100',
'111111111111111111101101',
'1111111111111111010111',
'11111111111111111100000',
'111111111111111111101110',
'11111111111111111100001',
'11111111111111111100010',
'11111111111111111100011',
'11111111111111111100100',
'111111111111111011100',
'1111111111111111011000',
'11111111111111111100101',
'1111111111111111011001',
'11111111111111111100110',
'11111111111111111100111',
'111111111111111111101111',
'1111111111111111011010',
'111111111111111011101',
'11111111111111101001',
'1111111111111111011011',
'1111111111111111011100',
'11111111111111111101000',
'11111111111111111101001',
'111111111111111011110',
'11111111111111111101010',
'1111111111111111011101',
'1111111111111111011110',
'111111111111111111110000',
'111111111111111011111',
'1111111111111111011111',
'11111111111111111101011',
'11111111111111111101100',
'111111111111111100000',
'111111111111111100001',
'1111111111111111100000',
'111111111111111100010',
'11111111111111111101101',
'1111111111111111100001',
'11111111111111111101110',
'11111111111111111101111',
'11111111111111101010',
'1111111111111111100010',
'1111111111111111100011',
'1111111111111111100100',
'11111111111111111110000',
'1111111111111111100101',
'1111111111111111100110',
'11111111111111111110001',
'11111111111111111111100000',
'11111111111111111111100001',
'11111111111111101011',
'1111111111111110001',
'1111111111111111100111',
'11111111111111111110010',
'1111111111111111101000',
'1111111111111111111101100',
'11111111111111111111100010',
'11111111111111111111100011',
'11111111111111111111100100',
'111111111111111111111011110',
'111111111111111111111011111',
'11111111111111111111100101',
'111111111111111111110001',
'1111111111111111111101101',
'1111111111111110010',
'111111111111111100011',
'11111111111111111111100110',
'111111111111111111111100000',
'111111111111111111111100001',
'11111111111111111111100111',
'111111111111111111111100010',
'111111111111111111110010',
'111111111111111100100',
'111111111111111100101',
'11111111111111111111101000',
'11111111111111111111101001',
'1111111111111111111111111101',
'111111111111111111111100011',
'111111111111111111111100100',
'111111111111111111111100101',
'11111111111111101100',
'111111111111111111110011',
'11111111111111101101',
'111111111111111100110',
'1111111111111111101001',
'111111111111111100111',
'111111111111111101000',
'11111111111111111110011',
'1111111111111111101010',
'1111111111111111101011',
'1111111111111111111101110',
'1111111111111111111101111',
'111111111111111111110100',
'111111111111111111110101',
'11111111111111111111101010',
'11111111111111111110100',
'11111111111111111111101011',
'111111111111111111111100110',
'11111111111111111111101100',
'11111111111111111111101101',
'111111111111111111111100111',
'111111111111111111111101000',
'111111111111111111111101001',
'111111111111111111111101010',
'111111111111111111111101011',
'1111111111111111111111111110',
'111111111111111111111101100',
'111111111111111111111101101',
'111111111111111111111101110',
'111111111111111111111101111',
'111111111111111111111110000',
'11111111111111111111101110',
'11111111111111111111101111',
'11111111111111111111110000',
'11111111111111111111110001',
'11111111111111111111110010',
'11111111111111111111110011',
'11111111111111111111110100',
'11111111111111111111110101',
'11111111111111111111110110',
'11111111111111111111110111',
'11111111111111111111111000',
'11111111111111111111111001',
'11111111111111111111111010',
'11111111111111111111111011',
'11111111111111111111111100',
'11111111111111111111111101',
'11111111111111111111111110',
'11111111111111111111111111',
'1111111111111111110000000',
'1111111111111111110000001',
'1111111111111111110000010',
'1111111111111111110000011',
'1111111111111111110000100',
'1111111111111111110000101',
'1111111111111111110000110',
'1111111111111111110000111',
'1111111111111111110001000',
'1111111111111111110001001',
'1111111111111111110001010',
'1111111111111111110001011',
'1111111111111111110001100',
'1111111111111111110001101',
'1111111111111111110001110',
'1111111111111111110001111',
'1111111111111111110010000',
'1111111111111111110010001',
'1111111111111111110010010',
'1111111111111111110010011',
'1111111111111111110010100',
'1111111111111111110010101',
'1111111111111111110010110',
'1111111111111111110010111',
'1111111111111111110011000',
'1111111111111111110011001',
'1111111111111111110011010',
'1111111111111111110011011',
'1111111111111111110011100',
'1111111111111111110011101',
'1111111111111111110011110',
'1111111111111111110011111',
'1111111111111111110100000',
'1111111111111111110100001',
'1111111111111111110100010',
'1111111111111111110100011',
'1111111111111111110100100',
'1111111111111111110100101',
'1111111111111111110100110',
'1111111111111111110100111',
'1111111111111111110101000',
'1111111111111111110101001',
'1111111111111111110101010',
'1111111111111111110101011',
'1111111111111111110101100',
'1111111111111111110101101',
'1111111111111111110101110',
'1111111111111111110101111',
'1111111111111111110110000',
'1111111111111111110110001',
'1111111111111111110110010',
'1111111111111111110110011',
'1111111111111111110110100',
'1111111111111111110110101',
'1111111111111111110110110',
'1111111111111111110110111',
'1111111111111111110111000',
'1111111111111111110111001',
'1111111111111111110111010',
'1111111111111111110111011',
'1111111111111111110111100',
'1111111111111111110111101',
'1111111111111111110111110',
'1111111111111111110111111',
'1111111111111111111000000',
'1111111111111111111000001',
'1111111111111111111000010',
'1111111111111111111000011',
'1111111111111111111000100',
'1111111111111111111000101',
'1111111111111111111000110',
'1111111111111111111000111',
'1111111111111111111001000',
'1111111111111111111001001',
'1111111111111111111001010',
'1111111111111111111001011',
'1111111111111111111001100',
'1111111111111111111001101',
'1111111111111111111001110',
'1111111111111111111001111',
'1111111111111111111010000',
'1111111111111111111010001',
'1111111111111111111010010',
'1111111111111111111010011',
'1111111111111111111010100',
'1111111111111111111010101',
'1111111111111111111010110',
'1111111111111111111010111',
'1111111111111111111011000',
'1111111111111111111011001',
'1111111111111111111011010',
'1111111111111111111011011',
'1111111111111111111011100'
'111111111111111111111111111111'
]);
// ### String literal representation ###

48
testing/xpcshell/node-http2/node_modules/http2-protocol/lib/flow.js сгенерированный поставляемый
Просмотреть файл

@ -19,7 +19,7 @@ exports.Flow = Flow;
// * **setInitialWindow(size)**: the initial flow control window size can be changed *any time*
// ([as described in the standard][1]) using this method
//
// [1]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.9.2
// [1]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.9.2
// API for child classes
// ---------------------
@ -64,6 +64,7 @@ function Flow(flowControlId) {
this._queue = [];
this._ended = false;
this._received = 0;
this._blocked = false;
}
Flow.prototype = Object.create(Duplex.prototype, { constructor: { value: Flow } });
@ -106,6 +107,7 @@ Flow.prototype._write = function _write(frame, encoding, callback) {
// `_restoreWindow` basically acknowledges the DATA frames received since it's last call. It sends
// a WINDOW_UPDATE that restores the flow control window of the remote end.
// TODO: push this directly into the output queue. No need to wait for DATA frames in the queue.
Flow.prototype._restoreWindow = function _restoreWindow() {
delete this._restoreWindowTimer;
if (!this._ended && (this._received > 0)) {
@ -154,6 +156,7 @@ Flow.prototype._read = function _read() {
// * if there are items in the flow control queue, then let's put them into the output queue (to
// the extent it is possible with respect to the window size and output queue feedback)
else if (this._window > 0) {
this._blocked = false;
this._readableState.sync = true; // to avoid reentrant calls
do {
var moreNeeded = this._push(this._queue[0]);
@ -169,8 +172,14 @@ Flow.prototype._read = function _read() {
}
// * otherwise, come back when the flow control window is positive
else {
else if (!this._blocked) {
this._parentPush({
type: 'BLOCKED',
flags: {},
stream: this._flowControlId
})
this.once('window_update', this._read);
this._blocked = true;
}
};
@ -188,41 +197,26 @@ Flow.prototype.read = function read(limit) {
limit = MAX_PAYLOAD_SIZE;
}
// * Looking at the first frame in the queue without pulling it out if possible. This will save
// a costly unshift if the frame proves to be too large to return.
var firstInQueue = this._readableState.buffer[0];
var frame = firstInQueue || Duplex.prototype.read.call(this);
if ((frame === null) || (frame.type !== 'DATA') || (frame.data.length <= limit)) {
if (firstInQueue) {
Duplex.prototype.read.call(this);
}
return frame;
// * Looking at the first frame in the queue without pulling it out if possible.
var frame = this._readableState.buffer[0];
if (!frame && !this._readableState.ended) {
this._read();
frame = this._readableState.buffer[0];
}
else if (limit <= 0) {
if (!firstInQueue) {
this.unshift(frame);
}
return null;
}
else {
if (frame && (frame.type === 'DATA') && limit && (frame.data.length > limit)) {
this._log.trace({ frame: frame, size: frame.data.length, forwardable: limit },
'Splitting out forwardable part of a DATA frame.');
var forwardable = {
this.unshift({
type: 'DATA',
flags: {},
stream: frame.stream,
data: frame.data.slice(0, limit)
};
});
frame.data = frame.data.slice(limit);
if (!firstInQueue) {
this.unshift(frame);
}
return forwardable;
}
return Duplex.prototype.read.call(this);
};
// `_parentPush` pushes the given `frame` into the output queue

178
testing/xpcshell/node-http2/node_modules/http2-protocol/lib/framer.js сгенерированный поставляемый
Просмотреть файл

@ -139,7 +139,7 @@ Deserializer.prototype._transform = function _transform(chunk, encoding, done) {
}
} else {
this._log.error('Unknown type incoming frame');
this.emit('error', 'PROTOCOL_ERROR');
// Ignore it other than logging
}
this._next(COMMON_HEADER_SIZE);
}
@ -148,7 +148,7 @@ Deserializer.prototype._transform = function _transform(chunk, encoding, done) {
done();
};
// [Frame Header](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-4.1)
// [Frame Header](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-4.1)
// --------------------------------------------------------------
//
// HTTP/2.0 frames share a common base format consisting of an 8-byte header followed by 0 to 65535
@ -239,6 +239,10 @@ Deserializer.commonHeader = function readCommonHeader(buffer, frame) {
var length = buffer.readUInt16BE(0);
frame.type = frameTypes[buffer.readUInt8(2)];
if (!frame.type) {
// We are required to ignore unknown frame types
return length;
}
frame.flags = {};
var flagByte = buffer.readUInt8(3);
@ -262,7 +266,7 @@ Deserializer.commonHeader = function readCommonHeader(buffer, frame) {
// * `typeSpecificAttributes`: a register of frame specific frame object attributes (used by
// logging code and also serves as documentation for frame objects)
// [DATA Frames](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.1)
// [DATA Frames](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.1)
// ------------------------------------------------------------
//
// DATA frames (type=0x0) convey arbitrary, variable-length sequences of octets associated with a
@ -277,18 +281,12 @@ Deserializer.commonHeader = function readCommonHeader(buffer, frame) {
// Bit 2 being set indicates that this frame is the last for the current segment. Intermediaries
// MUST NOT coalesce frames across a segment boundary and MUST preserve segment boundaries when
// forwarding frames.
// * PAD_LOW (0x08):
// Bit 4 being set indicates that the Pad Low field is present.
// * PAD_HIGH (0x10):
// Bit 5 being set indicates that the Pad High field is present. This bit MUST NOT be set unless
// the PAD_LOW flag is also set. Endpoints that receive a frame with PAD_HIGH set and PAD_LOW
// cleared MUST treat this as a connection error of type PROTOCOL_ERROR.
// * COMPRESSED (0x20):
// Bit 6 being set indicates that the data in the frame has been compressed with GZIP compression.
// * PADDED (0x08):
// Bit 4 being set indicates that the Pad Length field is present.
frameTypes[0x0] = 'DATA';
frameFlags.DATA = ['END_STREAM', 'END_SEGMENT', 'RESERVED4', 'PAD_LOW', 'PAD_HIGH', 'COMPRESSED'];
frameFlags.DATA = ['END_STREAM', 'END_SEGMENT', 'RESERVED4', 'PADDED'];
typeSpecificAttributes.DATA = ['data'];
@ -299,19 +297,9 @@ Serializer.DATA = function writeData(frame, buffers) {
Deserializer.DATA = function readData(buffer, frame) {
var dataOffset = 0;
var paddingLength = 0;
if (frame.flags.PAD_LOW) {
if (frame.flags.PAD_HIGH) {
paddingLength = (buffer.readUInt8(dataOffset) & 0xff) * 256;
dataOffset += 1;
}
paddingLength += (buffer.readUInt8(dataOffset) & 0xff);
dataOffset += 1;
} else if (frame.flags.PAD_HIGH) {
return 'DATA frame got PAD_HIGH without PAD_LOW';
}
if (frame.flags.COMPRESSED) {
return 'DATA frame received COMPRESSED data (unsupported)';
if (frame.flags.PADDED) {
paddingLength = (buffer.readUInt8(dataOffset) & 0xff);
dataOffset = 1;
}
if (paddingLength) {
@ -321,7 +309,7 @@ Deserializer.DATA = function readData(buffer, frame) {
}
};
// [HEADERS](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.2)
// [HEADERS](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.2)
// --------------------------------------------------------------
//
// The HEADERS frame (type=0x1) allows the sender to create a stream.
@ -338,23 +326,22 @@ Deserializer.DATA = function readData(buffer, frame) {
// * END_HEADERS (0x4):
// The END_HEADERS bit indicates that this frame contains the entire payload necessary to provide
// a complete set of headers.
// * PAD_LOW (0x08):
// Bit 5 being set indicates that the Pad Low field is present.
// * PAD_HIGH (0x10):
// Bit 6 being set indicates that the Pad High field is present. This bit MUST NOT be set unless
// the PAD_LOW flag is also set. Endpoints that receive a frame with PAD_HIGH set and PAD_LOW
// cleared MUST treat this as a connection error of type PROTOCOL_ERROR.
// * PADDED (0x08):
// Bit 4 being set indicates that the Pad Length field is present.
// * PRIORITY (0x20):
// Bit 6 being set indicates that the Exlusive Flag (E), Stream Dependency, and Weight fields are
// present.
frameTypes[0x1] = 'HEADERS';
frameFlags.HEADERS = ['END_STREAM', 'END_SEGMENT', 'END_HEADERS', 'PAD_LOW', 'PAD_HIGH', 'PRIORITY'];
frameFlags.HEADERS = ['END_STREAM', 'END_SEGMENT', 'END_HEADERS', 'PADDED', 'RESERVED5', 'PRIORITY'];
typeSpecificAttributes.HEADERS = ['priorityDependency', 'priorityWeight', 'exclusiveDependency', 'headers', 'data'];
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Pad High? (8) | Pad Low? (8) |
// |Pad Length? (8)|
// +-+-------------+---------------+-------------------------------+
// |E| Stream Dependency? (31) |
// +-+-------------+-----------------------------------------------+
@ -385,15 +372,9 @@ Serializer.HEADERS = function writeHeadersPriority(frame, buffers) {
Deserializer.HEADERS = function readHeadersPriority(buffer, frame) {
var dataOffset = 0;
var paddingLength = 0;
if (frame.flags.PAD_LOW) {
if (frame.flags.PAD_HIGH) {
paddingLength = (buffer.readUInt8(dataOffset) & 0xff) * 256;
dataOffset += 1;
}
paddingLength += (buffer.readUInt8(dataOffset) & 0xff);
dataOffset += 1;
} else if (frame.flags.PAD_HIGH) {
return 'HEADERS frame got PAD_HIGH without PAD_LOW';
if (frame.flags.PADDED) {
paddingLength = (buffer.readUInt8(dataOffset) & 0xff);
dataOffset = 1;
}
if (frame.flags.PRIORITY) {
@ -414,7 +395,7 @@ Deserializer.HEADERS = function readHeadersPriority(buffer, frame) {
}
};
// [PRIORITY](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.3)
// [PRIORITY](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.3)
// -------------------------------------------------------
//
// The PRIORITY frame (type=0x2) specifies the sender-advised priority of a stream.
@ -459,7 +440,7 @@ Deserializer.PRIORITY = function readPriority(buffer, frame) {
frame.priorityWeight = buffer.readUInt8(4);
};
// [RST_STREAM](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.4)
// [RST_STREAM](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.4)
// -----------------------------------------------------------
//
// The RST_STREAM frame (type=0x3) allows for abnormal termination of a stream.
@ -491,9 +472,13 @@ Serializer.RST_STREAM = function writeRstStream(frame, buffers) {
Deserializer.RST_STREAM = function readRstStream(buffer, frame) {
frame.error = errorCodes[buffer.readUInt32BE(0)];
if (!frame.error) {
// Unknown error codes are considered equivalent to INTERNAL_ERROR
frame.error = 'INTERNAL_ERROR';
}
};
// [SETTINGS](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.5)
// [SETTINGS](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.5)
// -------------------------------------------------------
//
// The SETTINGS frame (type=0x4) conveys configuration parameters that affect how endpoints
@ -510,16 +495,16 @@ frameFlags.SETTINGS = ['ACK'];
typeSpecificAttributes.SETTINGS = ['settings'];
// The payload of a SETTINGS frame consists of zero or more settings. Each setting consists of an
// 8-bit identifier, and an unsigned 32-bit value.
// The payload of a SETTINGS frame consists of zero or more settings. Each setting consists of a
// 16-bit identifier, and an unsigned 32-bit value.
//
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Identifier(8) | Value (32) |
// | Identifier(16) | Value (32) |
// +-----------------+---------------------------------------------+
// ...Value |
// +-----------------+
// ...Value |
// +---------------------------------+
//
// Each setting in a SETTINGS frame replaces the existing value for that setting. Settings are
// processed in the order in which they appear, and a receiver of a SETTINGS frame does not need to
@ -539,10 +524,10 @@ Serializer.SETTINGS = function writeSettings(frame, buffers) {
});
assert(settingsLeft.length === 0, 'Unknown settings: ' + settingsLeft.join(', '));
var buffer = new Buffer(settings.length * 5);
var buffer = new Buffer(settings.length * 6);
for (var i = 0; i < settings.length; i++) {
buffer.writeUInt8(settings[i].id & 0xff, i*5);
buffer.writeUInt32BE(settings[i].value, i*5 + 1);
buffer.writeUInt16BE(settings[i].id & 0xffff, i*6);
buffer.writeUInt32BE(settings[i].value, i*6 + 2);
}
buffers.push(buffer);
@ -550,7 +535,7 @@ Serializer.SETTINGS = function writeSettings(frame, buffers) {
Deserializer.SETTINGS = function readSettings(buffer, frame, role) {
frame.settings = {};
// Receipt of a SETTINGS frame with the ACK flag set and a length
// field value other than 0 MUST be treated as a connection error
// (Section 5.4.1) of type FRAME_SIZE_ERROR.
@ -558,21 +543,18 @@ Deserializer.SETTINGS = function readSettings(buffer, frame, role) {
return 'FRAME_SIZE_ERROR';
}
if (buffer.length % 5 !== 0) {
if (buffer.length % 6 !== 0) {
return 'PROTOCOL_ERROR';
}
for (var i = 0; i < buffer.length / 5; i++) {
var id = buffer.readUInt8(i*5) & 0xff;
for (var i = 0; i < buffer.length / 6; i++) {
var id = buffer.readUInt16BE(i*6) & 0xffff;
var setting = definedSettings[id];
if (setting) {
if (role == 'CLIENT' && setting.name == 'SETTINGS_ENABLE_PUSH') {
return 'SETTINGS frame on client got SETTINGS_ENABLE_PUSH';
}
var value = buffer.readUInt32BE(i*5 + 1);
var value = buffer.readUInt32BE(i*6 + 2);
frame.settings[setting.name] = setting.flag ? Boolean(value & 0x1) : value;
} else {
/* Unknown setting, protocol error */
return 'SETTINGS frame got unknown setting type';
}
}
};
@ -599,13 +581,7 @@ definedSettings[3] = { name: 'SETTINGS_MAX_CONCURRENT_STREAMS', flag: false };
// indicates the sender's initial stream window size (in bytes) for new streams.
definedSettings[4] = { name: 'SETTINGS_INITIAL_WINDOW_SIZE', flag: false };
// * SETTINGS_COMPRESS_DATA (5):
// this setting is used to enable GZip compression of DATA frames. A value of 1 indicates that
// DATA frames MAY be compressed. A value of 0 indicates that compression is not permitted.
// The initial value is 0.
definedSettings[5] = { name: 'SETTINGS_COMPRESS_DATA', flag: true };
// [PUSH_PROMISE](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.6)
// [PUSH_PROMISE](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.6)
// ---------------------------------------------------------------
//
// The PUSH_PROMISE frame (type=0x5) is used to notify the peer endpoint in advance of streams the
@ -619,16 +595,20 @@ definedSettings[5] = { name: 'SETTINGS_COMPRESS_DATA', flag: true };
frameTypes[0x5] = 'PUSH_PROMISE';
frameFlags.PUSH_PROMISE = ['RESERVED1', 'RESERVED2', 'END_PUSH_PROMISE', 'PAD_LOW', 'PAD_HIGH'];
frameFlags.PUSH_PROMISE = ['RESERVED1', 'RESERVED2', 'END_PUSH_PROMISE', 'PADDED'];
typeSpecificAttributes.PUSH_PROMISE = ['promised_stream', 'headers', 'data'];
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |Pad Length? (8)|
// +-+-------------+-----------------------------------------------+
// |X| Promised-Stream-ID (31) |
// +-+-------------------------------------------------------------+
// | Header Block (*) ...
// | Header Block Fragment (*) ...
// +---------------------------------------------------------------+
// | Padding (*) ...
// +---------------------------------------------------------------+
//
// The PUSH_PROMISE frame includes the unsigned 31-bit identifier of
@ -649,15 +629,9 @@ Serializer.PUSH_PROMISE = function writePushPromise(frame, buffers) {
Deserializer.PUSH_PROMISE = function readPushPromise(buffer, frame) {
var dataOffset = 0;
var paddingLength = 0;
if (frame.flags.PAD_LOW) {
if (frame.flags.PAD_HIGH) {
paddingLength = (buffer.readUInt8(dataOffset) & 0xff) * 256;
dataOffset += 1;
}
paddingLength += (buffer.readUInt8(dataOffset) & 0xff);
dataOffset += 1;
} else if (frame.flags.PAD_HIGH) {
return 'PUSH_PROMISE frame got PAD_HIGH without PAD_LOW';
if (frame.flags.PADDED) {
paddingLength = (buffer.readUInt8(dataOffset) & 0xff);
dataOffset = 1;
}
frame.promised_stream = buffer.readUInt32BE(dataOffset) & 0x7fffffff;
dataOffset += 4;
@ -668,7 +642,7 @@ Deserializer.PUSH_PROMISE = function readPushPromise(buffer, frame) {
}
};
// [PING](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.7)
// [PING](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.7)
// -----------------------------------------------
//
// The PING frame (type=0x6) is a mechanism for measuring a minimal round-trip time from the
@ -698,7 +672,7 @@ Deserializer.PING = function readPing(buffer, frame) {
frame.data = buffer;
};
// [GOAWAY](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.8)
// [GOAWAY](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.8)
// ---------------------------------------------------
//
// The GOAWAY frame (type=0x7) informs the remote peer to stop creating streams on this connection.
@ -743,9 +717,13 @@ Serializer.GOAWAY = function writeGoaway(frame, buffers) {
Deserializer.GOAWAY = function readGoaway(buffer, frame) {
frame.last_stream = buffer.readUInt32BE(0) & 0x7fffffff;
frame.error = errorCodes[buffer.readUInt32BE(4)];
if (!frame.error) {
// Unknown error types are to be considered equivalent to INTERNAL ERROR
frame.error = 'INTERNAL_ERROR';
}
};
// [WINDOW_UPDATE](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.9)
// [WINDOW_UPDATE](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.9)
// -----------------------------------------------------------------
//
// The WINDOW_UPDATE frame (type=0x8) is used to implement flow control.
@ -780,7 +758,7 @@ Deserializer.WINDOW_UPDATE = function readWindowUpdate(buffer, frame) {
frame.window_size = buffer.readUInt32BE(0) & 0x7fffffff;
};
// [CONTINUATION](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.10)
// [CONTINUATION](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.10)
// ------------------------------------------------------------
//
// The CONTINUATION frame (type=0x9) is used to continue a sequence of header block fragments.
@ -790,16 +768,10 @@ Deserializer.WINDOW_UPDATE = function readWindowUpdate(buffer, frame) {
// * END_HEADERS (0x4):
// The END_HEADERS bit indicates that this frame ends the sequence of header block fragments
// necessary to provide a complete set of headers.
// * PAD_LOW (0x08):
// Bit 5 being set indicates that the Pad Low field is present.
// * PAD_HIGH (0x10):
// Bit 6 being set indicates that the Pad High field is present. This bit MUST NOT be set unless
// the PAD_LOW flag is also set. Endpoints that receive a frame with PAD_HIGH set and PAD_LOW
// cleared MUST treat this as a connection error of type PROTOCOL_ERROR.
frameTypes[0x9] = 'CONTINUATION';
frameFlags.CONTINUATION = ['RESERVED1', 'RESERVED2', 'END_HEADERS', 'PAD_LOW', 'PAD_HIGH'];
frameFlags.CONTINUATION = ['RESERVED1', 'RESERVED2', 'END_HEADERS'];
typeSpecificAttributes.CONTINUATION = ['headers', 'data'];
@ -808,26 +780,10 @@ Serializer.CONTINUATION = function writeContinuation(frame, buffers) {
};
Deserializer.CONTINUATION = function readContinuation(buffer, frame) {
var dataOffset = 0;
var paddingLength = 0;
if (frame.flags.PAD_LOW) {
if (frame.flags.PAD_HIGH) {
paddingLength = (buffer.readUInt8(dataOffset) & 0xff) * 256;
dataOffset += 1;
}
paddingLength += (buffer.readUInt8(dataOffset) & 0xff);
dataOffset += 1;
} else if (frame.flags.PAD_HIGH) {
return 'CONTINUATION frame got PAD_HIGH without PAD_LOW';
}
if (paddingLength) {
frame.data = buffer.slice(dataOffset, -1 * paddingLength);
} else {
frame.data = buffer.slice(dataOffset);
}
frame.data = buffer;
};
// [ALTSVC](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.11)
// [ALTSVC](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.11)
// ------------------------------------------------------------
//
// The ALTSVC frame (type=0xA) advertises the availability of an alternative service to the client.
@ -916,7 +872,7 @@ Deserializer.ALTSVC = function readAltSvc(buffer, frame) {
frame.origin = buffer.toString('ascii', 9 + pidLength + hostLength);
};
// [BLOCKED](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-6.12)
// [BLOCKED](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-6.12)
// ------------------------------------------------------------
//
// The BLOCKED frame (type=0xB) indicates that the sender is unable to send data
@ -936,7 +892,7 @@ Serializer.BLOCKED = function writeBlocked(frame, buffers) {
Deserializer.BLOCKED = function readBlocked(buffer, frame) {
};
// [Error Codes](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-7)
// [Error Codes](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-7)
// ------------------------------------------------------------
var errorCodes = [

12
testing/xpcshell/node-http2/node_modules/http2-protocol/lib/index.js сгенерированный поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
// [node-http2-protocol][homepage] is an implementation of the [HTTP/2 (draft 12)][http2]
// [node-http2-protocol][homepage] is an implementation of the [HTTP/2 (draft 13)][http2]
// framing layer for [node.js][node].
//
// The main building blocks are [node.js streams][node-stream] that are connected through pipes.
@ -28,16 +28,16 @@
// between the binary and the JavaScript object representation of HTTP/2 frames
//
// [homepage]: https://github.com/molnarg/node-http2
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-12
// [http2-connheader]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-3.5
// [http2-stream]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-5
// [http2-streamstate]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-5.1
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13
// [http2-connheader]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-3.5
// [http2-stream]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-5
// [http2-streamstate]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-5.1
// [node]: http://nodejs.org/
// [node-stream]: http://nodejs.org/api/stream.html
// [node-https]: http://nodejs.org/api/https.html
// [node-http]: http://nodejs.org/api/http.html
exports.ImplementedVersion = 'h2-12';
exports.ImplementedVersion = 'h2-13';
exports.Endpoint = require('./endpoint').Endpoint;

22
testing/xpcshell/node-http2/node_modules/http2-protocol/lib/stream.js сгенерированный поставляемый
Просмотреть файл

@ -153,6 +153,26 @@ Stream.prototype.reset = function reset(error) {
}
};
// Specify an alternate service for the origin of this stream
Stream.prototype.altsvc = function altsvc(host, port, protocolID, maxAge, origin) {
var stream;
if (origin) {
stream = 0;
} else {
stream = this.id;
}
this._pushUpstream({
type: 'ALTSVC',
flags: {},
stream: stream,
host: host,
port: port,
protocolID: protocolID,
origin: origin,
maxAge: maxAge
});
};
// Data flow
// ---------
@ -326,7 +346,7 @@ Stream.prototype._finishing = function _finishing() {
}
};
// [Stream States](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-5.1)
// [Stream States](http://tools.ietf.org/html/draft-ietf-httpbis-http2-13#section-5.1)
// ----------------
//
// +--------+

4
testing/xpcshell/node-http2/node_modules/http2-protocol/package.json сгенерированный поставляемый
Просмотреть файл

@ -1,10 +1,10 @@
{
"name": "http2-protocol",
"version": "0.12.0",
"version": "0.13.0",
"description": "A JavaScript implementation of the HTTP/2 framing layer",
"main": "lib/index.js",
"engines" : {
"node" : "0.10.x"
"node" : ">=0.10.0"
},
"devDependencies": {
"istanbul": "*",

64
testing/xpcshell/node-http2/node_modules/http2-protocol/test/compressor.js сгенерированный поставляемый
Просмотреть файл

@ -29,34 +29,34 @@ var test_integers = [{
var test_strings = [{
string: 'www.foo.com',
buffer: new Buffer('89e7cf9bfc1ad7d4db7f', 'hex')
buffer: new Buffer('89f1e3c2f29ceb90f4ff', 'hex')
}, {
string: 'éáűőúöüó€',
buffer: new Buffer('13c3a9c3a1c5b1c591c3bac3b6c3bcc3b3e282ac', 'hex')
}];
test_huffman_request = {
'GET': 'd5df47',
'http': 'adcebf',
'/': '3f',
'www.foo.com': 'e7cf9bfc1ad7d4db7f',
'https': 'adcebf1f',
'www.bar.com': 'e7cf9bfbd383ea6dbf',
'no-cache': 'b9b9949556bf',
'/custom-path.css': '3ab8e2e6db9af4bab7d58e3f',
'custom-key': '571c5cdb737b2faf',
'custom-value': '571c5cdb73724d9c57'
'GET': 'c5837f',
'http': '9d29af',
'/': '63',
'www.foo.com': 'f1e3c2f29ceb90f4ff',
'https': '9d29ad1f',
'www.bar.com': 'f1e3c2f18ec5c87a7f',
'no-cache': 'a8eb10649cbf',
'/custom-path.css': '6096a127a56ac699d72211',
'custom-key': '25a849e95ba97d7f',
'custom-value': '25a849e95bb8e8b4bf'
};
test_huffman_response = {
'302': '4017',
'private': 'bf06724b97',
'Mon, 21 OCt 2013 20:13:21 GMT': 'd6dbb29884de3dce3100a0c4130a262136ad747f',
': https://www.bar.com': '98d5b9d7e331cfcf9f37f7a707d4db7f',
'200': '200f',
'Mon, 21 OCt 2013 20:13:22 GMT': 'd6dbb29884de3dce3100a0c4130a262236ad747f',
'https://www.bar.com': 'adcebf198e7e7cf9bfbd383ea6db',
'gzip': 'abdd97ff',
'302': '6402',
'private': 'aec3771a4b',
'Mon, 21 OCt 2013 20:13:21 GMT': 'd07abe941054d5792a0801654102e059b820a98b46ff',
': https://www.bar.com': 'b8a4e94d68b8c31e3c785e31d8b90f4f',
'200': '1001',
'Mon, 21 OCt 2013 20:13:22 GMT': 'd07abe941054d5792a0801654102e059b821298b46ff',
'https://www.bar.com': '9d29ad171863c78f0bc63b1721e9',
'gzip': '9bd9ab',
'foo=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAALASDJKHQKBZXOQWEOPIUAXQWEOIUAXLJKHQWOEIUAL\
QWEOIUAXLQEUAXLLKJASDQWEOUIAXN1234LASDJKHQKBZXOQWEOPIUAXQWEOIUAXLJKH\
@ -64,7 +64,7 @@ QWOEIUALQWEOIUAXLQEUAXLLKJASDQWEOUIAXN1234LASDJKHQKBZXOQWEOPIUAXQWEO\
IUAXLJKHQWOEIUALQWEOIUAXLQEUAXLLKJASDQWEOUIAXN1234LASDJKHQKBZXOQWEOP\
IUAXQWEOIUAXLJKHQWOEIUALQWEOIUAXLQEUAXLLKJASDQWEOUIAXN1234ZZZZZZZZZZ\
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ1234 m\
ax-age=3600; version=1': 'e0d6cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cff5cfb747cfe9f2fb7d3b7f7e9e3f6fcf7f8f97879e7f4fb7e7bfc7c3cf3fa7d7e7f4f97dbf3e3dfe1e79febf6fcf7f8f879e7f4fafdbbfcf3fa7d7ebf4f9e7dba3edf9eff1f3f0cfe9b049107d73edd1f3fa7cbedf4edfdfa78fdbf3dfe3e5e1e79fd3edf9eff1f0f3cfe9f5f9fd3e5f6fcf8f7f879e7fafdbf3dfe3e1e79fd3ebf6eff3cfe9f5fafd3e79f6e8fb7e7bfc7cfc33fa6c12441f5cfb747cfe9f2fb7d3b7f7e9e3f6fcf7f8f97879e7f4fb7e7bfc7c3cf3fa7d7e7f4f97dbf3e3dfe1e79febf6fcf7f8f879e7f4fafdbbfcf3fa7d7ebf4f9e7dba3edf9eff1f3f0cfe9b049107d73edd1f3fa7cbedf4edfdfa78fdbf3dfe3e5e1e79fd3edf9eff1f0f3cfe9f5f9fd3e5f6fcf8f7f879e7fafdbf3dfe3e1e79fd3ebf6eff3cfe9f5fafd3e79f6e8fb7e7bfc7cfc33fa6c12441fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff624880d6a7a664d4b9d1100761b92f0c58dba71',
ax-age=3600; version=1': '94e7821861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861873c3bafe5cd8f666bbfbf9ab672c1ab5e4e10fe6ce583564e10fe67cb9b1ece5ab064e10e7d9cb06ac9c21fccfb307087f33e7cd961dd7f672c1ab86487f34844cb59e1dd7f2e6c7b335dfdfcd5b3960d5af27087f3672c1ab27087f33e5cd8f672d583270873ece583564e10fe67d983843f99f3e6cb0eebfb3960d5c3243f9a42265acf0eebf97363d99aefefe6ad9cb06ad793843f9b3960d593843f99f2e6c7b396ac1938439f672c1ab27087f33ecc1c21fccf9f3658775fd9cb06ae1921fcd21132d678775fcb9b1eccd77f7f356ce58356bc9c21fcd9cb06ac9c21fccf97363d9cb560c9c21cfb3960d593843f99f660e10fe67cf9b2c3bafece583570c90fe6908996bf7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f42265a5291f9587316065c003ed4ee5b1063d5007f',
'foo=ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\
ZZZZZZZZZZZZZZZZZZZZZZZZZZLASDJKHQKBZXOQWEOPIUAXQWEOIUAXLJKHQWOEIUAL\
QWEOIUAXLQEUAXLLKJASDQWEOUIAXN1234LASDJKHQKBZXOQWEOPIUAXQWEOIUAXLJKH\
@ -72,7 +72,7 @@ QWOEIUALQWEOIUAXLQEUAXLLKJASDQWEOUIAXN1234LASDJKHQKBZXOQWEOPIUAXQWEO\
IUAXLJKHQWOEIUALQWEOIUAXLQEUAXLLKJASDQWEOUIAXN1234LASDJKHQKBZXOQWEOP\
IUAXQWEOIUAXLJKHQWOEIUALQWEOIUAXLQEUAXLLKJASDQWEOUIAXN1234AAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1234 m\
ax-age=3600; version=1': 'e0d6cffbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7fbfdfeff7f5cfb747cfe9f2fb7d3b7f7e9e3f6fcf7f8f97879e7f4fb7e7bfc7c3cf3fa7d7e7f4f97dbf3e3dfe1e79febf6fcf7f8f879e7f4fafdbbfcf3fa7d7ebf4f9e7dba3edf9eff1f3f0cfe9b049107d73edd1f3fa7cbedf4edfdfa78fdbf3dfe3e5e1e79fd3edf9eff1f0f3cfe9f5f9fd3e5f6fcf8f7f879e7fafdbf3dfe3e1e79fd3ebf6eff3cfe9f5fafd3e79f6e8fb7e7bfc7cfc33fa6c12441f5cfb747cfe9f2fb7d3b7f7e9e3f6fcf7f8f97879e7f4fb7e7bfc7c3cf3fa7d7e7f4f97dbf3e3dfe1e79febf6fcf7f8f879e7f4fafdbbfcf3fa7d7ebf4f9e7dba3edf9eff1f3f0cfe9b049107d73edd1f3fa7cbedf4edfdfa78fdbf3dfe3e5e1e79fd3edf9eff1f0f3cfe9f5f9fd3e5f6fcf8f7f879e7fafdbf3dfe3e1e79fd3ebf6eff3cfe9f5fafd3e79f6e8fb7e7bfc7cfc33fa6c124419f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7cf9f3e7ce24880d6a7a664d4b9d1100761b92f0c58dba71'
ax-age=3600; version=1': '94e783f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f73c3bafe5cd8f666bbfbf9ab672c1ab5e4e10fe6ce583564e10fe67cb9b1ece5ab064e10e7d9cb06ac9c21fccfb307087f33e7cd961dd7f672c1ab86487f34844cb59e1dd7f2e6c7b335dfdfcd5b3960d5af27087f3672c1ab27087f33e5cd8f672d583270873ece583564e10fe67d983843f99f3e6cb0eebfb3960d5c3243f9a42265acf0eebf97363d99aefefe6ad9cb06ad793843f9b3960d593843f99f2e6c7b396ac1938439f672c1ab27087f33ecc1c21fccf9f3658775fd9cb06ae1921fcd21132d678775fcb9b1eccd77f7f356ce58356bc9c21fcd9cb06ac9c21fccf97363d9cb560c9c21cfb3960d593843f99f660e10fe67cf9b2c3bafece583570c90fe6908996a1861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861861842265a5291f9587316065c003ed4ee5b1063d5007f'
};
var test_headers = [{
@ -98,7 +98,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('47' + '83ADCEBF', 'hex')
buffer: new Buffer('47' + '839d29af', 'hex')
}, {
// literal w/index, name index
header: {
@ -122,7 +122,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('44' + '89E7CF9BFC1AD7D4DB7F', 'hex')
buffer: new Buffer('44' + '89f1e3c2f29ceb90f4ff', 'hex')
}, {
// literal w/index, name index
header: {
@ -134,7 +134,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('43' + '84ADCEBF1F', 'hex')
buffer: new Buffer('43' + '849d29ad1f', 'hex')
}, {
// literal w/index, name index
header: {
@ -146,7 +146,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('42' + '89E7CF9BFBD383EA6DBF', 'hex')
buffer: new Buffer('42' + '89f1e3c2f18ec5c87a7f', 'hex')
}, {
// literal w/index, name index
header: {
@ -158,7 +158,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('5e' + '86B9B9949556BF', 'hex')
buffer: new Buffer('5e' + '86a8eb10649cbf', 'hex')
}, {
// indexed
header: {
@ -194,7 +194,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('45' + '8C3AB8E2E6DB9AF4BAB7D58E3F', 'hex')
buffer: new Buffer('45' + '8b6096a127a56ac699d72211', 'hex')
}, {
// literal w/index, new name & value
header: {
@ -206,7 +206,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('40' + '88571C5CDB737B2FAF' + '89571C5CDB73724D9C57', 'hex')
buffer: new Buffer('40' + '8825a849e95ba97d7f' + '8925a849e95bb8e8b4bf', 'hex')
}, {
// indexed
header: {
@ -242,7 +242,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('07' + '86E75A5CBE4BC3', 'hex')
buffer: new Buffer('07' + '86f138d25ee5b3', 'hex')
}, {
// Literal w/o index, new name & value
header: {
@ -254,7 +254,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('00' + '03666F6F' + '03626172', 'hex')
buffer: new Buffer('00' + '8294e7' + '03626172', 'hex')
}, {
// Literal never indexed, name index
header: {
@ -266,7 +266,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('17' + '86E75A5CBE4BC3', 'hex')
buffer: new Buffer('17' + '86f138d25ee5b3', 'hex')
}, {
// Literal never indexed, new name & value
header: {
@ -278,7 +278,7 @@ var test_headers = [{
clearReferenceSet: false,
newMaxSize: 0
},
buffer: new Buffer('10' + '03666F6F' + '03626172', 'hex')
buffer: new Buffer('10' + '8294e7' + '03626172', 'hex')
}, {
header: {
name: -1,

18
testing/xpcshell/node-http2/node_modules/http2-protocol/test/connection.js сгенерированный поставляемый
Просмотреть файл

@ -128,10 +128,10 @@ describe('connection.js', function() {
expect(headers).to.deep.equal(response_headers);
done();
});
client_stream.on('readable', function() {
expect(client_stream.read()).to.deep.equal(response_data);
client_stream.on('data', function(data) {
expect(data).to.deep.equal(response_data);
done();
});
})
});
});
describe('server push', function() {
@ -162,8 +162,8 @@ describe('connection.js', function() {
expect(headers).to.deep.equal(response_headers);
done();
});
request.on('readable', function() {
expect(request.read()).to.deep.equal(response_content);
request.on('data', function(data) {
expect(data).to.deep.equal(response_content);
done();
});
request.on('promise', function(pushed, headers) {
@ -172,13 +172,11 @@ describe('connection.js', function() {
expect(headers).to.deep.equal(response_headers);
done();
});
pushed.on('readable', function() {
expect(pushed.read()).to.deep.equal(push_content);
done();
});
pushed.on('end', function() {
pushed.on('data', function(data) {
expect(data).to.deep.equal(push_content);
done();
});
pushed.on('end', done);
});
});
});

67
testing/xpcshell/node-http2/node_modules/http2-protocol/test/flow.js сгенерированный поставляемый
Просмотреть файл

@ -3,6 +3,8 @@ var util = require('./util');
var Flow = require('../lib/flow').Flow;
var MAX_PAYLOAD_SIZE = 4096;
function createFlow(log) {
var flowControlId = util.random(10, 100);
var flow = new Flow(flowControlId);
@ -33,19 +35,18 @@ describe('flow.js', function() {
describe('._send() method', function() {
it('is called when the output buffer should be filled with more frames and the flow' +
'control queue is empty', function() {
var sendCalled = 0;
var notFlowControlledFrame = { type: 'PRIORITY', flags: {}, priority: 1 };
flow._send = function _send() {
sendCalled += 1;
this.push(notFlowControlledFrame);
};
expect(flow.read()).to.equal(notFlowControlledFrame);
flow._window = 0;
flow._queue.push({ type: 'DATA', flags: {}, data: { length: 1 } });
var frame = flow.read();
while (frame.type === notFlowControlledFrame.type) frame = flow.read();
expect(frame.type).to.equal('BLOCKED');
expect(flow.read()).to.equal(null);
expect(sendCalled).to.equal(1);
});
it('has to be overridden by the child class, otherwise it throws', function() {
expect(flow._send.bind(flow)).to.throw(Error);
@ -175,6 +176,7 @@ describe('flow.js', function() {
var output = [];
flow2._receive = function _receive(frame, callback) {
if (frame.type === 'DATA') {
expect(frame.data.length).to.be.lte(MAX_PAYLOAD_SIZE)
output.push(frame.data);
}
if (frame.flags.END_STREAM) {
@ -197,5 +199,62 @@ describe('flow.js', function() {
flow1.pipe(flow2).pipe(flow1);
});
});
describe('when running out of window', function() {
it('should send a BLOCKED frame', function(done) {
// Sender side
var frameNumber = util.random(5, 8);
var input = [];
flow1._send = function _send() {
if (input.length >= frameNumber) {
this.push({ type: 'DATA', flags: { END_STREAM: true }, data: new Buffer(0) });
this.push(null);
} else {
var buffer = new Buffer(util.random(1000, 100000));
input.push(buffer);
this.push({ type: 'DATA', flags: {}, data: buffer });
}
};
// Receiver side
// Do not send WINDOW_UPDATESs except when the other side sends BLOCKED
var output = [];
flow2._restoreWindow = util.noop;
flow2._receive = function _receive(frame, callback) {
if (frame.type === 'DATA') {
expect(frame.data.length).to.be.lte(MAX_PAYLOAD_SIZE)
output.push(frame.data);
}
if (frame.flags.END_STREAM) {
this.emit('end_stream');
}
if (frame.type === 'BLOCKED') {
setTimeout(function() {
this._push({
type: 'WINDOW_UPDATE',
flags: {},
stream: this._flowControlId,
window_size: this._received
});
this._received = 0;
}.bind(this), 20);
}
callback();
};
// Checking results
flow2.on('end_stream', function() {
input = util.concat(input);
output = util.concat(output);
expect(input).to.deep.equal(output);
done();
});
// Start piping
flow1.pipe(flow2).pipe(flow1);
})
});
});
});

56
testing/xpcshell/node-http2/node_modules/http2-protocol/test/framer.js сгенерированный поставляемый
Просмотреть файл

@ -22,7 +22,7 @@ var test_frames = [{
frame: {
type: 'DATA',
flags: { END_STREAM: false, END_SEGMENT: false, RESERVED4: false,
PAD_LOW: false, PAD_HIGH: false, COMPRESSED: false },
PADDED: false },
stream: 10,
data: new Buffer('12345678', 'hex')
@ -34,7 +34,7 @@ var test_frames = [{
frame: {
type: 'HEADERS',
flags: { END_STREAM: false, END_SEGMENT: false, END_HEADERS: false,
PAD_LOW: false, PAD_HIGH: false, PRIORITY: false },
PADDED: false, RESERVED5: false, PRIORITY: false },
stream: 15,
data: new Buffer('12345678', 'hex')
@ -45,7 +45,7 @@ var test_frames = [{
frame: {
type: 'HEADERS',
flags: { END_STREAM: false, END_SEGMENT: false, END_HEADERS: false,
PAD_LOW: false, PAD_HIGH: false, PRIORITY: true },
PADDED: false, RESERVED5: false, PRIORITY: true },
stream: 15,
priorityDependency: 10,
priorityWeight: 5,
@ -60,7 +60,7 @@ var test_frames = [{
frame: {
type: 'HEADERS',
flags: { END_STREAM: false, END_SEGMENT: false, END_HEADERS: false,
PAD_LOW: false, PAD_HIGH: false, PRIORITY: true },
PADDED: false, RESERVED5: false, PRIORITY: true },
stream: 15,
priorityDependency: 10,
priorityWeight: 5,
@ -114,21 +114,19 @@ var test_frames = [{
SETTINGS_HEADER_TABLE_SIZE: 0x12345678,
SETTINGS_ENABLE_PUSH: true,
SETTINGS_MAX_CONCURRENT_STREAMS: 0x01234567,
SETTINGS_INITIAL_WINDOW_SIZE: 0x89ABCDEF,
SETTINGS_COMPRESS_DATA: true
SETTINGS_INITIAL_WINDOW_SIZE: 0x89ABCDEF
}
},
buffer: new Buffer('0019' + '04' + '00' + '0000000A' + '01' + '12345678' +
'02' + '00000001' +
'03' + '01234567' +
'04' + '89ABCDEF' +
'05' + '00000001', 'hex')
buffer: new Buffer('0018' + '04' + '00' + '0000000A' + '0001' + '12345678' +
'0002' + '00000001' +
'0003' + '01234567' +
'0004' + '89ABCDEF', 'hex')
}, {
frame: {
type: 'PUSH_PROMISE',
flags: { RESERVED1: false, RESERVED2: false, END_PUSH_PROMISE: false,
PAD_LOW: false, PAD_HIGH: false },
PADDED: false },
stream: 15,
promised_stream: 3,
@ -169,8 +167,7 @@ var test_frames = [{
}, {
frame: {
type: 'CONTINUATION',
flags: { RESERVED1: false, RESERVED2: false, END_HEADERS: true,
PAD_LOW: false, PAD_HIGH: false },
flags: { RESERVED1: false, RESERVED2: false, END_HEADERS: true },
stream: 10,
data: new Buffer('12345678', 'hex')
@ -218,30 +215,30 @@ var padded_test_frames = [{
frame: {
type: 'DATA',
flags: { END_STREAM: false, END_SEGMENT: false, RESERVED4: false,
PAD_LOW: true, PAD_HIGH: false, COMPRESSED: false },
PADDED: true },
stream: 10,
data: new Buffer('12345678', 'hex')
},
// length + type + flags + stream + pad_low control + content + padding
// length + type + flags + stream + pad length + content + padding
buffer: new Buffer('000B' + '00' + '08' + '0000000A' + '06' + '12345678' + '000000000000', 'hex')
}, {
frame: {
type: 'HEADERS',
flags: { END_STREAM: false, END_SEGMENT: false, END_HEADERS: false,
PAD_LOW: true, PAD_HIGH: false, PRIORITY: false },
PADDED: true, RESERVED5: false, PRIORITY: false },
stream: 15,
data: new Buffer('12345678', 'hex')
},
// length + type + flags + stream + pad_low control + data + padding
// length + type + flags + stream + pad length + data + padding
buffer: new Buffer('000B' + '01' + '08' + '0000000F' + '06' + '12345678' + '000000000000', 'hex')
}, {
frame: {
type: 'HEADERS',
flags: { END_STREAM: false, END_SEGMENT: false, END_HEADERS: false,
PAD_LOW: true, PAD_HIGH: false, PRIORITY: true },
PADDED: true, RESERVED5: false, PRIORITY: true },
stream: 15,
priorityDependency: 10,
priorityWeight: 5,
@ -249,14 +246,14 @@ var padded_test_frames = [{
data: new Buffer('12345678', 'hex')
},
// length + type + flags + stream + pad_low control + priority dependency + priority weight + data + padding
// length + type + flags + stream + pad length + priority dependency + priority weight + data + padding
buffer: new Buffer('0010' + '01' + '28' + '0000000F' + '06' + '0000000A' + '05' + '12345678' + '000000000000', 'hex')
}, {
frame: {
type: 'HEADERS',
flags: { END_STREAM: false, END_SEGMENT: false, END_HEADERS: false,
PAD_LOW: true, PAD_HIGH: false, PRIORITY: true },
PADDED: true, RESERVED5: false, PRIORITY: true },
stream: 15,
priorityDependency: 10,
priorityWeight: 5,
@ -264,31 +261,20 @@ var padded_test_frames = [{
data: new Buffer('12345678', 'hex')
},
// length + type + flags + stream + pad_low control + priority dependency + priority weight + data + padding
// length + type + flags + stream + pad length + priority dependency + priority weight + data + padding
buffer: new Buffer('0010' + '01' + '28' + '0000000F' + '06' + '8000000A' + '05' + '12345678' + '000000000000', 'hex')
}, {
frame: {
type: 'CONTINUATION',
flags: { RESERVED1: false, RESERVED2: false, END_HEADERS: true,
PAD_LOW: true, PAD_HIGH: false },
stream: 10,
data: new Buffer('12345678', 'hex')
},
// length + type + flags + stream + pad_low control + data + padding
buffer: new Buffer('000B' + '09' + '0C' + '0000000A' + '06' + '12345678' + '000000000000', 'hex')
}, {
frame: {
type: 'PUSH_PROMISE',
flags: { RESERVED1: false, RESERVED2: false, END_PUSH_PROMISE: false,
PAD_LOW: true, PAD_HIGH: false },
PADDED: true },
stream: 15,
promised_stream: 3,
data: new Buffer('12345678', 'hex')
},
// length + type + flags + stream + pad_low control + promised stream + data + padding
// length + type + flags + stream + pad length + promised stream + data + padding
buffer: new Buffer('000F' + '05' + '08' + '0000000F' + '06' + '00000003' + '12345678' + '000000000000', 'hex')
}];

Просмотреть файл

@ -1,13 +1,13 @@
{
"name": "http2",
"version": "2.5.0",
"version": "2.6.0",
"description": "An HTTP/2 client and server implementation",
"main": "lib/index.js",
"engines" : {
"node" : ">=0.10.19"
},
"dependencies": {
"http2-protocol": "0.12.x"
"http2-protocol": ">=0.13.0"
},
"devDependencies": {
"istanbul": "*",

Просмотреть файл

@ -124,8 +124,8 @@ describe('http.js', function() {
server.listen(1234, function() {
http2.get('https://localhost:1234' + path, function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
server.close();
done();
});
@ -140,8 +140,8 @@ describe('http.js', function() {
var server = http2.createServer(options, function(request, response) {
expect(request.url).to.equal(path);
request.once('readable', function() {
expect(request.read().toString()).to.equal(message);
request.once('data', function(data) {
expect(data.toString()).to.equal(message);
response.end();
});
});
@ -209,8 +209,8 @@ describe('http.js', function() {
expect(response.headers[headerName]).to.equal(headerValue);
expect(response.headers['nonexistent']).to.equal(undefined);
expect(response.headers['date']).to.equal(undefined);
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
server.close();
done();
});
@ -238,8 +238,8 @@ describe('http.js', function() {
port: 1237,
path: path
}, function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
server.close();
done();
});
@ -260,8 +260,8 @@ describe('http.js', function() {
server.listen(5678, function() {
http2.get('https://localhost:5678' + path, function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
done();
});
});
@ -280,8 +280,8 @@ describe('http.js', function() {
server.listen(1236, function() {
https.get('https://localhost:1236' + path, function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
done();
});
});
@ -302,15 +302,15 @@ describe('http.js', function() {
done = util.callNTimes(2, done);
// 1. request
http2.get('https://localhost:1237' + path, function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
done();
});
});
// 2. request
http2.get('https://localhost:1237' + path, function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
done();
});
});
@ -330,13 +330,13 @@ describe('http.js', function() {
server.listen(1238, function() {
// 1. request
http2.get('https://localhost:1238' + path, function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
// 2. request
http2.get('https://localhost:1238' + path, function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
done();
});
});
@ -398,8 +398,8 @@ describe('http.js', function() {
done = util.callNTimes(5, done);
request.on('response', function(response) {
response.on('readable', function() {
expect(response.read().toString()).to.equal(message);
response.on('data', function(data) {
expect(data.toString()).to.equal(message);
done();
});
response.on('end', done);
@ -408,8 +408,8 @@ describe('http.js', function() {
request.on('push', function(promise) {
expect(promise.url).to.be.equal(pushedPath);
promise.on('response', function(pushStream) {
pushStream.on('readable', function() {
expect(pushStream.read().toString()).to.equal(pushedMessage);
pushStream.on('data', function(data) {
expect(data.toString()).to.equal(pushedMessage);
done();
});
pushStream.on('end', done);