{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/2526","labels_url":"https://api.github.com/repos/nodejs/node/issues/2526/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/2526/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/2526/events","html_url":"https://github.com/nodejs/node/pull/2526","id":102870664,"number":2526,"title":"http: add strictMode option and checkIsHttpToken check","user":{"login":"jasnell","id":439929,"avatar_url":"https://avatars.githubusercontent.com/u/439929?v=3","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/http","name":"http","color":"c7def8"},{"url":"https://api.github.com/repos/nodejs/node/labels/semver-minor","name":"semver-minor","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-08-24T19:17:19Z","updated_at":"2015-09-01T16:15:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/2526","html_url":"https://github.com/nodejs/node/pull/2526","diff_url":"https://github.com/nodejs/node/pull/2526.diff","patch_url":"https://github.com/nodejs/node/pull/2526.patch"},"body":"Per: https://github.com/nodejs/node-convergence-archive/issues/13\r\n\r\nThis adds a new `strictMode` flag to OutgoingMessage that, when\r\nenabled, will cause a TypeError to be thrown if the HTTP Method\r\nor header field name does not conform to the Token rule.\r\n\r\nThe `strictMode` flag ensures that, in the common case, there\r\nis minimal performance hit and that existing code should continue\r\nto work. The Token check is only performed when `strictMode = true`.\r\n\r\nDoc and test case are included.\r\n\r\nOn the client-side\r\n```javascript\r\nvar http = require('http');\r\nvar url = require('url');\r\nvar p = url.parse('http://localhost:8888');\r\np.headers = {'testing 123': 123};\r\np.strictMode = true;\r\nhttp.client(p, function(res) { }); // throws\r\n```\r\n\r\nOn the server-side\r\n```javascript\r\nvar http = require('http');\r\nvar server = http.createServer(function(req,res) {\r\n  res.strictMode = true;\r\n  res.setHeader('testing 123', 123); // throws\r\n  res.end('...');\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/136778120","html_url":"https://github.com/nodejs/node/pull/2526#issuecomment-136778120","issue_url":"https://api.github.com/repos/nodejs/node/issues/2526","id":136778120,"user":{"login":"trevnorris","id":289174,"avatar_url":"https://avatars.githubusercontent.com/u/289174?v=3","gravatar_id":"","url":"https://api.github.com/users/trevnorris","html_url":"https://github.com/trevnorris","followers_url":"https://api.github.com/users/trevnorris/followers","following_url":"https://api.github.com/users/trevnorris/following{/other_user}","gists_url":"https://api.github.com/users/trevnorris/gists{/gist_id}","starred_url":"https://api.github.com/users/trevnorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trevnorris/subscriptions","organizations_url":"https://api.github.com/users/trevnorris/orgs","repos_url":"https://api.github.com/users/trevnorris/repos","events_url":"https://api.github.com/users/trevnorris/events{/privacy}","received_events_url":"https://api.github.com/users/trevnorris/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T16:15:48Z","updated_at":"2015-09-01T16:15:48Z","body":"I'm not sure this needs to be behind a flag. It's already an opt-in with `response.strictMode = true;` Otherwise the `false` conditional checks will add negligible performance overhead."}}