http2
Advanced tools
Comparing version 2.3.0 to 2.4.0
Version history | ||
=============== | ||
### 2.4.0 (2014-04-16) ### | ||
* Upgrade to the latest draft: [draft-ietf-httpbis-http2-11] | ||
[draft-ietf-httpbis-http2-11]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-11 | ||
### 2.3.0 (2014-03-12) ### | ||
@@ -5,0 +11,0 @@ |
@@ -124,3 +124,3 @@ // Public API | ||
// [2]: http://nodejs.org/api/http.html | ||
// [3]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-10#section-8.1.3.2 | ||
// [3]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-11#section-8.1.3.2 | ||
// [expect-continue]: https://github.com/http2/http2-spec/issues/18 | ||
@@ -208,3 +208,3 @@ // [connect]: https://github.com/http2/http2-spec/issues/230 | ||
// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-10#section-8.1.3.1) | ||
// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-11#section-8.1.3.1) | ||
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series | ||
@@ -214,14 +214,4 @@ // of key-value pairs. This includes the target URI for the request, the status code for the | ||
IncomingMessage.prototype._onHeaders = function _onHeaders(headers) { | ||
// * An HTTP/2.0 request or response MUST NOT include any of the following header fields: | ||
// Connection, Host, Keep-Alive, Proxy-Connection, TE, Transfer-Encoding, and Upgrade. A server | ||
// MUST treat the presence of any of these header fields as a stream error of type | ||
// PROTOCOL_ERROR. | ||
for (var i = 0; i < deprecatedHeaders.length; i++) { | ||
var key = deprecatedHeaders[i]; | ||
if (key in headers) { | ||
this._log.error({ key: key, value: headers[key] }, 'Deprecated header found'); | ||
this.stream.emit('error', 'PROTOCOL_ERROR'); | ||
return; | ||
} | ||
} | ||
// * Detects malformed headers | ||
this._validateHeaders(headers); | ||
@@ -251,9 +241,38 @@ // * Store the _regular_ headers in `this.headers` | ||
this._log.error({ key: key, value: value }, 'Invalid or missing special header field'); | ||
this.stream.emit('error', 'PROTOCOL_ERROR'); | ||
this.stream.reset('PROTOCOL_ERROR'); | ||
} | ||
return value; | ||
} | ||
; | ||
}; | ||
IncomingMessage.prototype._validateHeaders = function _validateHeaders(headers) { | ||
// * An HTTP/2.0 request or response MUST NOT include any of the following header fields: | ||
// Connection, Host, Keep-Alive, Proxy-Connection, TE, Transfer-Encoding, and Upgrade. A server | ||
// MUST treat the presence of any of these header fields as a stream error of type | ||
// PROTOCOL_ERROR. | ||
for (var i = 0; i < deprecatedHeaders.length; i++) { | ||
var key = deprecatedHeaders[i]; | ||
if (key in headers) { | ||
this._log.error({ key: key, value: headers[key] }, 'Deprecated header found'); | ||
this.stream.reset('PROTOCOL_ERROR'); | ||
return; | ||
} | ||
} | ||
for (var headerName in headers) { | ||
// * Empty header name field is malformed | ||
if (headerName.length <= 1) { | ||
this.stream.reset('PROTOCOL_ERROR'); | ||
return; | ||
} | ||
// * A request or response containing uppercase header name field names MUST be | ||
// treated as malformed (Section 8.1.3.5). Implementations that detect malformed | ||
// requests or responses need to ensure that the stream ends. | ||
if(/[A-Z]/.test(headerName)) { | ||
this.stream.reset('PROTOCOL_ERROR'); | ||
return; | ||
} | ||
} | ||
}; | ||
// OutgoingMessage class | ||
@@ -504,3 +523,3 @@ // --------------------- | ||
// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-10#section-8.1.3.1) | ||
// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-11#section-8.1.3.1) | ||
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series | ||
@@ -936,3 +955,3 @@ // of key-value pairs. This includes the target URI for the request, the status code for the | ||
// [Response Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-10#section-8.1.3.2) | ||
// [Response Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-11#section-8.1.3.2) | ||
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series | ||
@@ -939,0 +958,0 @@ // of key-value pairs. This includes the target URI for the request, the status code for the |
@@ -1,2 +0,2 @@ | ||
// [node-http2][homepage] is an [HTTP/2 (draft 10)][http2] implementation for [node.js][node]. | ||
// [node-http2][homepage] is an [HTTP/2 (draft 11)][http2] implementation for [node.js][node]. | ||
// | ||
@@ -14,3 +14,3 @@ // The core of the protocol is implemented by the [http2-protocol] module. This module provides | ||
// [http2-protocol]: https://github.com/molnarg/node-http2-protocol | ||
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-10 | ||
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-11 | ||
// [node]: http://nodejs.org/ | ||
@@ -17,0 +17,0 @@ // [node-https]: http://nodejs.org/api/https.html |
{ | ||
"name": "http2", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "An HTTP/2 client and server implementation", | ||
@@ -10,3 +10,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"http2-protocol": "0.10.x" | ||
"http2-protocol": "0.11.x" | ||
}, | ||
@@ -13,0 +13,0 @@ "devDependencies": { |
node-http2 | ||
========== | ||
An HTTP/2 ([draft-ietf-httpbis-http2-10](http://tools.ietf.org/html/draft-ietf-httpbis-http2-10)) | ||
An HTTP/2 ([draft-ietf-httpbis-http2-11](http://tools.ietf.org/html/draft-ietf-httpbis-http2-11)) | ||
client and server implementation for node.js. | ||
@@ -117,8 +117,8 @@ | ||
To generate a code coverage report, run `npm test --coverage` (which runs very slowly, be patient). | ||
Code coverage summary as of version 2.3.0: | ||
Code coverage summary as of version 2.4.0: | ||
``` | ||
Statements : 94% ( 392/417 ) | ||
Branches : 80.63% ( 129/160 ) | ||
Functions : 93.65% ( 59/63 ) | ||
Lines : 94% ( 392/417 ) | ||
Statements : 93.19% ( 397/426 ) | ||
Branches : 79.88% ( 131/164 ) | ||
Functions : 93.75% ( 60/64 ) | ||
Lines : 93.19% ( 397/426 ) | ||
``` | ||
@@ -125,0 +125,0 @@ |
74194
1430
+ Addedhttp2-protocol@0.11.0(transitive)
- Removedhttp2-protocol@0.10.0(transitive)
Updatedhttp2-protocol@0.11.x