From essen at ninenines.eu Wed Oct 17 12:16:51 2012 From: essen at ninenines.eu (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 17 Oct 2012 12:16:51 +0200 Subject: [99s-extend] Welcome! Message-ID: <507E8593.8020404@ninenines.eu> Hello everyone and welcome to the only mailing list dedicated to the Nine Nines projects including Cowboy, Ranch, Bullet, Sheriff, Farwest and more! Feel free to ask any question or request support from the community directly on this mailing list and we will try to help you as quickly as possible. Mailing lists for French and Japanese speakers will be created at a later date. Thanks for subscribing! -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From thomas at oinksoft.com Wed Oct 17 13:51:55 2012 From: thomas at oinksoft.com (Thomas Allen) Date: Wed, 17 Oct 2012 07:51:55 -0400 Subject: [99s-extend] Welcome! In-Reply-To: <507E8593.8020404@ninenines.eu> References: <507E8593.8020404@ninenines.eu> Message-ID: <4bcaad4d34881502b48a91fcb1384de4.squirrel@oinksoft.com> Very exciting! Now there's no excuse for asking about Cowboy on the `erlang-questions' list ;^) Thomas Allen On Wed, October 17, 2012 6:16 am, Lo?c Hoguin wrote: > Hello everyone and welcome to the only mailing list dedicated to the > Nine Nines projects including Cowboy, Ranch, Bullet, Sheriff, Farwest > and more! > > Feel free to ask any question or request support from the community > directly on this mailing list and we will try to help you as quickly as > possible. > > Mailing lists for French and Japanese speakers will be created at a > later date. > > Thanks for subscribing! > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > _______________________________________________ > Extend mailing list > Extend at lists.ninenines.eu > http://lists.ninenines.eu:81/listinfo/extend > From zabrane3 at gmail.com Tue Oct 30 21:34:35 2012 From: zabrane3 at gmail.com (Zabrane Mickael) Date: Tue, 30 Oct 2012 21:34:35 +0100 Subject: [99s-extend] Congrats for the new mailinglist Message-ID: <8C60E8B8-8A20-4553-BCC7-9735C46446B5@gmail.com> Bravo Lo?c, Regards, Zabrane From essen at ninenines.eu Tue Oct 30 21:37:07 2012 From: essen at ninenines.eu (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 30 Oct 2012 21:37:07 +0100 Subject: [99s-extend] Congrats for the new mailinglist In-Reply-To: <8C60E8B8-8A20-4553-BCC7-9735C46446B5@gmail.com> References: <8C60E8B8-8A20-4553-BCC7-9735C46446B5@gmail.com> Message-ID: <50903A73.1060809@ninenines.eu> On 10/30/2012 09:34 PM, Zabrane Mickael wrote: > Bravo Lo?c, Thanks. I feel obligated to tell you I started calling you the "congrats guy" since you congratulate every progress everywhere. :) -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From zabrane3 at gmail.com Tue Oct 30 21:40:27 2012 From: zabrane3 at gmail.com (Zabrane Mickael) Date: Tue, 30 Oct 2012 21:40:27 +0100 Subject: [99s-extend] Congrats for the new mailinglist In-Reply-To: <50903A73.1060809@ninenines.eu> References: <8C60E8B8-8A20-4553-BCC7-9735C46446B5@gmail.com> <50903A73.1060809@ninenines.eu> Message-ID: > I feel obligated to tell you I started calling you the "congrats guy" since you congratulate every progress everywhere. :) well, you're right ;-) Regards, Zabrane From erlang at rambocoder.com Wed Oct 31 00:38:40 2012 From: erlang at rambocoder.com (rambocoder) Date: Tue, 30 Oct 2012 19:38:40 -0400 Subject: [99s-extend] cowboy_http_handler type spec Message-ID: Hi everyone, newb questions here: Is the reason why the type specification for the init callback lists various "{loop,..." tuples, because a single module can implement cowboy_loop_handler and cowboy_http_handler? And this way, a dializier warning will not be triggered? https://github.com/extend/cowboy/blob/master/src/cowboy_http_handler.erl#L39 Because looking at the handler code, https://github.com/extend/cowboy/blob/master/src/cowboy_protocol.erl#L473 if the {loop, * is returned from init, then the handle(Req, State) will not be processed. Also, is it safe to say that Handler:init is like "before" in lot's of web frameworks. I can place validation\authentication logic there. Sincerely, -rambocoder -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen at ninenines.eu Wed Oct 31 00:43:06 2012 From: essen at ninenines.eu (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 31 Oct 2012 00:43:06 +0100 Subject: [99s-extend] cowboy_http_handler type spec In-Reply-To: References: Message-ID: <5090660A.2000301@ninenines.eu> On 10/31/2012 12:38 AM, rambocoder wrote: > Hi everyone, newb questions here: > > Is the reason why the type specification for the init callback lists > various "{loop,..." tuples, because a single module can implement > cowboy_loop_handler and cowboy_http_handler? > And this way, a dializier warning will not be triggered? > https://github.com/extend/cowboy/blob/master/src/cowboy_http_handler.erl#L39 Yes that's exactly why. Not the best solution but good enough. > Because looking at the handler code, > https://github.com/extend/cowboy/blob/master/src/cowboy_protocol.erl#L473 if > the {loop, * is returned from init, then the handle(Req,State) will not > be processed. You have this one if you just want loops: https://github.com/extend/cowboy/blob/master/src/cowboy_loop_handler.erl Having an identical init in both allows us to use the 2 handlers without Dialyzer complaining. > Also, is it safe to say that Handler:init is like "before" in lot's of > web frameworks. I can place validation\authentication logic there. Definitely, prepare what you need in init, do what you need to do in handle and clean up in terminate if needed. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu