elixir-inspector / ua_inspector

User agent parser library
Apache License 2.0
127 stars 23 forks source link

Downloading UAInspector DB fails due to certificate issues #24

Closed mindseyeblind closed 3 years ago

mindseyeblind commented 3 years ago

Using remote release v4.2.2

❯ mix ua_inspector.download --force
Compiling 16 files (.ex)
Generated [REDACTED] app
Download path: priv/ua_inspector/
This command will replace any existing files!

19:02:10.279 [info]  TLS :client: In state :wait_cert_cr at ssl_handshake.erl:1897 generated CLIENT ALERT: Fatal - Handshake Failure
 - {:bad_cert, :hostname_check_failed}
** (MatchError) no match of right hand side value: {:error, {:tls_alert, {:handshake_failure, 'TLS client: In state wait_cert_cr at ssl_handshake.erl:1897 generated CLIENT ALERT: Fatal - Handshake Failure\n {bad_cert,hostname_check_failed}'}}}
    (ua_inspector 2.2.0) lib/ua_inspector/downloader.ex:89: UAInspector.Downloader.download_file/2
    (ua_inspector 2.2.0) lib/ua_inspector/downloader.ex:63: anonymous fn/1 in UAInspector.Downloader.download/1
    (elixir 1.11.3) lib/enum.ex:798: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir 1.11.3) lib/enum.ex:798: Enum.each/2
    (elixir 1.11.3) lib/enum.ex:798: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir 1.11.3) lib/enum.ex:798: Enum.each/2
    (ua_inspector 2.2.0) lib/mix/tasks/ua_inspector/download.ex:65: Mix.Tasks.UaInspector.Download.perform_download/1
    (mix 1.11.3) lib/mix/task.ex:394: Mix.Task.run_task/3
    (mix 1.11.3) lib/mix/cli.ex:84: Mix.CLI.run_task/2
    (elixir 1.11.3) lib/code.ex:931: Code.require_file/2
mneudert commented 3 years ago

Coud you try updating your local :hackney dependency (running mix deps.update hackney should work) to see if that solves the problem?

And this is definitely a case of bad documentation but your configured release version will most likely not work but fail to parse. The latest supported version is the default v3.13.1, the v4.x databases require not yet released changes.

mindseyeblind commented 3 years ago

Upgrading to the latest hackney version fixed the issue. I've raised a separate issue for the 4.x database upgrade - it seems to be a matter of setting a different regex for parsing short code maps.