# HTTP.jl doesn't work

**URL:** https://discourse.julialang.org/t/http-jl-doesnt-work/123293
**Category:** General Usage
**Created:** [November 30, 2024, 4:40pm UTC](https://discourse.julialang.org/t/http-jl-doesnt-work/123293 "2024-11-30T16:40:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![razlichnosti111](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/razlichnosti111/32/209931_2.png) [@razlichnosti111](https://discourse.julialang.org/u/razlichnosti111)
#### Post date: [November 30, 2024, 4:40pm UTC](https://discourse.julialang.org/t/http-jl-doesnt-work/123293/1 "2024-11-30T16:40:38Z")

</div>

Hello. The HTTP.jl package does not work for me.  
I can’t figure out what the problem is.

Failed to precompile HTTP [cd3eb016-35fb-5094-929b-558a96fad6f3] to “C:\Users\Дмитрий\.julia\compiled\v1.11\HTTP\jl\_8BA4.tmp”.  
ERROR: LoadError: MbedTLS error code -15872: PK - Read/write of file failed

---

<div class="post-metadata">

### Author: ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)
#### Post date: [November 30, 2024, 6:14pm UTC](https://discourse.julialang.org/t/http-jl-doesnt-work/123293/2 "2024-11-30T18:14:25Z")

</div>

That’s an error during precompilation. You could rety the compilation in a new Julia session with `]precompile`.  
If it still doesn’t work, then please provide the outputs of `]status` and `versioninfo()`. Wrap these outputs in ```` to format them as code 🙂

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [November 30, 2024, 6:29pm UTC](https://discourse.julialang.org/t/http-jl-doesnt-work/123293/3 "2024-11-30T18:29:28Z")

</div>

Can you try to move the depot (see [Environment Variables · The Julia Language](https://docs.julialang.org/en/v1/manual/environment-variables/#JULIA_DEPOT_PATH)) to a directory without unicode characters in the path?

---

<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: [November 30, 2024, 6:48pm UTC](https://discourse.julialang.org/t/http-jl-doesnt-work/123293/4 "2024-11-30T18:48:50Z")

</div>

I confirmed the packages installs and works for me at least in 1.11.1. @giordano, It’s a good guess that Unicode/cyrillic letters might be an issue, but I checked, and all of Дмитрий is Unicode/BMP, and at least MbedTLS supports that (and Windows), in some functions, and then I assume in all.

```julia
(@v1.11) pkg> st
⌃ [cd3eb016] HTTP v1.10.10 # this one I installed and latest version should work

```

You should try (currently latest) version:

```julia
(@v1.11) pkg> add HTTP@v1.10.12

```

> Fixes a precompilation warning and segfaults during runtime on julia 1.9, which was introduced by v1.10.11

I.e. not that broken 1.10.11, might apply to later 1.10 and 1.11 Julias. If you confirm that is a problematic version, then can it be retracted?

I’ve tracked down the exact “cause”/error to:

> <https://github.com/Mbed-TLS/mbedtls/blob/017722f0431baddd22fadda3353736cdb5990fee/tf-psa-crypto/drivers/builtin/include/mbedtls/pk.h#L41-L42>

I.e. some of those here:

> **[Build software better, together](https://github.com/search?q=repo%3AMbed-TLS%2Fmbedtls%20MBEDTLS_ERR_PK_FILE_IO_ERROR&type=code)**
>
> GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.

Such as triggered in several places in this function:

> <https://github.com/Mbed-TLS/mbedtls/blob/017722f0431baddd22fadda3353736cdb5990fee/tf-psa-crypto/drivers/builtin/src/pkparse.c#L1330-L1330>

And:

> <https://github.com/Mbed-TLS/mbedtls/blob/017722f0431baddd22fadda3353736cdb5990fee/tf-psa-crypto/drivers/builtin/src/psa_util.c#L176-L177>

Similar or same cause, and then solution:

> <https://github.com/JuliaLang/julia/issues/53339#issuecomment-1974261835>
>
> On Julia 1.10.1, \`download\` regressed compared to Julia 1.10.0. This is on empt…y depot. Side effect is that registries cannot be updated (\`\]up\`).
> \`\`\`
> julia\> download("https://julialang.org/")
> ERROR: RequestError: Error reading ca cert file /etc/ssl/certs/ca-certificates.crt - mbedTLS: (-0x3E00) PK - Read/write of file failed while requesting https://julialang.org/
> Stacktrace:
> \[1\] (::Downloads.var"#9#18"{…})(easy::Downloads.Curl.Easy)
> @ Downloads ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:413
> \[2\] with\_handle(f::Downloads.var"#9#18"{…}, handle::Downloads.Curl.Easy)
> @ Downloads.Curl ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Curl/Curl.jl:95
> \[3\] #8
> @ ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:354 \[inlined\]
> \[4\] arg\_write(f::Downloads.var"#8#17"{…}, arg::IOStream)
> @ ArgTools ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/ArgTools/src/ArgTools.jl:134
> \[5\] #7
> @ ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:353 \[inlined\]
> \[6\] arg\_read
> @ ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/ArgTools/src/ArgTools.jl:76 \[inlined\]
> \[7\] request(url::String; input::Nothing, output::IOStream, method::Nothing, headers::Vector{…}, timeout::Float64, progress::Nothing, verbose::Bool, debug::Nothing, throw::Bool, downloader::Nothing)
> @ Downloads ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:352
> \[8\] request
> @ ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:320 \[inlined\]
> \[9\] #3
> @ ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:258 \[inlined\]
> \[10\] arg\_write(f::Downloads.var"#3#4"{Nothing, Vector{…}, Float64, Nothing, Bool, Nothing, Nothing, String}, arg::Nothing)
> @ ArgTools ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/ArgTools/src/ArgTools.jl:123
> \[11\] #download#2
> @ ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:257 \[inlined\]
> \[12\] download(url::String, output::Nothing)
> @ Downloads ~/julia/julia-1.10.1/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:246
> \[13\] #invokelatest#2
> @ ./essentials.jl:892 \[inlined\]
> \[14\] invokelatest
> @ ./essentials.jl:889 \[inlined\]
> \[15\] do\_download(url::String, path::Nothing)
> @ Base ./download.jl:24
> \[16\] download(url::String)
> @ Base ./download.jl:20
> \[17\] top-level scope
> @ REPL\[2\]:1
> Some type information was truncated. Use \`show(err)\` to see complete types.
> \`\`\`
> 
> on 
> \`\`\`
> $ cat /etc/centos-release
> CentOS Linux release 7.9.2009 (Core)
> \`\`\`
> 
> \`\`\`
> julia\> versioninfo()
> Julia Version 1.10.1
> Commit 7790d6f0641 (2024-02-13 20:41 UTC)
> Build Info:
> Official https://julialang.org/ release
> Platform Info:
> OS: Linux (x86\_64-linux-gnu)
> CPU: 64 × AMD EPYC 7371 16-Core Processor
> WORD\_SIZE: 64
> LIBM: libopenlibm
> LLVM: libLLVM-15.0.7 (ORCJIT, znver1)
> Threads: 8 default, 0 interactive, 4 GC (on 64 virtual cores)
> Environment:
> JULIA\_DEPOT\_PATH = /home/jaakkor2/julia/depo1
> \`\`\`
> 
> There is no \`/etc/ssl/certs/ca-certificates.crt\` on this system.

```julia
julia> download("https://julialang.org/")
ERROR: RequestError: Error reading ca cert file /etc/ssl/certs/ca-certificates.crt - mbedTLS: (-0x3E00) PK - Read/write of file failed while requesting https://julialang.org/

```

> Closing as Julia 1.10.2 has been released.

You can try this on 1.10.x rather than 1.11.x. I suppose the fix should be in 1.11 though too.

Note:

```julia
julia> -0x3E00 % Int16 # to convert correctly MbedTLS error codes TO decimal, e.g. Int32 or Int doesn't work as shown:
-15872

julia> Int(-0x3E00) # misleading
49664

```

It wasn’t helpful for me to google the decimal error code shown, nor 0xc200 which means the same in Int16. I’ve made a PR to show Windows error codes in hex, since more googlable, but then they are 32-bit, here it’s 16-bit, and not restricted to Windows. Downloads though already shows in hex.

> **[Binary/Decimal/Hexadecimal Converter](https://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html)**
>
> Can convert between Binary, Decimal and Hexadecimal

The error is decoded to:  
High level module ID = 4 (am I decoding this wrong, then misdirection below)  
Module-dependent error code = 4  
Low level module errors = 0 (i.e. not relevant seemingly)

`High-level module nr`

> <https://github.com/Mbed-TLS/mbedtls/blob/017722f0431baddd22fadda3353736cdb5990fee/tf-psa-crypto/drivers/builtin/include/mbedtls/error_common.h#L78-L79>

---

<div class="post-metadata">

### Author: ![razlichnosti111](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/razlichnosti111/32/209931_2.png) [@razlichnosti111](https://discourse.julialang.org/u/razlichnosti111)
#### Post date: [December 1, 2024, 8:13am UTC](https://discourse.julialang.org/t/http-jl-doesnt-work/123293/5 "2024-12-01T08:13:38Z")

</div>

Thank you very much for your response. Up to this point everything was working great. Apparently the problem came with some kind of update.
