Oracle, I download your JDK by eating magic cookies
--no-check-certificateto avoid this issue.
Today, I had to install the SunOracle JDK on some servers, so I visited the JDK download page to retrieve the direct download link for
wget on each server:
$ wget http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz
After launching the command, the server redirects me to a 5K HTML file:
Location: http://download.oracle.com/errors/download-fail-1505220.html [following]
WAIT, WHAT? I can't download the file if I don't visit their download page to accept the OTN license.
Challenge accepted, I'm going to play with requests... What happens when I click on the archive link?
Request URL:http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz Request Method:GET Cookies: notice_preferences=2:-; s_cc=true; oraclelicense=accept-securebackup-cookie; s_nr=1405635054064; gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk7-downloads-1880260.html; s_sq=%5B%5BB%5D%5D
Okay, trying to play with cookie values (I deleted the useless values):
$ wget --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz --2014-07-18 00:15:33-- http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz Resolving download.oracle.com (download.oracle.com)... 18.104.22.168, 22.214.171.124 Connecting to download.oracle.com (download.oracle.com)|126.96.36.199|:80... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz [following] --2014-07-18 00:15:33-- https://edelivery.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz Resolving edelivery.oracle.com (edelivery.oracle.com)... 188.8.131.52 Connecting to edelivery.oracle.com (edelivery.oracle.com)|184.108.40.206|:443... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz?AuthParam=- [following] --2014-07-18 00:15:35-- http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz?AuthParam=- Connecting to download.oracle.com (download.oracle.com)|220.127.116.11|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 142384385 (136M) [application/x-gzip] Saving to: ‘jdk-7u65-linux-x64.tar.gz’
According to the OTN BCL document for Java SE:
BY SELECTING THE "ACCEPT LICENSE AGREEMENT" (OR THE EQUIVALENT) BUTTON AND/OR BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM.