# Downloads.download() error

**URL:** <https://discourse.julialang.org/t/downloads-download-error/131408>\
**Category:** General Usage\
**Tags:** http, download\
**Created:** [August 6, 2025, 1:54pm UTC](https://discourse.julialang.org/t/downloads-download-error/131408 "2025-08-06T13:54:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [August 6, 2025, 1:54pm UTC](https://discourse.julialang.org/t/downloads-download-error/131408/1 "2025-08-06T13:54:41Z")

</div>

```julia-auto
import Downloads
Downloads.download("https://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm")

```

produces the error:

```julia-auto
ERROR: RequestError: HTTP/2 stream 1 was not closed cleanly: INTERNAL_ERROR (err 2) while requesting https://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm

```

but the URL is fine to be opened in a browser.

I’m not familiar with web techs. Please suggest how to fix it. Thanks.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [August 6, 2025, 2:45pm UTC](https://discourse.julialang.org/t/downloads-download-error/131408/2 "2025-08-06T14:45:47Z")

</div>

Try:

```julia-auto
using HTTP
hr = HTTP.get(url)

```

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [August 7, 2025, 6:19pm UTC](https://discourse.julialang.org/t/downloads-download-error/131408/3 "2025-08-07T18:19:39Z")

</div>

> [@tomtom](#):
>
> ```julia-auto
> ERROR: RequestError: HTTP/2 stream 1 was not closed cleanly: INTERNAL_ERROR (err 2) while requesting https://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm
> 
> ```
> 
> .. I’m not familiar with web techs.

Neither am I with that particular error.

download() doesn’t support HTTP/3 (that always uses https), I believe, neither HTTP/2 apparently (at least not always).

In many cases you could change https → http, and both are supported (by the web server; the latter always by Julia). In most cases it would work, but not here (an issue with the server):

```julia-auto
julia> using Downloads

```

```julia-auto
julia> Downloads.download("http://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm")
ERROR: RequestError: Operation too slow. Less than 1 bytes/sec transferred the last 20 seconds while requesting http://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm

```

however this worked quickly (so seemingly NOT the same web server serving the above file despite same host?)::

```julia-auto
julia> Downloads.download("http://www.hkex.com.hk/")
"/tmp/jl_HMxKLOjudO"

```

The issue seems to be Julia’s built in dependency curl (at least how Julia configures it), and I would usually think `curl` handles anything out there…:

> [2] with\_handle(f::Downloads.var"#23#24"{IOStream, Base.DevNull, Nothing, Vector{Pair{String, String}}, Float64, Nothing, Bool, Nothing, Bool, Nothing, String, Bool, Bool}, handle::Downloads.Curl.Easy)  
> @ Downloads.Curl ~/.julia/juliaup/julia-1.12.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.12/Downloads/src/Curl/Curl.jl:105

I looked into if better on 1.12-rc1, or any newer (no).

I’m not sure why this rather worked, seemingly it instructs using the older HTTP/1.1

```julia-auto
julia> hr = HTTP.get(“https://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm”)HTTP.Messages.Response:“”"HTTP/1.1 200 OK

```

```julia-auto
…

```

```julia-auto
24411176-byte body“”"

```

Maybe Curl config in Julia can be changed to always work?

```julia-auto
$ curl https://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm
curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)

$ wget https://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm
--2025-08-07 18:23:23-- https://www.hkex.com.hk/eng/stat/smstat/dayquot/d250806e.htm
Resolving www.hkex.com.hk (www.hkex.com.hk)... 2.19.176.170, 2.19.176.185
Tengist www.hkex.com.hk (www.hkex.com.hk)|2.19.176.170|:443... connected.
HTTP fyrirspurn send, bíð svars... [HTTP query sent, waiting for answer]

```

> <https://github.com/curl/curl/issues/12121>
>
> \### I did this
> 
> I have a small app to performs curl requests and returns json …from an endpoint, it all works fine locally on my machine however when I run the same code on my remote DigitalOcean droplet I get the following error:
> 
> \`Curl error: HTTP/2 stream 0 was not closed cleanly: INTERNAL\_ERROR (err 2)Curl error: HTTP/2 stream 0 was not closed cleanly: INTERNAL\_ERROR (err 2\`
> 
> Running cURL requests via a DigitalOcean droplet running the following: 
> 
> Ubuntu 22.04 LTS
> PHP 8.2.8
> MySQL 8.0.34-0ubuntu0.22.04.1 for Linux on x86\_64
> 
> 
> \### I expected the following
> 
> A curl request is to be completed successfully and return some array data 
> 
> \### curl/libcurl version
> 
> Curl 7.8.1.0
> 
> curl --version
> curl 7.81.0 (x86\_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.15
> Release-Date: 2022-01-05
> Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
> Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM\_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd
> 
> \### operating system
> 
> Ubuntu 22.04 LTS
> 
> To replicate this I can curl the URL directly from my PHP8.2.8 DigitalOcean droplet
> \`curl -v https://proclubs.ea.com/api/fc/clubs/matches?matchType=leagueMatch&platform=common-gen5&clubIds=542851\`
> 
> Response
> \`\`\`
> curl -v https://proclubs.ea.com/api/fc/clubs/matches?matchType=leagueMatch&platform=common-gen5&clubIds=542851
> \[1\] 54883
> \[2\] 54884
> \* Trying 23.194.14.89:443...
> \* Connected to proclubs.ea.com (23.194.14.89) port 443 (#0)
> \* ALPN, offering h2
> \* ALPN, offering http/1.1
> \[2\]+ Done platform=common-gen5
> \* CAfile: /etc/ssl/certs/ca-certificates.crt
> \* CApath: /etc/ssl/certs
> \* TLSv1.0 (OUT), TLS header, Certificate Status (22):
> \* TLSv1.3 (OUT), TLS handshake, Client hello (1):
> \* TLSv1.2 (IN), TLS header, Certificate Status (22):
> \* TLSv1.3 (IN), TLS handshake, Server hello (2):
> \* TLSv1.2 (IN), TLS header, Finished (20):
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* TLSv1.3 (IN), TLS handshake, Certificate (11):
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* TLSv1.3 (IN), TLS handshake, CERT verify (15):
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* TLSv1.3 (IN), TLS handshake, Finished (20):
> \* TLSv1.2 (OUT), TLS header, Finished (20):
> \* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
> \* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> \* TLSv1.3 (OUT), TLS handshake, Finished (20):
> \* SSL connection using TLSv1.3 / TLS\_AES\_256\_GCM\_SHA384
> \* ALPN, server accepted to use h2
> \* Server certificate:
> \* subject: C=US; ST=CALIFORNIA; L=Redwood City; O=Electronic Arts, Inc.; CN=www.origin.com
> \* start date: Jul 18 00:00:00 2023 GMT
> \* expire date: Jul 17 23:59:59 2024 GMT
> \* subjectAltName: host "proclubs.ea.com" matched cert's "\*.ea.com"
> \* issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
> \* SSL certificate verify ok.
> \* Using HTTP2, server supports multiplexing
> \* Connection state changed (HTTP/2 confirmed)
> \* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
> \* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> \* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> \* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> \* Using Stream ID: 1 (easy handle 0x563fa00f4e90)
> \* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> \> GET /api/fc/clubs/matches?matchType=leagueMatch HTTP/2
> \> Host: proclubs.ea.com
> \> user-agent: curl/7.81.0
> \> accept: \*/\*
> \>
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
> \* old SSL session ID is stale, removing
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* TLSv1.2 (IN), TLS header, Supplemental data (23):
> \* HTTP/2 stream 0 was not closed cleanly: INTERNAL\_ERROR (err 2)
> \* stopped the pause stream!
> \* Connection #0 to host proclubs.ea.com left intact
> curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL\_ERROR (err 2)
> \`\`\`
> 
> 
> PHP CODE
> \`\`\`php
> private static function initializeCurl(string $url): CurlHandle|false
> { 
> // exampleURL
> $url = 'https://proclubs.ea.com/api/fc/clubs/matches?matchType=leagueMatch&platform=common-gen5&clubIds=542851;
>   
> $curl = curl\_init();
> curl\_setopt\_array($curl, \[
> CURLOPT\_URL =\> $url,
> CURLOPT\_RETURNTRANSFER =\> true,
> CURLOPT\_ENCODING =\> '',
> CURLOPT\_TIMEOUT =\> 10,
> CURLOPT\_FOLLOWLOCATION =\> true,
> CURLOPT\_HTTP\_VERSION =\> CURL\_HTTP\_VERSION\_2,
> CURLOPT\_FAILONERROR =\> true,
> CURLOPT\_REFERER =\> self::REFERER,
> CURLOPT\_HTTPHEADER =\> \[
> 'accept-language: en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7',
> 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_15\_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36',
> \],
> \]);
> 
> return $curl;
> }
> \`\`\`

“Closed as not planned” there at Curl/upstream, apparently because “not-a-curl-bug” then what, bad config at that web server?
