Curl
AkamaiGlobalHost 上的文件使用瀏覽器下載,但不使用 curl
當我在瀏覽器(firefox 和 waterfox)上下載以下文件時:
https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/installer/download/EpicGamesLauncherInstaller.msi?productName=unrealengine
. 它重定向到https://epicgames-download1.akamaized.net/Builds/UnrealEngineLauncher/Installers/Win32/EpicInstaller-7.14.2.msi?launcherfilename=EpicInstaller-7.14.2-unrealengine.msi
然後下載文件。但是,當我從 firefox 複製 curl 命令以便可以使用 curl 下載文件時,我從主機 AkamaiGHost 收到 403 Forbidden。我什至無法使用下載管理器程序下載它。
這是我複制的 curl 請求(來自 firefox devtools):
curl "https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/installer/download/EpicGamesLauncherInstaller.msi?productName=unrealengine" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "DNT: 1" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1"
當我啟用 –verbose 和 –location (允許重定向)時,我從 curl 獲得以下輸出:
* STATE: INIT => CONNECT handle 0x6000574d8; line 1407 (connection #-5000) * Added connection 0. The cache now contains 1 members * STATE: CONNECT => WAITRESOLVE handle 0x6000574d8; line 1443 (connection #0) * Trying 35.169.251.130... * TCP_NODELAY set * STATE: WAITRESOLVE => WAITCONNECT handle 0x6000574d8; line 1524 (connection #0) * Connected to launcher-public-service-prod06.ol.epicgames.com (35.169.251.130) port 443 (#0) * STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x6000574d8; line 1576 (connection #0) * Marked for [keep alive]: HTTP default * ALPN, offering h2 * ALPN, offering http/1.1 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /usr/ssl/certs/ca-bundle.crt CApath: none * TLSv1.2 (OUT), TLS header, Certificate Status (22): * TLSv1.2 (OUT), TLS handshake, Client hello (1): * STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x6000574d8; line 1590 (connection #0) * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS handshake, Server key exchange (12): * TLSv1.2 (IN), TLS handshake, Server finished (14): * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): * TLSv1.2 (OUT), TLS change cipher, Client hello (1): * TLSv1.2 (OUT), TLS handshake, Finished (20): * TLSv1.2 (IN), TLS change cipher, Client hello (1): * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256 * ALPN, server did not agree to a protocol * Server certificate: * subject: CN=*.ol.epicgames.com * start date: Mar 12 00:00:00 2018 GMT * expire date: Apr 12 12:00:00 2019 GMT * subjectAltName: host "launcher-public-service-prod06.ol.epicgames.com" matched cert's "*.ol.epicgames.com" * issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon * SSL certificate verify ok. * STATE: PROTOCONNECT => DO handle 0x6000574d8; line 1611 (connection #0) > GET /launcher/api/installer/download/EpicGamesLauncherInstaller.msi?productName=unrealengine HTTP/1.1 > Host: launcher-public-service-prod06.ol.epicgames.com > Accept-Encoding: deflate, gzip > User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0 > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > Accept-Language: en-US,en;q=0.5 > DNT: 1 > Connection: keep-alive > Upgrade-Insecure-Requests: 1 > * STATE: DO => DO_DONE handle 0x6000574d8; line 1673 (connection #0) * STATE: DO_DONE => WAITPERFORM handle 0x6000574d8; line 1800 (connection #0) * STATE: WAITPERFORM => PERFORM handle 0x6000574d8; line 1815 (connection #0) * HTTP 1.1 or later with persistent connection, pipelining supported < HTTP/1.1 303 See Other < Date: Wed, 15 Aug 2018 00:31:34 GMT < Location: https://epicgames-download1.akamaized.net/Builds/UnrealEngineLauncher/Installers/Win32/EpicInstaller-7.14.2.msi?launcherfilename=EpicInstaller-7.14.2-unrealengine.msi < X-Epic-Correlation-ID: 8cf2e9aa-2945-43f3-8489-ed8c1b4f832b < Content-Length: 0 < Connection: keep-alive < * multi_done * Connection #0 to host launcher-public-service-prod06.ol.epicgames.com left intact * Issue another request to this URL: 'https://epicgames-download1.akamaized.net/Builds/UnrealEngineLauncher/Installers/Win32/EpicInstaller-7.14.2.msi?launcherfilename=EpicInstaller-7.14.2-unrealengine.msi' * STATE: PERFORM => CONNECT handle 0x6000574d8; line 1967 (connection #-5000) * Added connection 1. The cache now contains 2 members * STATE: CONNECT => WAITRESOLVE handle 0x6000574d8; line 1443 (connection #1) * Trying 88.221.14.25... * TCP_NODELAY set * STATE: WAITRESOLVE => WAITCONNECT handle 0x6000574d8; line 1524 (connection #1) * Connected to epicgames-download1.akamaized.net (88.221.14.25) port 443 (#1) * STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x6000574d8; line 1576 (connection #1) * Marked for [keep alive]: HTTP default * ALPN, offering h2 * ALPN, offering http/1.1 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /usr/ssl/certs/ca-bundle.crt CApath: none * TLSv1.2 (OUT), TLS header, Certificate Status (22): * TLSv1.2 (OUT), TLS handshake, Client hello (1): * STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x6000574d8; line 1590 (connection #1) * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS handshake, Server key exchange (12): * TLSv1.2 (IN), TLS handshake, Server finished (14): * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): * TLSv1.2 (OUT), TLS change cipher, Client hello (1): * TLSv1.2 (OUT), TLS handshake, Finished (20): * TLSv1.2 (IN), TLS change cipher, Client hello (1): * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / ECDHE-ECDSA-AES256-GCM-SHA384 * ALPN, server accepted to use http/1.1 * Server certificate: * subject: C=US; ST=Massachusetts; L=Cambridge; O=Akamai Technologies, Inc.; CN=a248.e.akamai.net * start date: Jan 23 00:00:00 2018 GMT * expire date: Jan 19 12:00:00 2019 GMT * subjectAltName: host "epicgames-download1.akamaized.net" matched cert's "*.akamaized.net" * issuer: C=US; O=DigiCert Inc; CN=DigiCert ECC Secure Server CA * SSL certificate verify ok. * STATE: PROTOCONNECT => DO handle 0x6000574d8; line 1611 (connection #1) > GET /Builds/UnrealEngineLauncher/Installers/Win32/EpicInstaller-7.14.2.msi?launcherfilename=EpicInstaller-7.14.2-unrealengine.msi HTTP/1.1 > Host: epicgames-download1.akamaized.net > Accept-Encoding: deflate, gzip > User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0 > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > Accept-Language: en-US,en;q=0.5 > DNT: 1 > Connection: keep-alive > Upgrade-Insecure-Requests: 1 > * STATE: DO => DO_DONE handle 0x6000574d8; line 1673 (connection #1) * STATE: DO_DONE => WAITPERFORM handle 0x6000574d8; line 1800 (connection #1) * STATE: WAITPERFORM => PERFORM handle 0x6000574d8; line 1815 (connection #1) * HTTP 1.1 or later with persistent connection, pipelining supported < HTTP/1.1 403 Forbidden * Server AkamaiGHost is not blacklisted < Server: AkamaiGHost < Mime-Version: 1.0 < Content-Type: text/html < Content-Length: 391 < Expires: Wed, 15 Aug 2018 00:31:35 GMT < Date: Wed, 15 Aug 2018 00:31:35 GMT < Connection: keep-alive < Content-Disposition: filename=EpicInstaller-7.14.2-unrealengine.msi < <HTML><HEAD> <TITLE>Access Denied</TITLE> </HEAD><BODY> <H1>Access Denied</H1> You don't have permission to access "http://epicgames-download1.akamaized.net/Builds/UnrealEngineLauncher/Installers/Win32/EpicInstaller-7.14.2.msi?" on this server.<P> Reference #18.150edd58.1534293095.8f2cbe </BODY> </HTML> * STATE: PERFORM => DONE handle 0x6000574d8; line 1986 (connection #1) * multi_done * Connection #1 to host epicgames-download1.akamaized.net left intact * Expire cleared
出了什麼問題?
我不確定為什麼
curl
不起作用,但wget
對我有用:% wget \ --header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" \ --header="Accept-Encoding: gzip, deflate, br" \ --header="Accept-Language: en-US,en;q=0.9" \ --header="Cache-Control: no-cache" \ --header="Connection: keep-alive" \ --header="Pragma: no-cache" \ --header="Upgrade-Insecure-Requests: 1" \ --header="User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36" \ "https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/installer/download/EpicGamesLauncherInstaller.msi?productName=unrealengine" % ls -l EpicGamesLauncherInstaller.msi\?productName=unrealengine -rw-r--r-- 1 sweh sweh 33411072 Aug 8 08:55 EpicGamesLauncherInstaller.msi?productName=unrealengine % file *msi* EpicGamesLauncherInstaller.msi?productName=unrealengine: Composite Document File V2 Document, Little Endian, Os: Windows, Version 6.1, Code page: 1252, Title: Installation Database, Subject: Epic Games Launcher, Author: Epic Games, Inc., Keywords: Installer, Comments: This installer database contains the logic and data required to install Epic Games Launcher., Create Time/Date: Wed Aug 8 13:15:26 2018, Name of Creating Application: Windows Installer XML Toolset (3.8.1128.0), Security: 4, Template: Intel;1033,1042,1041,2052,1025,1031,1034,1036,1040,1045,1046,1049,1055, Last Saved By: Intel;1033,1042,1041,2052,1025,1031,1034,1036,1040,1045,1046,1049,1055, Revision Number: {2CF87DD4-2327-44B3-81B8-3E85B197848B}1.1.163.0;{3A945EBF-3302-4D14-ABE5-C11696582633}1.1.163.0;{D0769F44-D459-450F-B084-CAE38062C75B}, Number of Pages: 405, Number of Characters: 0