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

Calling GET /path/?filter[name]=| returns 500 #7

Open
cecemel opened this issue Jul 20, 2020 · 3 comments
Open

Calling GET /path/?filter[name]=| returns 500 #7

cecemel opened this issue Jul 20, 2020 · 3 comments

Comments

@cecemel
Copy link
Member

cecemel commented Jul 20, 2020

Hello,

It seems I have a problem when executing a query similar to:

curl -v "http://host/path?filter[name]=|"

An HTTP error 500 is returned.
It suspect semtech/mu-identifier:1.8.0 to be the cause of the issue, as reverting back to semtech/mu-identifier:1.7.0 fixes the issue.
Other filter values seen to work too.

@madnificent
Copy link
Member

Thank you for the issue. Curl doesn't seem to escape the supplied URL and the pipe character should be represented as %7C. In a browser encodeURIComponent can be used. I suppose 1.7.0 was more lenient in accepting URLs. Does it make sense to URL encode this request from your end?

@HugaertsDries
Copy link

I've noticed the same behavior when bumping versions of mu-dispatcher. But as we discussed earlier, this could be due to the fact that they are build on the same libraries and base constructs.

To give some more insight, here is a stacktrace:

dispatcher_1                                                   | 08:54:37.881 [info]  POST /melding
dispatcher_1                                                   | An error occurred: {:error,
dispatcher_1                                                   |  %Mint.HTTPError{
dispatcher_1                                                   |    module: Mint.HTTP1,
dispatcher_1                                                   |    reason: {:invalid_request_target, "/melding?type=|"}
dispatcher_1                                                   |  }}
identifier_1                                                   | 
identifier_1                                                   | 08:54:37.883 [info]  Sent 500 in 4ms
dispatcher_1                                                   | 
dispatcher_1                                                   | 08:54:37.883 [error] #PID<0.468.0> running PlugRouterDispatcher (connection #PID<0.467.0>, stream id 1) terminated
dispatcher_1                                                   | Server: localhost:90 (http)
dispatcher_1                                                   | Request: POST /melding?type=|
dispatcher_1                                                   | ** (exit) an exception was raised:
dispatcher_1                                                   |     ** (Plug.Conn.NotSentError) a response was neither set nor sent from the connection
dispatcher_1                                                   |         (plug_cowboy) lib/plug/cowboy/handler.ex:50: Plug.Cowboy.Handler.maybe_send/2
dispatcher_1                                                   |         (plug_cowboy) lib/plug/cowboy/handler.ex:13: Plug.Cowboy.Handler.init/2
dispatcher_1                                                   |         (cowboy) /app/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2
dispatcher_1                                                   |         (cowboy) /app/deps/cowboy/src/cowboy_stream_h.erl:296: :cowboy_stream_h.execute/3
dispatcher_1                                                   |         (cowboy) /app/deps/cowboy/src/cowboy_stream_h.erl:274: :cowboy_stream_h.request_process/3
dispatcher_1                                                   |         (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

@HugaertsDries
Copy link

Thank you for the issue. Curl doesn't seem to escape the supplied URL and the pipe character should be represented as %7C. In a browser encodeURIComponent can be used. I suppose 1.7.0 was more lenient in accepting URLs. Does it make sense to URL encode this request from your end?

For now, I think this is the better approach

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

No branches or pull requests

3 participants