1
當我瀏覽到Firefox的一個頁面,點擊下載鏈接,下面的標題所示,當我檢查網絡檢查請求的捲曲請求:如何使產生相同的響應頭火狐
Connection: keep-alive Content-Disposition: attachment; filename="example_file.mp3" Content-Length: 35181829 Content-Transfer-Encoding: binary Content-Type: audio/mpeg Date: Fri, 19 Aug 2016 18:19:02 GMT Keep-Alive: timeout=60 Server: nginx X-Powered-By: PHP/5.4.45
然而,當我使用捲曲訪問相同的地址,我得到這樣的:
Connection: keep-alive Content-Length: 1918 Content-Type: text/html; charset=UTF-8 Date: Fri, 19 Aug 2016 20:46:23 GMT Keep-Alive: timeout=60 Server: nginx X-Powered-By: PHP/5.4.45
我怎麼能形成捲曲的請求,讓我像Firefox一樣的反應?
curl無法在響應中強制標題。這些由生成響應的任何東西產生。如果你想讓curl的行爲與FF相同,那麼curl必須發送與FF完全相同的東西。 –