Title: Passing a URL instance with a CONNECT method results in an invalid path · Issue #34347 · nodejs/node · GitHub
Open Graph Title: Passing a URL instance with a CONNECT method results in an invalid path · Issue #34347 · nodejs/node
X Title: Passing a URL instance with a CONNECT method results in an invalid path · Issue #34347 · nodejs/node
Description: Version: >=v10.21.0 Platform: Linux solus 5.6.18-156.current #1 SMP PREEMPT Sun Jun 21 07:16:38 UTC 2020 x86_64 GNU/Linux Subsystem: http, https, url What steps will reproduce the bug? const http = require('http'); const server = http.cr...
Open Graph Description: Version: >=v10.21.0 Platform: Linux solus 5.6.18-156.current #1 SMP PREEMPT Sun Jun 21 07:16:38 UTC 2020 x86_64 GNU/Linux Subsystem: http, https, url What steps will reproduce the bug? const http =...
X Description: Version: >=v10.21.0 Platform: Linux solus 5.6.18-156.current #1 SMP PREEMPT Sun Jun 21 07:16:38 UTC 2020 x86_64 GNU/Linux Subsystem: http, https, url What steps will reproduce the bug? const htt...
Opengraph URL: https://github.com/nodejs/node/issues/34347
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Passing a URL instance with a CONNECT method results in an invalid path","articleBody":"* **Version**: >=v10.21.0\r\n* **Platform**: Linux solus 5.6.18-156.current #1 SMP PREEMPT Sun Jun 21 07:16:38 UTC 2020 x86_64 GNU/Linux\r\n* **Subsystem**: http, https, url\r\n\r\n### What steps will reproduce the bug?\r\n\r\n```js\r\nconst http = require('http');\r\n\r\nconst server = http.createServer();\r\n\r\nserver.on('connect', (request, stream) => {\r\n\tconsole.log(request.url);\r\n\tstream.end('HTTP/1.1 501 Not Implemented\\r\\n\\r\\n');\r\n});\r\n\r\nserver.listen(error => {\r\n\tif (error) {\r\n\t\tthrow error;\r\n\t}\r\n\r\n\tconst url = new URL(`http://localhost:${server.address().port}/example.com`);\r\n\r\n\tconst request = http.request(url, {method: 'CONNECT'}).end();\r\n\trequest.once('connect', response => {\r\n\t\tresponse.destroy();\r\n\r\n\t\tserver.close();\r\n\t});\r\n});\r\n```\r\n\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nAlways.\r\n\r\n### What is the expected behavior?\r\n\r\n```\r\nexample.com\r\n```\r\n\r\n### What do you see instead?\r\n\r\n```\r\n/example.com\r\n```\r\n\r\n### Additional information\r\n\r\nThere is a workaround for this:\r\n\r\n```diff\r\n-const request = http.request(url, {method: 'CONNECT'}).end();\r\n+const request = http.request({\r\n+\thostname: url.hostname,\r\n+\tport: url.port,\r\n+\tpath: 'example.com',\r\n+\tmethod: 'CONNECT'\r\n+}).end();\r\n```\r\n\r\n/cc @yovanoc\r\n","author":{"url":"https://github.com/szmarczak","@type":"Person","name":"szmarczak"},"datePublished":"2020-07-14T01:07:59Z","url":"https://github.com/nodejs/node/issues/34347"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1ad3127f-f285-fdcf-94c0-cecb56759dc8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C576:1B563:51A16B:6F017B:6AED1F70 |
| html-safe-nonce | e6ed368c59787e7e550089911842d60577af8571d42f369af2bce271cf7b459c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTc2OjFCNTYzOjUxQTE2Qjo2RjAxN0I6NkFFRDFGNzAiLCJ2aXNpdG9yX2lkIjoiNDY5OTE1NjA3NzU5NjU4ODY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 15bc3abf503db76962cfac5f547822ae781b4b59a1fd3840c625ca50960d4349 |
| hovercard-subject-tag | issue:656249590 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/34347/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1d55598abde1aa444849be2cc3c7345e30e32ec8e620147ee24a9d8e8b45e117/nodejs/node/issues/34347 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1d55598abde1aa444849be2cc3c7345e30e32ec8e620147ee24a9d8e8b45e117/nodejs/node/issues/34347 |
| og:image:alt | Version: >=v10.21.0 Platform: Linux solus 5.6.18-156.current #1 SMP PREEMPT Sun Jun 21 07:16:38 UTC 2020 x86_64 GNU/Linux Subsystem: http, https, url What steps will reproduce the bug? const http =... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | szmarczak |
| hostname | github.com |
| expected-hostname | github.com |
| None | e3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 707a24b346ac8a82878b9c084efaa38a997660cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width