{"action":"created","issue":{"url":"https://api.github.com/repos/opal/opal/issues/1721","repository_url":"https://api.github.com/repos/opal/opal","labels_url":"https://api.github.com/repos/opal/opal/issues/1721/labels{/name}","comments_url":"https://api.github.com/repos/opal/opal/issues/1721/comments","events_url":"https://api.github.com/repos/opal/opal/issues/1721/events","html_url":"https://github.com/opal/opal/issues/1721","id":282622995,"number":1721,"title":"Implement OpenURI module","user":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars3.githubusercontent.com/u/333276?v=4","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"labels":[{"id":250249187,"url":"https://api.github.com/repos/opal/opal/labels/stdlib","name":"stdlib","color":"c5def5","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-12-16T13:16:19Z","updated_at":"2018-02-05T21:54:45Z","closed_at":"2018-02-05T21:54:45Z","author_association":"MEMBER","body":"As far as I understand, this module is part of the `stdlib` ?\r\nhttps://ruby-doc.org/stdlib-2.1.0/libdoc/open-uri/rdoc/OpenURI.html\r\n\r\n> It is possible to open an http, https or ftp URL as though it were a file:\r\n\r\nI think we could just implement `http` and `https` with `XMLHttpRequest`.\r\nIn Asciidoctor.js we are considering using the Node module `xmlhttprequest` to read remote files synchronously: https://www.npmjs.com/package/xmlhttprequest\r\n\r\nCurrently the following code will throw an exception (when `nodejs` module is loaded):\r\n\r\n```ruby\r\nopen(\"http://www.ruby-lang.org/\") {|f|\r\n  f.each_line {|line| p line}\r\n}\r\n```\r\n\r\nThe root cause is that `open` will instantiate a new `File` and, ss you can see below, we are using `openSync` which does not support URI.\r\n\r\nhttps://github.com/opal/opal/blob/8a4f5a4cd1dedbb07bd81ad59a5e38a9b93519e2/stdlib/nodejs/file.rb#L169\r\n\r\nSo `open` function should create a special kind of `File` when the path starts with `http://` or `https://`.\r\nWith a few guidances on how to properly implement this feature, I will gladly send a pull request :wink: \r\n"},"comment":{"url":"https://api.github.com/repos/opal/opal/issues/comments/363234384","html_url":"https://github.com/opal/opal/issues/1721#issuecomment-363234384","issue_url":"https://api.github.com/repos/opal/opal/issues/1721","id":363234384,"user":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars3.githubusercontent.com/u/333276?v=4","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"created_at":"2018-02-05T21:54:45Z","updated_at":"2018-02-05T21:54:45Z","author_association":"MEMBER","body":"I think we can close this issue.\r\nInitial support for OpenURI has been merged in https://github.com/opal/opal/pull/1735"}}
{"actor":{"display_login":"Mogztter"}}