GWicke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/252384

Change subject: Update restbase to 0b094b4
......................................................................

Update restbase to 0b094b4

List of changes:
0b094b4 Switch to our own copy of content-type
xxxxxxx Update node module dependencies

Change-Id: Ife88a97cb7d0ee13497dca19105a65da52499075
---
A node_modules/content-type/.travis.yml
M node_modules/content-type/index.js
M node_modules/content-type/package.json
A node_modules/content-type/test/contentType_format.js
A node_modules/content-type/test/contentType_parse.js
M 
node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/routeswitch/node_modules/async/package.json
M restbase
7 files changed, 248 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/restbase/deploy 
refs/changes/84/252384/1

diff --git a/node_modules/content-type/.travis.yml 
b/node_modules/content-type/.travis.yml
new file mode 100644
index 0000000..dced2bc
--- /dev/null
+++ b/node_modules/content-type/.travis.yml
@@ -0,0 +1,12 @@
+language: node_js
+node_js:
+  - "0.6"
+  - "0.8"
+  - "0.10"
+  - "0.12"
+sudo: false
+script:
+  - "test $TRAVIS_NODE_VERSION != '0.6' || npm test"
+  - "test $TRAVIS_NODE_VERSION  = '0.6' || npm run-script test-ci"
+after_script:
+  - "test $TRAVIS_NODE_VERSION != '0.6' && npm install coveralls@2 && cat 
./coverage/lcov.info | coveralls"
diff --git a/node_modules/content-type/index.js 
b/node_modules/content-type/index.js
index 6a2ea9f..312823b 100644
--- a/node_modules/content-type/index.js
+++ b/node_modules/content-type/index.js
@@ -17,8 +17,10 @@
  * qdtext        = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
  * obs-text      = %x80-FF
  * quoted-pair   = "\" ( HTAB / SP / VCHAR / obs-text )
+ *
+ * Additionally, we accept "/" in parameter values.
  */
-var paramRegExp = /; *([!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+) *= 
*("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+)
 */g
+var paramRegExp = /; *([!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+) *= 
*("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'\*\+\-\.\^_`\|~\/0-9A-Za-z]+)
 */g
 var textRegExp = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/
 var tokenRegExp = /^[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+$/
 
diff --git a/node_modules/content-type/package.json 
b/node_modules/content-type/package.json
index 995a411..b38f994 100644
--- a/node_modules/content-type/package.json
+++ b/node_modules/content-type/package.json
@@ -16,7 +16,7 @@
   ],
   "repository": {
     "type": "git",
-    "url": "https://github.com/jshttp/content-type";
+    "url": "git://github.com/jshttp/content-type"
   },
   "devDependencies": {
     "istanbul": "0.3.5",
@@ -36,29 +36,13 @@
     "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly 
-- --reporter spec --check-leaks test/",
     "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter 
dot --check-leaks test/"
   },
-  "gitHead": "3aa58f9c5a358a3634b8601602177888b4a477d8",
+  "readme": "# content-type\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM 
Downloads][downloads-image]][downloads-url]\n[![Node.js 
Version][node-version-image]][node-version-url]\n[![Build 
Status][travis-image]][travis-url]\n[![Test 
Coverage][coveralls-image]][coveralls-url]\n\nCreate and parse HTTP 
Content-Type header according to RFC 7231\n\n## Installation\n\n```sh\n$ npm 
install content-type\n```\n\n## API\n\n```js\nvar contentType = 
require('content-type')\n```\n\n### contentType.parse(string)\n\n```js\nvar obj 
= contentType.parse('image/svg+xml; charset=utf-8')\n```\n\nParse a content 
type string. This will return an object with the following\nproperties 
(examples are shown for the string `'image/svg+xml; charset=utf-8'`):\n\n - 
`type`: The media type (the type and subtype, always lower case).\n   Example: 
`'image/svg+xml'`\n\n - `parameters`: An object of the parameters in the media 
type (name of parameter\n   always lower case). Example: `{charset: 
'utf-8'}`\n\nThrows a `TypeError` if the string is missing or invalid.\n\n### 
contentType.parse(req)\n\n```js\nvar obj = contentType.parse(req)\n```\n\nParse 
the `content-type` header from the given `req`. Short-cut 
for\n`contentType.parse(req.headers['content-type'])`.\n\nThrows a `TypeError` 
if the `Content-Type` header is missing or invalid.\n\n### 
contentType.parse(res)\n\n```js\nvar obj = contentType.parse(res)\n```\n\nParse 
the `content-type` header set on the given `res`. Short-cut 
for\n`contentType.parse(res.getHeader('content-type'))`.\n\nThrows a 
`TypeError` if the `Content-Type` header is missing or invalid.\n\n### 
contentType.format(obj)\n\n```js\nvar str = contentType.format({type: 
'image/svg+xml'})\n```\n\nFormat an object into a content type string. This 
will return a string of the\ncontent type for the given object with the 
following properties (examples are\nshown that produce the string 
`'image/svg+xml; charset=utf-8'`):\n\n - `type`: The media type (will be 
lower-cased). Example: `'image/svg+xml'`\n\n - `parameters`: An object of the 
parameters in the media type (name of the\n   parameter will be lower-cased). 
Example: `{charset: 'utf-8'}`\n\nThrows a `TypeError` if the object contains an 
invalid type or parameter names.\n\n## 
License\n\n[MIT](LICENSE)\n\n[npm-image]: 
https://img.shields.io/npm/v/content-type.svg\n[npm-url]: 
https://npmjs.org/package/content-type\n[node-version-image]: 
https://img.shields.io/node/v/content-type.svg\n[node-version-url]: 
http://nodejs.org/download/\n[travis-image]: 
https://img.shields.io/travis/jshttp/content-type/master.svg\n[travis-url]: 
https://travis-ci.org/jshttp/content-type\n[coveralls-image]: 
https://img.shields.io/coveralls/jshttp/content-type/master.svg\n[coveralls-url]:
 https://coveralls.io/r/jshttp/content-type\n[downloads-image]: 
https://img.shields.io/npm/dm/content-type.svg\n[downloads-url]: 
https://npmjs.org/package/content-type\n";,
+  "readmeFilename": "README.md",
   "bugs": {
     "url": "https://github.com/jshttp/content-type/issues";
   },
-  "homepage": "https://github.com/jshttp/content-type";,
   "_id": "content-type@1.0.1",
-  "_shasum": "a19d2247327dc038050ce622b7a154ec59c5e600",
-  "_from": "content-type@^1.0.1",
-  "_npmVersion": "1.4.28",
-  "_npmUser": {
-    "name": "dougwilson",
-    "email": "d...@somethingdoug.com"
-  },
-  "maintainers": [
-    {
-      "name": "dougwilson",
-      "email": "d...@somethingdoug.com"
-    }
-  ],
-  "dist": {
-    "shasum": "a19d2247327dc038050ce622b7a154ec59c5e600",
-    "tarball": 
"http://registry.npmjs.org/content-type/-/content-type-1.0.1.tgz";
-  },
-  "directories": {},
-  "_resolved": 
"https://registry.npmjs.org/content-type/-/content-type-1.0.1.tgz";
+  "_shasum": "dd7f34157fe30aa54fb4c3e02f3d224862002d7d",
+  "_resolved": 
"git+https://github.com/wikimedia/content-type#47b2632d0a2ee79a7d67268e2f6621becd95d05b";,
+  "_from": "content-type@git+https://github.com/wikimedia/content-type#master";
 }
diff --git a/node_modules/content-type/test/contentType_format.js 
b/node_modules/content-type/test/contentType_format.js
new file mode 100644
index 0000000..6273e29
--- /dev/null
+++ b/node_modules/content-type/test/contentType_format.js
@@ -0,0 +1,80 @@
+
+var assert = require('assert')
+var contentType = require('..')
+
+describe('contentType.format(obj)', function () {
+  it('should format basic type', function () {
+    var str = contentType.format({type: 'text/html'})
+    assert.equal(str, 'text/html')
+  })
+
+  it('should format type with suffix', function () {
+    var str = contentType.format({type: 'image/svg+xml'})
+    assert.equal(str, 'image/svg+xml')
+  })
+
+  it('should format type with parameter', function () {
+    var str = contentType.format({
+      type: 'text/html',
+      parameters: {charset: 'utf-8'}
+    })
+    assert.equal(str, 'text/html; charset=utf-8')
+  })
+
+  it('should format type with parameter that needs quotes', function () {
+    var str = contentType.format({
+      type: 'text/html',
+      parameters: {foo: 'bar or "baz"'}
+    })
+    assert.equal(str, 'text/html; foo="bar or \\"baz\\""')
+  })
+
+  it('should format type with parameter with empty value', function () {
+    var str = contentType.format({
+      type: 'text/html',
+      parameters: {foo: ''}
+    })
+    assert.equal(str, 'text/html; foo=""')
+  })
+
+  it('should format type with multiple parameters', function () {
+    var str = contentType.format({
+      type: 'text/html',
+      parameters: {charset: 'utf-8', foo: 'bar', bar: 'baz'}
+    })
+    assert.equal(str, 'text/html; bar=baz; charset=utf-8; foo=bar')
+  })
+
+  it('should require argument', function () {
+    assert.throws(contentType.format.bind(null), /argument obj is required/)
+  })
+
+  it('should reject non-objects', function () {
+    assert.throws(contentType.format.bind(null, 7), /argument obj is required/)
+  })
+
+  it('should require type', function () {
+    var obj = {}
+    assert.throws(contentType.format.bind(null, obj), /invalid type/)
+  })
+
+  it('should reject invalid type', function () {
+    var obj = {type: 'text/'}
+    assert.throws(contentType.format.bind(null, obj), /invalid type/)
+  })
+
+  it('should reject invalid type with LWS', function () {
+    var obj = {type: ' text/html'}
+    assert.throws(contentType.format.bind(null, obj), /invalid type/)
+  })
+
+  it('should reject invalid parameter name', function () {
+    var obj = {type: 'image/svg', parameters: {'foo/': 'bar'}}
+    assert.throws(contentType.format.bind(null, obj), /invalid parameter name/)
+  })
+
+  it('should reject invalid parameter value', function () {
+    var obj = {type: 'image/svg', parameters: {'foo': 'bar\u0000'}}
+    assert.throws(contentType.format.bind(null, obj), /invalid parameter 
value/)
+  })
+})
diff --git a/node_modules/content-type/test/contentType_parse.js 
b/node_modules/content-type/test/contentType_parse.js
new file mode 100644
index 0000000..1fef003
--- /dev/null
+++ b/node_modules/content-type/test/contentType_parse.js
@@ -0,0 +1,144 @@
+
+var assert = require('assert')
+var contentType = require('..')
+
+var invalidTypes = [
+  ' ',
+  'null',
+  'undefined',
+  '/',
+  'text / plain',
+  'text/;plain',
+  'text/"plain"',
+  'text/pĀ£ain',
+  'text/(plain)',
+  'text/@plain',
+  'text/plain,wrong',
+]
+
+describe('contentType.parse(string)', function () {
+  it('should parse basic type', function () {
+    var type = contentType.parse('text/html')
+    assert.equal(type.type, 'text/html')
+  })
+
+  it('should parse with suffix', function () {
+    var type = contentType.parse('image/svg+xml')
+    assert.equal(type.type, 'image/svg+xml')
+  })
+
+  it('should parse basic type with surrounding OWS', function () {
+    var type = contentType.parse(' text/html ')
+    assert.equal(type.type, 'text/html')
+  })
+
+  it('should parse parameters', function () {
+    var type = contentType.parse('text/html; charset=utf-8; foo=bar')
+    assert.equal(type.type, 'text/html')
+    assert.deepEqual(type.parameters, {
+      charset: 'utf-8',
+      foo: 'bar'
+    })
+  })
+
+  it('should parse parameters with extra LWS', function () {
+    var type = contentType.parse('text/html ; charset=utf-8 ; foo=bar')
+    assert.equal(type.type, 'text/html')
+    assert.deepEqual(type.parameters, {
+      charset: 'utf-8',
+      foo: 'bar'
+    })
+  })
+
+  it('should lower-case type', function () {
+    var type = contentType.parse('IMAGE/SVG+XML')
+    assert.equal(type.type, 'image/svg+xml')
+  })
+
+  it('should lower-case parameter names', function () {
+    var type = contentType.parse('text/html; Charset=UTF-8')
+    assert.equal(type.type, 'text/html')
+    assert.deepEqual(type.parameters, {
+      charset: 'UTF-8'
+    })
+  })
+
+  it('should unquote parameter values', function () {
+    var type = contentType.parse('text/html; charset="UTF-8"')
+    assert.equal(type.type, 'text/html')
+    assert.deepEqual(type.parameters, {
+      charset: 'UTF-8'
+    })
+  })
+
+  it('should unquote parameter values with escapes', function () {
+    var type = contentType.parse('text/html; charset = "UT\\F-\\\\\\"8\\""')
+    assert.equal(type.type, 'text/html')
+    assert.deepEqual(type.parameters, {
+      charset: 'UTF-\\"8"'
+    })
+  })
+
+  it('should handle balanced quotes', function () {
+    var type = contentType.parse('text/html; param="charset=\\"utf-8\\"; 
foo=bar"; bar=foo')
+    assert.equal(type.type, 'text/html')
+    assert.deepEqual(type.parameters, {
+      param: 'charset="utf-8"; foo=bar',
+      bar: 'foo'
+    })
+  })
+
+  invalidTypes.forEach(function (type) {
+    it('should throw on invalid media type ' + type, function () {
+      assert.throws(contentType.parse.bind(null, type), /invalid media type/)
+    })
+  })
+
+  it('should throw on invalid parameter format', function () {
+    assert.throws(contentType.parse.bind(null, 'text/plain; foo="bar'), 
/invalid parameter format/)
+    assert.throws(contentType.parse.bind(null, 'text/plain; 
profile=http://localhost; foo=bar'), /invalid parameter format/)
+    assert.throws(contentType.parse.bind(null, 'text/plain; 
profile=http://localhost'), /invalid parameter format/)
+  })
+
+  it('should require argument', function () {
+    assert.throws(contentType.parse.bind(null), /string.*required/)
+  })
+
+  it('should reject non-strings', function () {
+    assert.throws(contentType.parse.bind(null, 7), /string.*required/)
+  })
+})
+
+describe('contentType.parse(req)', function () {
+  it('should parse content-type header', function () {
+    var req = {headers: {'content-type': 'text/html'}}
+    var type = contentType.parse(req)
+    assert.equal(type.type, 'text/html')
+  })
+
+  it('should reject objects without headers property', function () {
+    assert.throws(contentType.parse.bind(null, {}), /content-type header is 
missing/)
+  })
+
+  it('should reject missing content-type', function () {
+    var req = {headers: {}}
+    assert.throws(contentType.parse.bind(null, req), /content-type header is 
missing/)
+  })
+})
+
+describe('contentType.parse(res)', function () {
+  it('should parse content-type header', function () {
+    var res = {getHeader: function(){ return 'text/html'}}
+    var type = contentType.parse(res)
+    assert.equal(type.type, 'text/html')
+  })
+
+  it('should reject objects without getHeader method', function () {
+    assert.throws(contentType.parse.bind(null, {}), /content-type header is 
missing/)
+  })
+
+  it('should reject missing content-type', function () {
+    var res = {getHeader: function(){}}
+    assert.throws(contentType.parse.bind(null, res), /content-type header is 
missing/)
+  })
+})
diff --git 
a/node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/routeswitch/node_modules/async/package.json
 
b/node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/routeswitch/node_modules/async/package.json
index 34c2887..37f1cb0 100644
--- 
a/node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/routeswitch/node_modules/async/package.json
+++ 
b/node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/routeswitch/node_modules/async/package.json
@@ -57,7 +57,7 @@
   "homepage": "https://github.com/caolan/async#readme";,
   "_id": "async@0.9.2",
   "_shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d",
-  "_from": "async@^0.9.0",
+  "_from": "async@~0.9.0",
   "_npmVersion": "2.9.0",
   "_nodeVersion": "2.0.1",
   "_npmUser": {
@@ -79,5 +79,6 @@
     "tarball": "http://registry.npmjs.org/async/-/async-0.9.2.tgz";
   },
   "directories": {},
-  "_resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz";
+  "_resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git a/restbase b/restbase
index af62ef2..0b094b4 160000
--- a/restbase
+++ b/restbase
-Subproject commit af62ef2a4bc6febbdec3d6b7f680d898fb02de3c
+Subproject commit 0b094b445907e20c53885b87fffea9a0b201a59c

-- 
To view, visit https://gerrit.wikimedia.org/r/252384
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife88a97cb7d0ee13497dca19105a65da52499075
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/restbase/deploy
Gerrit-Branch: master
Gerrit-Owner: GWicke <gwi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to