Cscott has uploaded a new change for review. https://gerrit.wikimedia.org/r/233188
Change subject: Quote the profile in our content type strings ...................................................................... Quote the profile in our content type strings According to RFC 7231 section 3.1.1, parameter values are either tokens or quoted strings. The forward-slash character ("/") is not allowed in a token (defined in RFC 7230, section 3.2.6). We need to make the parameter value a quoted string. This parsing restriction is actually enforced by the npm `content-type` module (version 1.0.1) which is used by Express 4.x to manipulate content type headers. The unmodified content-type causes this exception: TypeError: invalid parameter format at Object.parse (/home/cananian/Projects/Wikimedia/Parsoid/node_modules/express/node_modules/content-type/index.js:140:13) at setCharset (/home/cananian/Projects/Wikimedia/Parsoid/node_modules/express/lib/utils.js:275:28) at ServerResponse.send (/home/cananian/Projects/Wikimedia/Parsoid/node_modules/express/lib/response.js:154:32) when we try to use `res.send` (for example, in `apiUtils.sendResponse`) after setting the content type to `WIKITEXT_CONTENT_TYPE` or `HTML_CONTENT_TYPE`. Change-Id: I4a22830248b712f340c60a9f417395a6ac90fb76 --- M api/utils.js 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/88/233188/1 diff --git a/api/utils.js b/api/utils.js index 125c90b..ef08e27 100644 --- a/api/utils.js +++ b/api/utils.js @@ -20,9 +20,9 @@ */ var apiUtils = module.exports = { /** @property {string} */ - WIKITEXT_CONTENT_TYPE: 'text/plain;profile=mediawiki.org/specs/wikitext/1.0.0;charset=utf-8', + WIKITEXT_CONTENT_TYPE: 'text/plain;profile="mediawiki.org/specs/wikitext/1.0.0";charset=utf-8', /** @property {string} */ - HTML_CONTENT_TYPE: 'text/html;profile=mediawiki.org/specs/html/1.1.0;charset=utf-8', + HTML_CONTENT_TYPE: 'text/html;profile="mediawiki.org/specs/html/1.1.0";charset=utf-8', }; /** -- To view, visit https://gerrit.wikimedia.org/r/233188 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4a22830248b712f340c60a9f417395a6ac90fb76 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Cscott <canan...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits