{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/4334","labels_url":"https://api.github.com/repos/nodejs/node/issues/4334/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/4334/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/4334/events","html_url":"https://github.com/nodejs/node/issues/4334","id":122770727,"number":4334,"title":"NodeJS disconnects when \"Upgrade\" HTTP header is used for example to advertise HTTP/2 support","user":{"login":"bazzadp","id":10931297,"avatar_url":"https://avatars.githubusercontent.com/u/10931297?v=3","gravatar_id":"","url":"https://api.github.com/users/bazzadp","html_url":"https://github.com/bazzadp","followers_url":"https://api.github.com/users/bazzadp/followers","following_url":"https://api.github.com/users/bazzadp/following{/other_user}","gists_url":"https://api.github.com/users/bazzadp/gists{/gist_id}","starred_url":"https://api.github.com/users/bazzadp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazzadp/subscriptions","organizations_url":"https://api.github.com/users/bazzadp/orgs","repos_url":"https://api.github.com/users/bazzadp/repos","events_url":"https://api.github.com/users/bazzadp/events{/privacy}","received_events_url":"https://api.github.com/users/bazzadp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/http","name":"http","color":"c7def8"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-12-17T16:31:12Z","updated_at":"2016-01-27T19:11:20Z","closed_at":"2015-12-17T17:36:49Z","body":"More details in this issue: https://github.com/icing/mod_h2/issues/73 as this was originally raised with the Apache HTTP/2 project but they have identified this as a Node issue.\r\n\r\nNodejs https (and http) fails to parse certain HTTP responses with an Upgrade header.\r\n\r\nThis fails:\r\n\r\n    HTTP/1.1 200 OK\r\n    Date: Thu, 17 Dec 2015 15:17:46 GMT\r\n    Server: Apache/2.5.0-dev (Unix) OpenSSL/1.0.2e\r\n    Upgrade: h2\r\n    Connection: Upgrade, Keep-Alive\r\n    Last-Modified: Thu, 17 Dec 2015 15:17:39 GMT\r\n    ETag: \"7d5-5271985fa6ac0\"\r\n    Accept-Ranges: bytes\r\n    Content-Length: 2005\r\n    Keep-Alive: timeout=5\r\n    Content-Type: text/html\r\n\r\nwhile this answer succeeds:\r\n\r\n    HTTP/1.1 200 OK\r\n    Date: Thu, 17 Dec 2015 15:19:59 GMT\r\n    Server: Apache/2.5.0-dev (Unix) OpenSSL/1.0.2e\r\n    Last-Modified: Thu, 17 Dec 2015 15:19:56 GMT\r\n    ETag: \"7d5-527198e24df00\"\r\n    Accept-Ranges: bytes\r\n    Content-Length: 2005\r\n    Keep-Alive: timeout=5\r\n    Connection: Keep-Alive\r\n    Content-Type: text/html\r\n\r\nEither it is the Upgrade response header or the Upgrade token in the Connection.\r\n\r\nTo repeat, make a call my site (www.tunetheweb.com) using standard https call like below:\r\n\r\n```javascript\r\nvar https = require('https');\r\n\r\nvar options = {\r\n  hostname: 'www.tunetheweb.com',\r\n  path: '/',\r\n};\r\n\r\nvar req = https.request(options, function(res) {\r\n  console.log(\"statusCode: \", res.statusCode);\r\n  console.log(\"headers: \", res.headers);\r\n\r\n  res.on('data', function(d) {\r\n    process.stdout.write(d);\r\n  });\r\n});\r\nreq.end();\r\n\r\nreq.on('error', function(e) {\r\n  console.log(e);\r\n});\r\n````\r\n\r\nApache 2.4.18 introduced these headers when using HTTP/2 through the mod_http2 module and NodeJS is now unable to connect to any Apache server using HTTP/2. NodeJS was able to connect using Apache 2.4.17 even when H2 was supported as the upgrade headers were not advertised.\r\n\r\nUpgrade headers are part of the HTTP spec (http://www.w3.org/Protocols/rfc2616/rfc2616.txt) and Node should ignore any unsupported upgrade protocol suggestions and continue using HTTP/1.1. Instead it disconnects.\r\n\r\nThanks,\r\nBarry"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/175802363","html_url":"https://github.com/nodejs/node/issues/4334#issuecomment-175802363","issue_url":"https://api.github.com/repos/nodejs/node/issues/4334","id":175802363,"user":{"login":"djc","id":158471,"avatar_url":"https://avatars.githubusercontent.com/u/158471?v=3","gravatar_id":"","url":"https://api.github.com/users/djc","html_url":"https://github.com/djc","followers_url":"https://api.github.com/users/djc/followers","following_url":"https://api.github.com/users/djc/following{/other_user}","gists_url":"https://api.github.com/users/djc/gists{/gist_id}","starred_url":"https://api.github.com/users/djc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djc/subscriptions","organizations_url":"https://api.github.com/users/djc/orgs","repos_url":"https://api.github.com/users/djc/repos","events_url":"https://api.github.com/users/djc/events{/privacy}","received_events_url":"https://api.github.com/users/djc/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T19:11:20Z","updated_at":"2016-01-27T19:11:20Z","body":"@bnoordhuis so what's the best venue if I want to try and do some convincing?"}}