GithubHelp home page GithubHelp logo

cowboy_pre_req_fail's Introduction

cowboy_pre_req_fail

Example showing silent fail of cowboy after upgrading to recent pre-6 version without updating the callback handler. The handler is still providing the old Req field in the callbacks. Cowboy is failing silently which is not expected behaviour.

[winlu@virtualArch cowboy_pre_req_fail]$ make shell
 GEN    shell
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V8.2  (abort with ^G)
1> application:ensure_all_started(cowboy_pre_req_fail).
{ok,[crypto,cowlib,asn1,public_key,ssl,ranch,cowboy,
     cowboy_pre_req_fail]}
2> l(gun).
{module,gun}
3> application:ensure_all_started(gun).
{ok,[gun]}
4> ranch:info().
[{cowboy_ref,[{pid,<0.86.0>},
              {ip,{0,0,0,0}},
              {port,8080},
              {num_acceptors,100},
              {max_connections,1024},
              {active_connections,0},
              {all_connections,0},
              {transport,ranch_tcp},
              {transport_options,[{connection_type,supervisor},
                                  {port,8080}]},
              {protocol,cowboy_clear},
              {protocol_options,#{connection_type => supervisor,
                                  env => #{dispatch => [{'_',[],[{[],[],cowboy_pre_req_fail_app,[]}]}]}}}]}]
5> {ok, GunPid} = gun:open("127.0.0.1", 8080, #{retry=>0}).
{ok,<0.198.0>}
6> {ok, http} = gun:await_up(GunPid).
{ok,http}
7> gun:ws_upgrade(GunPid, "/").
#Ref<0.0.1.394>
8> erlang:process
process_display/2  process_flag/2     process_flag/3     process_info/1
process_info/2     processes/0
8> erlang:process
process_display/2  process_flag/2     process_flag/3     process_info/1
process_info/2     processes/0
8> receive
8>   Msg -> Msg
8> after 5000 -> timeout
8> end.
{gun_down,<0.198.0>,http,closed,[],[]}
9> ranch:info().
[{cowboy_ref,[{pid,<0.86.0>},
              {ip,{0,0,0,0}},
              {port,8080},
              {num_acceptors,100},
              {max_connections,1024},
              {active_connections,0},
              {all_connections,0},
              {transport,ranch_tcp},
              {transport_options,[{connection_type,supervisor},
                                  {port,8080}]},
              {protocol,cowboy_clear},
              {protocol_options,#{connection_type => supervisor,
                                  env => #{dispatch => [{'_',[],[{[],[],cowboy_pre_req_fail_app,[]}]}]}}}]}]
10> q().
ok
11> [winlu@virtualArch cowboy_pre_req_fail]$ vim README.md

cowboy_pre_req_fail's People

Contributors

ingwinlu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.