{"action":"opened","issue":{"url":"https://api.github.com/repos/dylanaraps/pure-bash-bible/issues/11","repository_url":"https://api.github.com/repos/dylanaraps/pure-bash-bible","labels_url":"https://api.github.com/repos/dylanaraps/pure-bash-bible/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/dylanaraps/pure-bash-bible/issues/11/comments","events_url":"https://api.github.com/repos/dylanaraps/pure-bash-bible/issues/11/events","html_url":"https://github.com/dylanaraps/pure-bash-bible/issues/11","id":332992875,"node_id":"MDU6SXNzdWUzMzI5OTI4NzU=","number":11,"title":"curl/wget (need help)","user":{"login":"131","id":13545,"node_id":"MDQ6VXNlcjEzNTQ1","avatar_url":"https://avatars3.githubusercontent.com/u/13545?v=4","gravatar_id":"","url":"https://api.github.com/users/131","html_url":"https://github.com/131","followers_url":"https://api.github.com/users/131/followers","following_url":"https://api.github.com/users/131/following{/other_user}","gists_url":"https://api.github.com/users/131/gists{/gist_id}","starred_url":"https://api.github.com/users/131/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/131/subscriptions","organizations_url":"https://api.github.com/users/131/orgs","repos_url":"https://api.github.com/users/131/repos","events_url":"https://api.github.com/users/131/events{/privacy}","received_events_url":"https://api.github.com/users/131/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-16T15:02:17Z","updated_at":"2018-06-16T15:02:17Z","closed_at":null,"author_association":"NONE","body":"I'm trying to PR a working curl / wget (using /dev/tcp)\r\n```\r\nset -ex\r\n\r\nfunction __curl() {\r\n  read proto server path <<<$(echo ${1//// })\r\n  DOC=/${path// //}\r\n  HOST=${server//:*}\r\n  PORT=${server//*:}\r\n  [[ x\"${HOST}\" == x\"${PORT}\" ]] && PORT=80\r\n\r\n  exec 3<>/dev/tcp/${HOST}/$PORT\r\n  echo -en \"GET ${DOC} HTTP/1.0\\r\\nHost: ${HOST}\\r\\n\\r\\n\" >&3\r\n  (while read line; do\r\n   [[ \"$line\" == $'\\r' ]] && break\r\n  done && cat) <&3\r\n  exec 3>&-\r\n}\r\n\r\n__curl http://www.google.com/favicon.ico > mine.ico\r\nmd5sum mine.ico\r\n\r\n```\r\n\r\n\r\nYet 'im stuck on the && cat to handle the file body (binary) \r\nI'm sure i can use a new file descriptor && echo , but my bash skill ends here  😞 \r\nI can link & use a pure bash [1], yet i'm sure there is something more elegant to do here.\r\n\r\n\r\n[1] https://unix.stackexchange.com/questions/83926/how-to-download-a-file-using-just-bash-and-nothing-else-no-curl-wget-perl-et"}}
{"actor":{"display_login":"131"}}