Skip to content

[leo_gateway] [REST-API] Error when request URL does not contain path to file #491

Closed
@windkit

Description

Description

When leo_gateway received a request without path (i.e. only to domain), an error would be logged.

leo_gateway_rest_api:handle_1 should return tuple {ok, cowboy_req:req(), State}
but in this case, only {ok, cowboy_req:req()} is returned after replying 404 with cowboy_req:reply

Related Code

https://github.com/leo-project/leo_gateway/blob/develop/src/leo_gateway_rest_api.erl#L201
https://github.com/leo-project/leo_gateway/blob/develop/src/leo_gateway_rest_api.erl#L203

Error Case

$ wget http://127.0.0.1:8081/
[E]     gateway_0@127.0.0.1     2016-08-24 16:16:10.875766 +0900        1472022970      null:null       0       Ranch listener leo_gateway_rest_api had connection process started with cowboy_protocol:start_link/4 at <0.1783.0> exit with reason: {{try_clause,{ok,{http_req,#Port<0.3979>,ranch_tcp,keepalive,<0.1783.0>,<<"GET">>,'HTTP/1.1',{{127,0,0,1},60873},<<"127.0.0.1">>,undefined,8081,<<"/">>,undefined,<<>>,undefined,[],[{<<"user-agent">>,<<"Wget/1.15 (linux-gnu)">>},{<<"accept">>,<<"*/*">>},{<<"host">>,<<"127.0.0.1:8081">>},{<<"connection">>,<<"Keep-Alive">>}],[{<<"connection">>,[<<"keep-alive">>]}],undefined,[],waiting,<<>>,undefined,false,done,[],<<>>,undefined}}},[{cowboy_handler,handler_handle,4,[{file,"src/cowboy_handler.erl"},{line,111}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions