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

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

Closed
windkit opened this issue Aug 24, 2016 · 2 comments
Closed

Comments

@windkit
Copy link
Contributor

windkit commented Aug 24, 2016

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]     [email protected]     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}]}]}
@windkit
Copy link
Contributor Author

windkit commented Aug 24, 2016

Fix with PR leo-project/leo_gateway#47

@yosukehara
Copy link
Member

We fixed this issue, which will be included in v1.3.1.

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

No branches or pull requests

2 participants