Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MISP.HTTP.handle_response/1 raises Protocol.UndefinedError on HTTP connection #1

Open
NullOranje opened this issue Feb 4, 2021 · 0 comments · May be fixed by #2
Open

MISP.HTTP.handle_response/1 raises Protocol.UndefinedError on HTTP connection #1

NullOranje opened this issue Feb 4, 2021 · 0 comments · May be fixed by #2

Comments

@NullOranje
Copy link

If there is a connection error when connecting to MISP, the current result raises an Protocol.UndefinedError which consumes the underlying cause. For example, when connecting to a MISP server with a self-signed certificate, the following error is observed.

Interactive Elixir (1.11.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> import MISP
MISP
iex(2)> MISP.Event.get(1)
** (Protocol.UndefinedError) protocol String.Chars not implemented for {:options, {:sslv3, {:versions, [:"tlsv1.2", :"tlsv1.1", :tlsv1, :sslv3]}}} of type Tuple. This protocol is implemented for the following type(s): Float, DateTime, Time, List, Version.Requirement, Atom, Integer, Version, Date, BitString, NaiveDateTime, URI
    (elixir 1.11.2) lib/string/chars.ex:3: String.Chars.impl_for!/1
    (elixir 1.11.2) lib/string/chars.ex:22: String.Chars.to_string/1
    (mispex 0.1.8) lib/http.ex:87: MISP.HTTP.handle_response/1
    (mispex 0.1.8) lib/http.ex:31: MISP.HTTP.get/2

This can be fixed by using HTTPoison.Error.message/1 to safely wrap the error instead of reaching into the struct directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant