{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/help/issues/993","repository_url":"https://api.github.com/repos/nodejs/help","labels_url":"https://api.github.com/repos/nodejs/help/issues/993/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/help/issues/993/comments","events_url":"https://api.github.com/repos/nodejs/help/issues/993/events","html_url":"https://github.com/nodejs/help/issues/993","id":276924483,"number":993,"title":"Error: socket hang up if CRLF line is missed","user":{"login":"LavrovArtem","id":5373460,"avatar_url":"https://avatars2.githubusercontent.com/u/5373460?v=4","gravatar_id":"","url":"https://api.github.com/users/LavrovArtem","html_url":"https://github.com/LavrovArtem","followers_url":"https://api.github.com/users/LavrovArtem/followers","following_url":"https://api.github.com/users/LavrovArtem/following{/other_user}","gists_url":"https://api.github.com/users/LavrovArtem/gists{/gist_id}","starred_url":"https://api.github.com/users/LavrovArtem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LavrovArtem/subscriptions","organizations_url":"https://api.github.com/users/LavrovArtem/orgs","repos_url":"https://api.github.com/users/LavrovArtem/repos","events_url":"https://api.github.com/users/LavrovArtem/events{/privacy}","received_events_url":"https://api.github.com/users/LavrovArtem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-11-27T07:31:25Z","updated_at":"2018-03-10T10:43:29Z","closed_at":null,"author_association":"NONE","body":"https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html\r\n```\r\nResponse      = Status-Line\r\n                *(( general-header\r\n                 | response-header\r\n                 | entity-header ) CRLF)\r\n                CRLF                      // <— this required line is missed\r\n                [ message-body ]\r\n```\r\nServer for reproduсing:\r\n```js\r\nrequire('net').createServer(c => {\r\n    c.write('HTTP/1.1 301 Moved Permanently\\r\\n' +\r\n            'Location: http://something.com/\\r\\n');\r\n    c.end();\r\n}).listen(1234);\r\n```\r\n\r\nThe calling `http.request()` to `localhost:1234` throws an error with text `socket hang up`. But if I add `+ '\\r\\n'` to the responce, everything will work correctly.\r\nChrome, Firefox end IE correctly parse this invalid responce.\r\n\r\nAny workarounds??\r\n\r\n* **Version**: 9.1.0\r\n* **Platform**: Win 8.1 x64\r\n\r\n\r\nhttps://github.com/nodejs/node/issues/17288\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/help/issues/comments/372020474","html_url":"https://github.com/nodejs/help/issues/993#issuecomment-372020474","issue_url":"https://api.github.com/repos/nodejs/help/issues/993","id":372020474,"user":{"login":"gireeshpunathil","id":6447530,"avatar_url":"https://avatars2.githubusercontent.com/u/6447530?v=4","gravatar_id":"","url":"https://api.github.com/users/gireeshpunathil","html_url":"https://github.com/gireeshpunathil","followers_url":"https://api.github.com/users/gireeshpunathil/followers","following_url":"https://api.github.com/users/gireeshpunathil/following{/other_user}","gists_url":"https://api.github.com/users/gireeshpunathil/gists{/gist_id}","starred_url":"https://api.github.com/users/gireeshpunathil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gireeshpunathil/subscriptions","organizations_url":"https://api.github.com/users/gireeshpunathil/orgs","repos_url":"https://api.github.com/users/gireeshpunathil/repos","events_url":"https://api.github.com/users/gireeshpunathil/events{/privacy}","received_events_url":"https://api.github.com/users/gireeshpunathil/received_events","type":"User","site_admin":false},"created_at":"2018-03-10T10:43:29Z","updated_at":"2018-03-10T10:43:29Z","author_association":"MEMBER","body":"@bnoordhuis - agreed, but the main concern IMO is an endpoint crashes due to the malformed header of another, without having any way out. the error escapes both the try-catch sequence and the listeners:\r\n\r\n```js\r\nevents.js:183\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\n\r\nError: socket hang up\r\n    at createHangUpError (_http_client.js:331:15)\r\n    at Socket.socketOnEnd (_http_client.js:423:23)\r\n    at emitNone (events.js:111:20)\r\n    at Socket.emit (events.js:208:7)\r\n    at endReadableNT (_stream_readable.js:1055:12)\r\n    at _combinedTickCallback (internal/process/next_tick.js:138:11)\r\n    at process._tickCallback (internal/process/next_tick.js:180:9)\r\n```"}}
{"actor":{"display_login":"gireeshpunathil"}}