Error with HTTP get requests

Hello all

I have this error when using HTTP GET to retrieve data from a webservice. I have a properly formatted url and if I pass this url to curl like this, I can retrieve data correctly

r = read(`curl -s -k $url`, String);

I can also use the same url in python requests and I can return the same data correctly

r = requests.get(url,verify = False)

But when I run this in Julia with HTTP, I get this error

julia> r = HTTP.get(url; require_ssl_verification=false)
ERROR: HTTP.Exceptions.ConnectError("https://...", MbedTLS error code -28800: SSL - The requested feature is not available

Any idea why this would be failing and what I can do to resolve it?

Try defining a environment variable JULIA_NO_VERIFY_HOSTS with the value **
And drop the keyword require_ssl_verification

See GitHub - JuliaLang/NetworkOptions.jl

No, that didn’t work. I tried all three options as below.

export JULIA_NO_VERIFY_HOSTS="**"
export JULIA_SSL_NO_VERIFY_HOSTS="**"
export JULIA_SSH_NO_VERIFY_HOSTS="**"

I still get the same error message

julia> r = HTTP.get(url)
ERROR: IOError(MbedTLS error code -28800: SSL - The requested feature is not available during request(

Can you post the url?
And the entire error msg?

There is the entire message (with url redacted since it has the userid and password in it)

ERROR: IOError(MbedTLS error code -28800: SSL - The requested feature is not available during request(https://...

Stacktrace:
  [1] handshake(ctx::MbedTLS.SSLContext)
    @ MbedTLS /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/MbedTLS/WTiJ1/src/ssl.jl:81
  [2] handshake!
    @ /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/MbedTLS/WTiJ1/src/MbedTLS.jl:156 [inlined]
  [3] sslconnection(tcp::Sockets.TCPSocket, host::SubString{String}; require_ssl_verification::Bool, sslconfig::MbedTLS.SSLConfig, kw::Base.Pairs{Symbol, Union{Nothing, Bool}, Tuple{Symbol, Symbol}, NamedTuple{(:iofunction, :reached_redirect_limit), Tuple{Nothing, Bool}}})
    @ HTTP.ConnectionPool /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/ConnectionPool.jl:745
  [4] #getconnection#29
    @ /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/ConnectionPool.jl:729 [inlined]
  [5] newconnection(pod::HTTP.ConnectionPool.Pod, T::Type, host::SubString{String}, port::SubString{String}, pipeline_limit::Int64, require_ssl_verification::Bool, idle_timeout::Int64; kw::Base.Pairs{Symbol, Union{Nothing, Bool}, Tuple{Symbol, Symbol}, NamedTuple{(:iofunction, :reached_redirect_limit), Tuple{Nothing, Bool}}})
    @ HTTP.ConnectionPool /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/ConnectionPool.jl:626
  [6] getconnection(::Type{HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}}, host::SubString{String}, port::SubString{String}; connection_limit::Int64, pipeline_limit::Int64, idle_timeout::Int64, reuse_limit::Int64, require_ssl_verification::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Bool}, Tuple{Symbol, Symbol}, NamedTuple{(:iofunction, :reached_redirect_limit), Tuple{Nothing, Bool}}})
    @ HTTP.ConnectionPool /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/ConnectionPool.jl:570
  [7] request(::Type{ConnectionPoolLayer{StreamLayer{Union{}}}}, url::URIs.URI, req::HTTP.Messages.Request, body::Vector{UInt8}; proxy::Nothing, socket_type::Type, reuse_limit::Int64, kw::Base.Pairs{Symbol, Union{Nothing, Bool}, Tuple{Symbol, Symbol}, NamedTuple{(:iofunction, :reached_redirect_limit), Tuple{Nothing, Bool}}})
    @ HTTP.ConnectionRequest /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/ConnectionRequest.jl:85
  [8] request(::Type{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}, ::URIs.URI, ::Vararg{Any}; kw::Base.Pairs{Symbol, Union{Nothing, Bool}, Tuple{Symbol, Symbol}, NamedTuple{(:iofunction, :reached_redirect_limit), Tuple{Nothing, Bool}}})
    @ HTTP.ExceptionRequest /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/ExceptionRequest.jl:19
  [9] (::Base.var"#88#90"{Base.var"#88#89#91"{ExponentialBackOff, HTTP.RetryRequest.var"#2#3"{Bool, HTTP.Messages.Request}, typeof(HTTP.request)}})(::Type, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{Nothing, Bool}, Tuple{Symbol, Symbol}, NamedTuple{(:iofunction, :reached_redirect_limit), Tuple{Nothing, Bool}}})
    @ Base ./error.jl:309
 [10] #request#1
    @ /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/RetryRequest.jl:44 [inlined]
 [11] request(::Type{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}, method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}; http_version::VersionNumber, target::String, parent::Nothing, iofunction::Nothing, kw::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:reached_redirect_limit,), Tuple{Bool}}})
    @ HTTP.MessageRequest /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/MessageRequest.jl:66
 [12] request(::Type{BasicAuthLayer{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}}, method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}; kw::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:reached_redirect_limit,), Tuple{Bool}}})
    @ HTTP.BasicAuthRequest /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/BasicAuthRequest.jl:28
 [13] request(::Type{RedirectLayer{BasicAuthLayer{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}}}, method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}; redirect_limit::Int64, forwardheaders::Bool, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ HTTP.RedirectRequest /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/RedirectRequest.jl:28
 [14] request
    @ /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/RedirectRequest.jl:18 [inlined]
 [15] #request#1
    @ /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/TopRequest.jl:15 [inlined]
 [16] request(::Type{TopLayer{RedirectLayer{BasicAuthLayer{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}}}}, ::String, ::URIs.URI, ::Vector{Pair{SubString{String}, SubString{String}}}, ::Vector{UInt8})
    @ HTTP.TopRequest /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/TopRequest.jl:15
 [17] request(method::String, url::URIs.URI, h::Vector{Pair{SubString{String}, SubString{String}}}, b::Vector{UInt8}; headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}, query::Nothing, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ HTTP /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/HTTP.jl:330
 [18] request (repeats 2 times)
    @ /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/HTTP.jl:328 [inlined]
 [19] #get#17
    @ /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/HTTP.jl:407 [inlined]
 [20] get(a::URIs.URI)
    @ HTTP /prj/dpprd/data/data_team_workspace/ye/julia/PKG/packages/HTTP/aTjcj/src/HTTP.jl:407
 [21] top-level scope
    @ REPL[3535]:1

Hmmm, this is a pretty weird error message to get from mbedtls. It makes me wonder if the exact webservice is using some esoteric algorithm or tls technique that mbedtls just doesn’t support.

If you update to HTTP.jl 1.5 (released today!), you could try switching to OpenSSL.jl as the TLS provider, like:

using HTTP, OpenSSL
r = HTTP.get(url; socket_type_tls=SSLStream, require_ssl_verification=false)

Thanks, that worked!