HTTP request error

I m using HTTP package version 0.7.1 in Julia 1.5.3 and I get this error when executing HTTP.get or HTTP.request methods

ERROR: type Regex has no field match_data Stacktrace: [1] getproperty(::Regex, ::Symbol) at .\Base.jl:33 [2] exec(::Regex, ::String, ::Int64) at C:\Users\abdou\.julia\packages\HTTP\YjRCz\src\parseutils.jl:4 (repeats 2 times) [3] parse_uri_reference(::String; strict::Bool) at C:\Users\abdou\.julia\packages\HTTP\YjRCz\src\URIs.jl:126 [4] parse_uri_reference(::String) at C:\Users\abdou\.julia\packages\HTTP\YjRCz\src\URIs.jl:126 [5] HTTP.URIs.URI(::String) at C:\Users\abdou\.julia\packages\HTTP\YjRCz\src\URIs.jl:144 [6] request(::String, ::String, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; headers::Array{Pair{SubString{String},SubString

{String}},1}, body::Array{UI
nt8,1}, query::Nothing, kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\abdou.julia\packages\HTTP\YjRCz\src\HTTP.jl:312
[7] request(::String, ::String, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at C:\Users\abdou.julia\packages\HTTP\YjRCz\src \HTTP.jl:312 (repeats 2 tim
es)
[8] get(::String; kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\abdou.julia\packages\HTTP\YjRCz\src\HTTP.jl:349
[9] get(::String) at C:\Users\abdou.julia\packages\HTTP\YjRCz\src\HTTP.jl:349
[10] top-level scope at REPL[30]:1

The code generating this error is in parseutils.jl file in HTTP source code. This code uses a field named match_data for a variable of type Regex but Regex type has no such field. Is there any way to fix that? Thanks for any reply

Can you show us the code you ran that generates that error?

The code is as simple like this

using HTTP HTTP.get("https://www.developpez.com") or HTTP.request("GET", "https://www.developpez.com")

The problem is that the code source in the file parseutils.jl in HTTP package uses a field named match_data of Regex type. Regex type do not have this field.This is probably a problem of Julia version or HTTP package version. I m new in Julia so ... Thanks for reply.

Interesting. HTTP.get("https://www.developpez.com") works on my laptop. I’m on version 1.5.1 of Julia and version 0.8.19 of HTTP. Can you try to update your version of the HTTP.jl package?

Looks like some time between 1.2 to 1.3, there was a update to Base’s Regex, and it has remove the match_data field. So you might want to downgrade base Julia to 1.2 or upgrade HTTP.jl to at least 0.8.4, where it seems to re-worked its own RegexAndMatchData?

1 Like

I’ve updated the HTTP package and now all requests are working well.
Thanks for all contributions.

Cross posting for reference but someone had the same issue here: How to fix HTTP in Julia? - Stack Overflow

1 Like