Skip to content

Instantly share code, notes, and snippets.

@passcod
Forked from anonymous/-
Created August 27, 2013 06:53
Show Gist options
  • Select an option

  • Save passcod/6350405 to your computer and use it in GitHub Desktop.

Select an option

Save passcod/6350405 to your computer and use it in GitHub Desktop.

Revisions

  1. passcod renamed this gist Aug 27, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @invalid-email-address Anonymous created this gist Aug 27, 2013.
    30 changes: 30 additions & 0 deletions -
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    [10:26:16] <devinus> phinze: apparently Oracle won't let you download the dmg until you have a cookie in your browser
    [10:26:19] <devinus> grooosss
    [10:26:31] <phinze> devinus: ewww
    [10:27:25] <phinze> stupid oracle
    [10:27:38] <phinze> here's somebody trying to work out how to script it http://ivan-site.com/2012/05/download-oracle-java-jre-jdk-using-a-script/
    [10:27:53] <phinze> but then we're getting into annoyingly murky territory
    [10:29:47] <devinus> phinze: should i give up or is there a way to pass a cookie along?
    [10:45:24] <phinze> devinus: looking at CurlDownloadStrategy quick
    [10:46:25] <devinus> phinze: in curl, this works: curl -b gpw_e24=http%3A%2F%2Fwww.oracle.com -O -L http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-macosx-x64.dmg
    [10:46:40] <phinze> so i guess theoretically we could subclass it and override CurlDownloadStrategy#_fetch
    [10:47:14] <phinze> but i'm guessing you probably don't want to get further down this yak haircut :)
    [10:47:38] <phinze> seems like a reasonable feature to add from my perspective - and nobody wants to install java manually :)
    [10:48:04] <phinze> so your options are (1) look into adding the cookie feature to homebrew-cask, (2) open an issue with everything you've got so far and one of us can pick it up for ya
    [10:49:03] <devinus> phinze: it seems to only check for the existence of the gpw_e24 variable
    [10:49:09] <devinus> curl -b gpw_e24=1 -O -L http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-macosx-x64.dmg
    [10:49:12] <devinus> works just as well
    [10:49:36] <devinus> phinze: let's brainstorm what it would look like in the DSL
    [10:49:42] <phinze> devinus: sure
    [10:49:46] <devinus> url 'http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-macosx-x64.dmg'
    [10:50:02] <devinus> header 'Cookie: gpw_e24=1'
    [10:50:02] <devinus> ?
    [10:50:06] <devinus> cookie 'gpw_e24=1'
    [10:50:17] <phinze> url 'http:/.../', :cookies => { :gpw_e24 => 1 } ?
    [10:50:24] <devinus> ah
    [10:50:31] <devinus> much better :)
    [10:50:50] <phinze> probably makes most sense pushing it right up against url, rather than having a new top level keyword
    [10:50:58] <devinus> for now it only needs to support cookies, maybe if it's super easy i can do :headers too
    [10:51:06] <devinus> agreed
    [10:51:17] <phinze> sure - you're thinking you wanna try and pick it up? :D
    [10:51:58] <devinus> i'll try my hand at it